June 15, 200619 yr Hi all, I know how to specify a file and run a script in that file, but can that file be dynamically selected? I plan to use this in my navigation system. Any ideas? Tim
June 15, 200619 yr The "the perform script" script step does not take a variable as the script name to perform. So you could do it with a huge if...end if statement and hard code all possibilites. if($_scriptToRun = "this") perform script "this" else if($_scriptToRun = "that") perform script "that" else if ... ... end if You can do it without hard coding the scripts but it would require going outside of FM and using the Send Event script step to trigger a VBscript that in turn uses the DoFMscript ActiveX function to run a script of your choice. Since the VBscript can be entirely dynamic you can ask it to run any script you want.
June 15, 200619 yr Author Thanks Wim, I am not familiar with vbscripting. Do you know of any links that could help in learning to use it? Tim
June 16, 200619 yr Check the FM help file for "activeX". (note that the examples there are for VB/VBA, not VBscript. But it's very similar). www.microsoft.com/scripting is probably the best place to get started.
June 16, 200619 yr Author Thanks Wim, I will check it out. Does vbscripting get tricky in a multi-user, server hosted solution?
June 17, 200619 yr Not really. These are the challenges though: - FM cannot execute VBscript syntax directly out of a field (unlike the "perform applescript" script step in the Mac version of FM) - so you need to take your VBscript syntax out of a field and ceate a physical VBscript file on the hard disk - what location do you pick for that? The user must have write privileges on that folder - when you execute that file (with the Send Event script step), FM does not wait for the result, it forges ahead with the next script step and this may cause you some timing issues if you need to wait for the result: how long do you make FM pause? - when the VBscript is done, you probably need to delete it, otherwise the user may see it somewhere and decide to double-click it... executing it again Those are the hoops you need to jump through. Totally feasible, I've been doing for years. But then I got tired of it and wrote a plugin to solve all these issues.
June 17, 200619 yr Let me add that you can also keep a VBscript outside of FM and call it using parameters. That sort of solves the VBscript creation process.
June 19, 200619 yr I'll throw in that you could use the EventScript plugin to trigger a script based on a field value. So your generic script would first set a global field, and then send this to EventScript to trigger the specified script. EventScript is a free plugin, and not that difficult to implement. David
Create an account or sign in to comment