Linking to a LC desktop app with a URL

David Bovill david.bovill at gmail.com
Thu May 21 02:51:34 EDT 2020


Yes thanks Trevor. I must some time soon migrate to using Levure - is there an easy Start here introduction for a new project?
On 21 May 2020, 07:10 +0100, Peter Bogdanoff via use-livecode <use-livecode at lists.runrev.com>, wrote:
> This is great! Thank you Trevor!
>
>
> > On May 20, 2020, at 5:01 PM, Trevor DeVore via use-livecode <use-livecode at lists.runrev.com> wrote:
> >
> > On Wed, May 20, 2020 at 5:12 PM Peter Bogdanoff via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> >
> > > Has anyone worked on the idea of accessing a LiveCode application from a
> > > web browser, such as happens with Zoom? With a URL link to a zoom.us
> > > page, the webpage shows a dialog:
> > >
> > > “Do you want to allow this page to open ‘zoom.us’?”
> > >
> > > which then opens the local app zoom.us.
> > >
> > > My use for this would be for enabling a user using an online LMS (learning
> > > management system) to directly access a location in my application on their
> > > local machine.
> > >
> > > I see a few methods described online, but was wondering if anyone has
> > > experience with this.
> > >
> >
> > ScreenSteps uses this technique for sending actions from our web app to our
> > desktop. Extensive testing has been done on macOS and Windows. The Levure
> > framework has the file_system helper which does most of the work for you
> > on Windows, macOS, and iOS so you can look at that code for guidance. You
> > can find the source code at the link below. I will link to specific code
> > examples below as well.
> >
> > https://github.com/trevordevore/levure/tree/develop/framework/helpers/file_system
> >
> > There are three parts that make up a working solution - registration,
> > processing requests, and triggering requests. Here is a description of
> > each. Hopefully I'm not missing anything. I coded this a long time in
> > Levure and haven't had to think about it much since.
> >
> > 1. Tell the operating system your app can handle a url protocol.
> >
> > ## Windows
> >
> > You will need to modify the registry. Here is a link to the command that
> > updates the registry in the file_system helper:
> > https://github.com/trevordevore/levure/blob/develop/framework/helpers/file_system/file_system.livecodescript#L193
> >
> > The command uses levureStandaloneFilename(), a framework function that
> > returns the full path to the standalone application. Just replace that with
> > a similar function so that you can add the full path to your app to the
> > registry.
> >
> > This command can be called each time your application launches if you want
> > to make sure that the version the user just launched is the one the OS will
> > send a url request to.
> >
> > ## macOS and iOS
> >
> > Add the URL protocol you want to add to your Info.plist file. It will look
> > something like this (taken from the ScreenSteps Info.plist file) :
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
> > http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> > <plist version="1.0">
> > <dict>
> > ... OTHER STUFF
> > <array>
> > <dict>
> > <key>CFBundleURLName</key>
> > <string>ScreenSteps URL</string>
> > <key>CFBundleURLSchemes</key>
> > <array>
> > <string>x-screensteps-app</string>
> > <string>screensteps</string>
> > <string>screensteps-4</string>
> > </array>
> > </dict>
> > </array>
> > </dict></plist>
> >
> > 2. Process URL requests sent by the OS to your app
> >
> > ## Windows
> > Process `relaunch` command, extract command line arguments looking for url.
> >
> > `relaunch` is handled within main Levure script:
> > https://github.com/trevordevore/levure/blob/develop/framework/levure.livecodescript#L46
> >
> > The file_system helper processes the parameters though:
> > https://github.com/trevordevore/levure/blob/develop/framework/levure.livecodescript#L46
> >
> > ## macOS
> > Process the appleEvent with pClass "GURL" AND pID "GURL".
> >
> > https://github.com/trevordevore/levure/blob/develop/framework/helpers/file_system/file_system.livecodescript#L111
> >
> > ## iOS
> > Process `urlWakeUp`.
> >
> > https://github.com/trevordevore/levure/blob/develop/framework/helpers/file_system/file_system.livecodescript#L65
> >
> > 3. Triggering requests
> >
> > Triggering requests is as simple as using your custom protocol in an <a>
> > tag in your web page.
> >
> > <a href="screensteps://some/information/for/desktop/to?parse=1">Click me</a>
> >
> > Hopefully this helps you implement the behavior in your own app.
> >
> > --
> > Trevor DeVore
> > ScreenSteps - https://www.screensteps.com
> > Levure App Framework for LiveCode - https://github.com/trevordevore/levure/
> > LiveCode Repos -
> > https://github.com/search?q=user%3Atrevordevore+topic:livecode
> > LiveCode Builder Repos -
> > https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list