1 Reply Latest reply on Oct 23, 2013 3:19 PM by areohbee

    LrHttp communications

    victorvodka

      I'm experimenting with opening a remote website in a window using LrHttp. I am curious what kind of communication potential exists between a plugin and a web page opened in this way.  Obviously, that page could be opened with a URL generated by the plugin, which provides a good form of communication in that direction. And, based on the documentation, it seems as if a lightroom plugin can read cookies written by the website that it opened (is this really true??). So that seems to provide at least one avenue of communication the other way. I just add an observer to whatever form that cookie becomes in the plugin and do things based on changes to that.  But what other forms of communication are possible? How might a Javascript routine send the plugin information?  Does the plugin have a psuedourl that can receive posted data?  There's nothing about this in the documentation, so I'm hoping someone knows something about this.

        • 1. Re: LrHttp communications
          areohbee Level 5

          victorvodka wrote:

           

          How might a Javascript routine send the plugin information?  Does the plugin have a psuedourl that can receive posted data?

          lightroom://{your-plugin-toolkit-id}/etc...

           

          etc... is whatever you want it to be (Lr will not parse).

           

          Example from cookmarks plugin:

           

          In Info.lua

          -------------

          URLHandler = "urlHandler.lua",

           

           

          In urlHandler.lua

          --------------------

          return {

              URLHandler = function(url)

                  if url:sub( 1, 1 ) == '"' then -- double-quote wrapped format.

                      cookmarks:urlHandler( url:sub( 2, -2 ) ) -- strip double-quotes.

                  else

                      cookmarks:urlHandler( url )

                  end

              end

          }

           

          Note: you have to be prepared for double-quote wrapping, and not, unless you don't care whether it's reliable - dunno details..