Article

dguest's picture
article
Reads:

3226

Score:
0
0
 
Comments:

0

Running a Windows Script Just Once

(View Disclaimer)

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.


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell