Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6734 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

Thanks Wim,

I am not familiar with vbscripting. Do you know of any links that could help in learning to use it?

Tim

Posted

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.

Posted

Thanks Wim,

I will check it out. Does vbscripting get tricky in a multi-user, server hosted solution?

Posted

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.

Posted

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.

Posted

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

This topic is 6734 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.