On Thu, Sep 19, 2019 at 5:25 PM Peter Bogdanoff via use-livecode < use-livecode@lists.runrev.com> wrote:
> A user asked about “linking” to my desktop LC app from a PDF. Is there > anything in the PDF spec that does this? His idea was that it the link > would do more than just opening up my app, but contain data that indicates > a specified “page” in my app. > > My application is Mac/Windows. > You can define a url protocol (e.g. myapp://) which can be configured on Mac or Windows to launch your application. This works with links in a browser so that a web page can contain a link that launchers your application. I don't know if it will work from a PDF file, though. It may depend on the PDF viewer or other variables. It is probably worth trying as you can embed the "page" number in the url. On Windows you need to update the Windows Registry. Here is a link to some code in a library that ships with Levure that will set the appropriate values in the registry: https://github.com/trevordevore/levure/blob/develop/framework/helpers/file_system/file_system.livecodescript#L193 You can run this code when your application first launches. On Mac/iOS you need to add some keys to your Info.plist file. The README for the library has an example: https://github.com/trevordevore/levure/tree/develop/framework/helpers/file_system#url-protocols Once you've set the registry/Info.plist files up (you will need to launch the app at least once on macOS so it picks up the settings in the plist file) your app will be launched when the URL protocol is triggered. On macOS you will handle an appleEvent. You can look at the code in the library for hints: https://github.com/trevordevore/levure/blob/develop/framework/helpers/file_system/file_system.livecodescript#L83 For Windows you can read the `commandArguments` when the app launches or, if the application is already running, handle the `relaunch` command and use the parameters passed to it. Hopefully that is enough to get you started. -- Trevor DeVore ScreenSteps www.screensteps.com _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode