6 Replies Latest reply on Jun 17, 2012 7:37 PM by datastride

    Click in web viewer to trigger a script

    datastride

      FM 12 ...

       

      I'm displaying some HTML in a web viewer, and I'd like to find a way to embed a link that would fire off a script when clicked.

       

      Does anyone know a trick to make this work? (I have no problem using a plug-ins if needed.)

       

      Thanks in advance for any ideas ...

        • 1. Re: Click in web viewer to trigger a script
          steve_ssh

          Hi Morgan,

           

           

          FM URL Protocol

           

          You might check into the following blog article:

           

          http://buzz.beezwax.net/2012/04/21/native-web-2-0-controls-in-filemaker-12-layouts

           

          It's an article that shows how FMP URLs can be called from within a webviewer to invoke a script.

           

          The technique described in the article works great with FM Go  - I can vouch for that -- I have really enjoyed trying this out and using it on Go.   I haven't played with the technique on the regular desktop version of FM Pro enough to be able to vouch for it there.  Certainly I can see some potential, though.

           

           

           

          24U Simple Talk Plugin

           

          I've also played with a demo version of 24U's Simple Talk plug-in (tried it out on a Mac).  I like the plug-in a lot, and it allowed me to trigger a script in response to a HTTP request just fine.  Since the plugin actually allows for a lot of possibilities with respect to network communication, it might not be specific enough for some folks, i.e. I could imagine that some folks might prefer a script that just limited itself to listening on a port and triggering a script and nothing more.  Personally, I really like the possibilities offered by Simple Talk and I expect I'll be buying a license to it.  (I haven't tried it on a Windows machine.)

           

          http://www.24usoftware.com/SimpleTalk

           

           

           

           

          360 Works Remote Scripter

           

          360 Works offers a plugin which I believe is supposed to do exactly what you need.  I haven't tried it out, so I can not comment on it beyond that it exists:

           

          http://www.360works.com/remotescripter/

           

           

           

           

          Hope this helps some.

           

          Very best,

           

          -steve

          • 2. Re: Click in web viewer to trigger a script
            monkeybreadsoftware

            Our MBS Plugin can execute Javascript in webviewer and also have the webviewer call Filemaker from Javascript. And very direct without running a webserver like those other solutions.


            Greetings

            Christian

            • 3. Re: Click in web viewer to trigger a script
              datastride

              Steve,

               

               

               

              Thanks a mil! This is pretty darn cool stuff.

               

               

               

              I plan to dig in this evening to try and get something working.

               

               

               

              Peace, love & brown rice,

               

              Morgan Jones

               

               

               

              FileMaker + Web:  Design, Develop & Deploy

               

              Certifications: FileMaker 9, 10 & 11

               

              One Part Harmony <http://www.onepartharmony.com/>  

               

              Austin, Texas • USA

               

              512-422-0611

              • 4. Re: Click in web viewer to trigger a script
                datastride

                Thanks for the tip, Christian.

                 

                 

                 

                I’ll check out your plug-in this evening.

                 

                 

                 

                Peace, love & brown rice,

                 

                Morgan Jones

                 

                 

                 

                FileMaker + Web:  Design, Develop & Deploy

                 

                Certifications: FileMaker 9, 10 & 11

                 

                One Part Harmony <http://www.onepartharmony.com/>  

                 

                Austin, Texas • USA

                 

                512-422-0611

                • 5. Re: Click in web viewer to trigger a script
                  steve_ssh

                  Hi Morgan,

                   

                  Just a quick additional note:

                   

                  Christian's post reminded me that I neglected to mention another approach that I've played with when I was trying to accomplish this sort of thing without using any plugins:

                   

                  Use a repeating timed script to check for changes to the WebViewer source

                   

                    - Generate the HTML content for the WebViewer such that a click on a button or a link would modify the WebViewer source.  In my case, I would use a data URL to generate the HTML source, and I would use Javascript to regenerate the complete source for the page, including a small modification that the OnTimer script would detect, and then I would reset the value of document.location with the newly generated page source.

                   

                    - Additionally, set up an OnTimer script which would use GetLayoutObjectAttribute to check the source property of the WebViewer, and which would take appropriate action if it detected a change to the WebViewer's source.

                   

                  The above approach seemed to work just fine, and it seems only fair to include it on the list of options you have.

                   

                   

                  Having said the above:

                   

                  I've enjoyed trying out the other techniques, because I've been able to keep my FM code (and HTML code) simpler when I don't utilize the OnTimer script technique.

                   

                  Best,

                   

                  -steve

                  • 6. Re: Click in web viewer to trigger a script
                    datastride

                    Steve,

                     

                     

                     

                    Thanks very much for taking the extra time to write again. I’m very grateful for all the insights.

                     

                     

                     

                    I see exactly how this new idea would work, but I’m thinking I would prefer not to deal with the overhead of the OnTimer script. I really like (at least conceptually) the approach described in the Beezwaz blog post. Since I’m going to be mucking around, adding stuff to the HTML that will be displayed in the web viewer anyway, it would be pretty simple to implement … at least after I get the custom functions set up the first time thru the exercise. Gotta love those custom functions …  

                     

                     

                     

                    Anyway, thanks again for pointing me in a very promising direction. This ability to use just about any kind of control in a web viewer is just ultra-cool! The minds reels when thinking of the possibilities …

                     

                     

                     

                    Peace, love & brown rice,

                     

                    Morgan Jones

                     

                     

                     

                    FileMaker + Web:  Design, Develop & Deploy

                     

                    Certifications: FileMaker 9, 10 & 11

                     

                    One Part Harmony <http://www.onepartharmony.com/>  

                     

                    Austin, Texas • USA

                     

                    512-422-0611