Is there a wait / pause X seconds command?

(imported topic written by tscott91)

I’m having an issue with a fixlet I’m running (not the fixlet / BigFix fault) and I need it to run what I have and then pause for 30 seconds and then run the rest…

I don’t see this anywhere in the docs but I’m assuming there is something like this?

Thanks

(imported comment written by SystemAdmin)

You can use the "pause while " command to do something like this:

parameter "start" = {now};
pause while {now < ( ((  parameter "start" of action  ) as time ) + 30* second)}
//do some stuff after 30 seconds

Additionally, if the reason you want to pause is that you are waiting for a process to finish, you can do something like this:

pause while {exists running application "updater.exe"}

which should be more robust.

-Zak

(imported comment written by tscott91)

I tried adding the first code snip and it fails at: Failed parameter “start” = {now};

(imported comment written by SystemAdmin)

Ah sorry, i wrote that on the fly and didn’t test it.

The relevance substitution will effectively paste into the action script the relevance results. so basically it was trying to do ’ parameter “start” = Thu, 09 Dec 2010 13:37:40 -0800’, which doesn’t work without putting quotes around. also, no semicolon. Wrong language. Try this:

parameter "start" = "{now}"
pause while {now < ( ((  parameter "start" of action  ) as time ) + 30* second)}
//do some stuff after 30 seconds

(imported comment written by lmpymilk91)

I like to do it with a bit of both…

if 
{(exists running applications whose (exists pathname whose (it as lowercase contains 
"Internet Explorer" as lowercase) of it))
} parameter 
"start"=
"{now}" pause 

while 
{(exists running applications whose (exists pathname whose (it as lowercase contains 
"Internet Explorer" as lowercase) of it)) AND (now-time (parameter 
"start") < 120*second)
} endif 

continue 

if 
{not (exists running applications whose (exists pathname whose (it as lowercase contains 
"Internet Explorer" as lowercase) of it))
}

First I like to verify if I even need to wait, then wait for the time or the process to complete. Doing this allows me to set a higher timer so I can actually exit out of the action if the process doesn’t end.

If you’re waiting for somthing to start, then you can swap the “not” to the begining and the wait.

this is helpful when doing updates that may be running more than one process. Like acrobat reader. If you miss one process when you do your update, this could cause a pendingfilerenameoperation. If you wait for all items to close, this will reduce the need for reboots.

Chris

(imported comment written by SystemAdmin)

What if we want to put more than one pause in an action. Say two 30 second pauses.

Would this example below work, or is now statically set to the time the action started?

//pause fo 30 seconds

parameter “start” = “{now}”

pause while {now < ( (( parameter “start” of action ) as time ) + 30* second)}

//do some stuff

//pause fo 30 seconds

parameter “start” = “{now}”

pause while {now < ( (( parameter “start” of action ) as time ) + 30* second)}

//do some more stuff

(imported comment written by lmpymilk91)

something like this works for me

<do some stuff 000>

parameter

“startTime_000”

="{now}"

pause while {(if stuff is true) AND

(now-time (parameter “startTime_000”) < 30*second)}

<do some stuff 001>
parameter

“startTime_001”="{now}"

pause while {(if stuff is true) AND

(now-time (parameter “startTime_001”) < 30*second)}

<do some stuff 002>
parameter

“startTime_002”="{now}"

pause while {(if stuff is true) AND

(now-time (parameter “startTime_002”) < 30*second)}

1 Like

/ for 3 seconds

parameter “start” = "{now}"
pause while {now < ((parameter “start” of action) as time) + (“00:00:03” as time interval)}