Running a Windows Script Just Once



By: dguest

September 6, 2006 12:00 am

Reads:272

Comments:0

Score:Unrated

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.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading ... Loading ...

Tags:
Categories: SecureLogin, Technical Solutions

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment