Running a Windows Script Just Once
Novell Cool Solutions: Tip
By David Guest
Digg This -
Slashdot This
Posted: 6 Sep 2006 |
Problem
A Forum reader asked this question:
"I created a dummy app to launch and trigger SecureLogin to launch a script, but the script keeps running multiple times instead of just once. The dummy app is in C# - it is just an empty dialog box.
Here is the script. The original dummy app has a timer and automatically closes after 500 milliseconds."
#Begin Script Delay 1000 Run "C:\ConsoleApplication1.exe" "?SysUser" "?SysPassword" Delay 1000 Run "C:\Cleanup.exe" EndScript
And here's the reply from SecureLogin expert David Guest ...
Solution
The problem is really that Windows scripts run all the time, from top to bottom. They wait until such time as they see a dialog (window) that they have to act upon. Because your app starts and then closes, the script can run multiple times. You should try doing something like this:
#Begin Script Increment ?Counter If ?Counter eq 1 Delay 1000 Run "C:\ConsoleApplication1.exe" "?SysUser" "?SysPassword" Delay 1000 Run "C:\Cleanup.exe" EndIf EndScript
That should sort the problem out.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com