Diver Posted November 17, 2009 Posted November 17, 2009 I wanted to have a script trigger launched upon modification of the SuperContainer web viewer. If there was an image in it, it would do one thing. If there was no image in it, it would do another. I have found if I drag a file into the web viewer no script is ever triggered. If I control click on the web viewer and delete an image and then click on the layout, a trigger will activate. Is there any way to make the dragging of an image into the web viewer activate a script or for a script to be activated when deleting an image from the web viewer without clicking on the layout?
Smef Posted November 17, 2009 Posted November 17, 2009 Using the plugin you can use the SCGetInfo function to get information about the file stored at a URL. You can store this information in a unstored calc field, and make a script trigger if the information is changed. The triggered script can then check and see if the URL is empty or contains a file to determine what functions to perform. I hope that this is the sort of thing you are looking for.
Diver Posted November 17, 2009 Author Posted November 17, 2009 (edited) Thanks for the thought ... I had been thinking the same thing. The problem is FileMaker does not see the web viewer as changing so the un-stored calc using SCGetInfo does not change unless you force FileMaker to record the record by refreshing or clicking outside of any object. Edited November 17, 2009 by Guest
Smef Posted November 18, 2009 Posted November 18, 2009 Another solution to this would be to script an upload using FileMaker scripting and the SuperContainer Companion plugin. You can disable uploading and deleting to the web viewer by adding the "?style=readonly" so that users cannot drag and drop or delete files using the web viewer. This will force them to use the scripts you have written to upload and download.
Diver Posted November 18, 2009 Author Posted November 18, 2009 Thanks David. I had thought of that as well but it is such a nice feature to be able to just drag and drop. Much easier than having to go through a file tree to locate the file already at your fingertips. Could SuperContainer be enhanced to allow the FM record to be saved upon modification of the web viewer content? This would allow script triggers to then be available.
Smef Posted November 18, 2009 Posted November 18, 2009 SuperContainer cannot actually interact with filemaker the way it is currently built (outside of the plugin), but this is something that is possible to do with some customization. If you are interested in having us do this for you as a custom development project, please email Val [email protected] with information about what you are looiking to have done and he will be able to provide you an estimate for this configuration.
Fenton Posted November 18, 2009 Posted November 18, 2009 Drag and drop of an image file into a Web Viewer, in order to show it and capture its file path can be done using the ScriptMaster plug-in to run a script. The action to run the script is Conditional Formatting, setting a Variable to the source of the Web Viewer object. It is a bit tricky to set up (or explain), but works very well. This is not really my example file. It is one I simplified from another. Unfortunately the original author did not put his name on his file, and I can no longer remember where I downloaded it from (and it wasn't that long ago :-). My apologies; please respond if it is you, so credit can be given where it is due; and it is due; this is a great technique. He had 2 methods to run the script, one using zippScript, one using ScriptMaster. Since zippScript is more or less obsolete (for obscure reasons), I did not include it in my file. He had other things, such as exporting, which I left out; I wanted to keep it as simple as possible to show the basic method. WV_Drop.fp7.zip
Smef Posted November 18, 2009 Posted November 18, 2009 I may be misinterpreting this example, but I don't think this solution will work in this case because it depends on the web viewer's URL changing, which does not happen when you drag a file into SuperContainer. I tried the example file with the web viewer pointing to a SuperContainer URL and the script was not triggered when an image was uploaded to SuperContainer through drag and drop. Were you able to get this script working with a SuperContainer URL?
Diver Posted November 18, 2009 Author Posted November 18, 2009 This is a bit mind bending. I see in your example how the Conditional Formatting is using ScriptMaster plugin. I will have to try and dive into it deeper and see if I can apply it to my solution. To summarize, it is basically using a conditional formatting to tell ScriptMaster to run a script. - correct?
Fenton Posted November 18, 2009 Posted November 18, 2009 Smef, I don't have the SuperContainer plug-in, so I didn't know that it wouldn't work with it. I was just throwing it out there, to see if it could help. But I can see that if the URL of the web viewer does not change with SC, then the script would not run, as it depends on a change to the $$source variable, and gets the file path from that. I guess SC is quite different. It would be a great feature, as Diver says, it is just so intuitive to drag files onto an interface in order to "attach" them to the current record. Diver, yes, the conditional formatting is causing a variable to change, which causes the ScriptMaster plug-in to tell a script to run (any "script-trigger" plug-in would do). It is a bit of a long way around, but it seems it is the only way to do it.
Smef Posted November 18, 2009 Posted November 18, 2009 (edited) I spent some time with your example and think that it displays a very useful method of triggering a script. I actually showed it to some other people went in a tried to modify the file using some other calculations and techniques based on this, but it seems that it just doesn't trigger the conditional formatting to run unless something changes in the web viewer (which does not happen with SuperContainer). Thank you for taking the time to post your suggestion. It showed me a very useful way to trigger a script that I (and I'm sure other peopel as well) will be keeping in mind for future projects. Edited November 18, 2009 by Guest
Diver Posted November 18, 2009 Author Posted November 18, 2009 I am uncertain how far I should try the testing, based on the last post. I have tried to implement it but believe where it is breaking is the following. (I have the first line for reference only). $file = Get (FileName) 1 + Left( EvaluateGroovy( "fmpro.performScript("" & $file & "","Show"); return true;" ); 0)) The second line is the line in the conditional formatting that I need to change. The reason is the filemaker file I am using is hosted on a server. It appears the code above is formatting the path to the local file so it can tell ScriptMaster to run the file's script called "Show". I tried replacing a portion of the text to be something like: EvaluateGroovy("fmpro.performScript( "fmnet:/serveripaddress/fmFileName","Show");return true;);0)) serveripaddress = the IP Address of my FM Adv. Server fmFileName=the hosted FileMaker database Show= the script within my FileMaker database to run I am guessing I have something messed up with the quotes and am not able to find documentation on what EvaluateGroovy is expecting for parameters.
Peter Lehrack Posted October 14, 2010 Posted October 14, 2010 I too am interested in being able to trigger a script on drag and drop. Has there been any new info on this topic? Peter
gdurniak Posted December 19, 2010 Posted December 19, 2010 this is a disappointment for us. Our users want drag & drop, but you must refresh window to see the new filename, even in an unstored calc I even tried "scraping" the filename from the HTML that is returned to the applet. ( "FileName" is in there! ) it seems the applet needs to "talk" to the plugin, so it can update FileMaker >I too am interested in being able to trigger a script on drag and drop. Has there been any new info on this topic? Peter
john renfrew Posted December 20, 2010 Posted December 20, 2010 Looping SetOnTimerScript ? example from http://campsoftware.com/products/qc-signature-capture/
Recommended Posts
This topic is 5085 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now