Superalert with variable as time delay

I want a Superalert that notifies me of a procedure that I execute but I want the delay time to be variable. The variable is File Global variable called “fgTimeDelay”. I have verified that the File Global has a value. A quick procedure allows me to change it.

It works fine if I “hard wire it” such as:

Superalert “Henderson Restaurants”,{timeout=2}

But if I introduce a variable for the value of timeout it does not work. I must mouse around and click the “OK” button.

Superalert “Henderson Restaurants”,{timeout=fgTimeDelay}

I even tried the text to number deal:

Superalert “Henderson Restaurants”,{timeout=Val(“fgTimeDelay”)}

No luck.

Also I notice that I must actually click the “OK” button, using Enter on the keyboard does not work. Nor does Return.

I am now on Ventura with an M2 Mac.

Any thoughts?

You can’t put a formula inside the option text – only constants.

However, what you can do is build the option text on the fly using a formula. So the solution to your dilemma is this:

Superalert “Henderson Restaurants”,{timeout=}+fgTimeDelay

If you needed to, you could add additional options after the timeout like this:

Superalert “Henderson Restaurants”,{timeout=}+fgTimeDelay+{ width=500 height=200}

Thanks Jim.

George

Superalert problems

No matter what I do I cannot seem to format a Superalert with a delay that also specifies font type, size and color plus alert box dimensions PLUS the time delay, which is variable.

Jim showed me the “trick” but if I try to go beyond that the delay does not work.

This works with height and width changes and delay:

Superalert “Henderson Restaurants”,{timeout=}+PTimeDelay+{ width=500 height=200}

This works without any delay but it has buttons.

superalert “Are you talking to me?”, {height=240 width=800 font="#LabelFont" size=72 color=“red” buttons=“Yes:60;No:60”}

This does not work regarding delay but I can change the font type, color, size and height and width:

superalert “Are you talking to me?”, {timeout=}+PTimeDelay+{height=440 width=600 font=“Charm” size=32 color=“green”}

What am I doing incorrectly???

Thanks.

You need a space in front of height, just as your first example has a space in front of width.

superalert “Are you talking to me?”, {timeout=}+PTimeDelay+{ height=440 width=600 font=“Charm” size=32 color=“green”}

Without the space, the timeout and height options are “smushed” together, i.e.

timeout=30height=440

It nees to be

timeout=30 height=440

BTW, to make the code look nice here in the forum, simply indent it by 4 spaces.

Thanks Jim,

I hate when things get “smushed”.

You know I saw that space and it did not record in my brain as essential. It was your example earlier. Not really obvious as a necessity! I thought it was a typo!

Noted on indenting code examples too. Forum etiquette one might say.

Thanks. It is working like a charm.

I have found that the timeout option does not work if you have a timer running at the same time. It seems that all the timers are stopped until you manually click a button to close the dialog. If you have no timers of your own running but have the the Timer Workshop window open which also runs the timerWorkshopMonitor timer the timeout again will not function and the Workshop monitor timer will also freeze until the dialog is dismissed.

Had me scratching my head for some time trying to figure out why I couldn’t get the timeout option to work with the alerts that support it. :woozy_face:

That sounds like a bug to me.