Skip to content

How To Set Arbitrary Delay Into FinalBuilder Script (Using Variable)

Updated: at 06:34 PM

I’ve blogged before about how much I like FinalBuilder from VSoft Technologies.  One thing that I’m really happy with is how good there forum support is.  They are down under which means that there is a timezone issue for me (I’m in California) which means that usually when I have a question they are sleeping.  Almost always, when I get up, my answer is waiting for me.  Sometimes, I think they assume I’m more clever than I actually am and will give me answer assuming I’m a finalbuilder expert.  In this blog, I’m going to elaborate on a very simple answer they gave me with pictures and arrows.

The Question On Finalbuilder Forums

The Delay action does not seem to let me put a %delayseconds% type variable in the counter fields for setting.  I want to set the delay to x number of minutes based on some variable.  How can I do that?

What I’m asking is I want my Finalbuilder script to pause for an arbitrary amount of time that I specify in Finalbuilder variable.  The reason I want this is I use Finalbuilder scripts running through Finalbuilder Server and often, I want my script to start after an arbitrary amount of time.  Finalbuilder server allows you to run scripts on a remote server without actually having to remote in which is very nice.  It also provides the ability to “prompt” you for values so you can decide at the time you launch the script, what you want it to do.

So, back to the problem and all the details.

First, in finalbuilder, you need to define a variable which I’m going to call DelayNMinutes.  You start with:

image

Then, you create your new variable called DelayNMinutes with the Add Button on the right (I’m showing what happens after you do this (I defaulted the value to 1 minute).

image

Now, in your Action script, I created an “If” statement where I say “If DelayNMinutes > 0”, execute the delay action.

image

Now, is where it gets a little tricky.  The next action “Delay” gives you a prompt with rolling numbers that does not let you put in the typical variable name that you would usually use.  That is %DelayNMinutes” which is how you would normally put in a variable in Finalbuilder.

image

So, you need to revert to script (which until today, I’d never done before with Finalbuilder).  I’ve used JavaScript quite a bit so that’s an obvious choice for me.  What you do, is you go back to the ide and single click on the “DelayNMinutes” line, select the tab on the bottom called Script Editor, Set your language to JavaScript and add the line:

Action.Delay = DelayNMinutes * 1000 * 60;

image

Which sets the dealy in MilliSeconds as you can see from the help is in MilliSeconds (there online help is pretty good, but does often assume a higher knowledge than I actually have.  For example, in this help, it might be nice to see an example of using it in script.

image

Well, that’s about it.  I think this is about as long as I can make this simple explanation.

Hope this helps!!!