andries Posted September 6, 2010 Posted September 6, 2010 (edited) Hi I am trying to build an HTTP listener, so it would be possible to remotely trigger a filemaker script. I was thinking in the direction of the ServerSocket class. However the methodg .accept(), enables this socket to start listening for incoming calls, but completely blocks FileMaker. I guess because the ScriptMaster script never finishes, this is completely according to the Java documentation which states: Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made. So... my question is: is there a way so we can make a scriptmaster script run in the background? Or is this not possible using ScriptMaster? Edited September 6, 2010 by Guest
fseipel Posted September 6, 2010 Posted September 6, 2010 If you turn on instant web publishing, then you can remotely trigger scripts with pushbuttons. Even with IWP, you can remotely trigger scripts; since ScriptMaster is IWP-friendly, that will do the trick. At least on Windows, anything in the iwp directory is served, so if you just place an html file in that folder with a javascript to open the DB and fire the script, it will run without need to login. I was experimenting with this a day ago, and found I could even pass parameters by setting a field equal to the URL parameter before running the script. It worked great, as long as I posted to a dummy frame so browser didn't lose focus on successive POSTs. Alternately on your Mac you can have PHP trigger an AppleScript to run an FM script, e.g. how iTunes can be controlled remotely. http://www.whatsmyip.org/itunesremote/
andries Posted September 6, 2010 Author Posted September 6, 2010 Thanks for the reply, I don't completely understand how your technique works, but I will definitely take a look at this technique. However I am just trying to learn some Java, and I thought this would be a nice thing to try. But I just discovered that 360 works has this feature already available as a plugin... Anyway it is also a more general question. Is it possible to create a java "applet" that runs in the background using scriptmaster?
Valentin Posted September 6, 2010 Posted September 6, 2010 Andries, you are correct in your assumption that ScriptMaster functions do not run in the background. This may not be the route you were looking for, however, we do have a plugin that does just what you're looking for. RemoteScripter fseipel, is also correct in pointing out that a script can be executed in Web Publishing and triggered remotely. Using the XML publishing API or the PHP API
andries Posted September 6, 2010 Author Posted September 6, 2010 Hi Valentin thanks for your reply. Well I discovered the plugin when I was looking on the internet for "ScriptMaster" and "HTTP-listener". As I mentioned it is more to learn Java and ScriptMaster than I actually already has an application in mind that would need this. I downloaded the demo-version of the plugin and will give it a try. I know you can remotely trigger a script using the php api on a server, however it is more that I wanted to create a listener on the client side. For example to trigger a script from a webviewer (which I can actually do with your plugin). So if I understand well, with ScriptMaster I need to make sure that my code can run until the end. Another question. I am getting into "OOP" and learning that it is better to organize your code into classes. However is this possible in ScriptMaster? Am I on the correct route if I think the solution lies in creating JAR files and loading them into ScriptMaster?
Jesse Barnum Posted September 7, 2010 Posted September 7, 2010 Andries, this is how I would do it if it were me (writing Java classes, packaging them into a jar file, and including that with ScriptMaster). We do this internally for a lot of our in-house projects that use ScriptMaster. With ScriptMaster Advanced, it will bundle these jar files into the generated plugin, so it's completely self-contained.
Recommended Posts
This topic is 5202 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