Jump to content

how do I delay program executions?


Recommended Posts

I'm trying to write a script that will automatically run all my spyware scanners, but I don't want them running all at the same time, so wanted to give the first one an hour to finish then it will execute the next program, here is what I have so far

CODE
Run("C:\Program Files\Windows Defender\MSASCui.exe")

MouseClick("left", 480, 260, 1)

MouseClick("left", 480, 300, 1)

WinWait("Untitled", 3600)

Run("C:\Program Files\Spybot - Search & Destroy\SDMain.exe")

WinWait("Untitled", 4)

MouseClick("left", 280, 150, 1)

winwait seems to work fine for causing delays of 4 seconds, I assumed that 3600 second delay would make it wait an hour, but it works far to well, it doesn't execute spyboy at all.

any suggestions?

Link to comment
Share on other sites

I assumed that 3600 second delay would make it wait an hour

Sleep(3600) is just 3.6 seconds

Sleep(5*60*1000) ;<<-------- 5 minutes

Normally I use TimerDiff() for sleeps that long instead of Sleeps.

I guess Sleep and WinWait use different time formats.

Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Sleep(3600) is just 3.6 seconds

Sleep(5*60*1000) ;<<-------- 5 minutes

Normally I use TimerDiff() for sleeps that long instead of Sleeps.

I guess Sleep and WinWait use different time formats.

I'm sorry but I'm an extreme newb, what is the coding for TimerDiff() that would make the script pause for an hour?
Link to comment
Share on other sites

I'm trying to write a script that will automatically run all my spyware scanners, but I don't want them running all at the same time, so wanted to give the first one an hour to finish then it will execute the next program, here is what I have so far

CODE
Run("C:\Program Files\Windows Defender\MSASCui.exe")

MouseClick("left", 480, 260, 1)

MouseClick("left", 480, 300, 1)

WinWait("Untitled", 3600)

Run("C:\Program Files\Spybot - Search & Destroy\SDMain.exe")

WinWait("Untitled", 4)

MouseClick("left", 280, 150, 1)

winwait seems to work fine for causing delays of 4 seconds, I assumed that 3600 second delay would make it wait an hour, but it works far to well, it doesn't execute spyboy at all.

any suggestions?

WinWait can not point to "Untitled" for Spybot because the window with the title "Untitled" will never exist.

At the top of the script use Opt("WinTitleMatchMode", 2)

Change your WinWait to

WinWaitActive("Spybot")

Also I'm not sure what the text is in the Title bar for Windows defender but you would use that in the WinWaitActive() for the Windows Defender portion of your code. Also take note that window titles are case sensitive.

For Spybot weapon_x has also given you some good advice, Use the commandline options but you will also need the ProcessExists that I gave in the other reply.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I'm sorry but I'm an extreme newb, what is the coding for TimerDiff() that would make the script pause for an hour?

1 hour is 60000 miliseconds.

Like it was pointed out earlier you should be delaying only for the lenghth of time that the process exists.

After the run lines use this but change the process name as required.

While ProcessExists("SDMain.exe")
   Sleep(2500)
WEnd

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I was under the impression an hour is 3600000ms. ;) 60000 is a minute.

:) Right you are.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

$run = RunWait ( $root & "\SpybotSD.exe /taskbarhide /autocheck /autoupdate /autoclose" , $root & "\")
That works for Spybot but the OP is attempting to

to write a script that will automatically run all my spyware scanners

and I don't know what scans are included in "all" nor what the commandline parameters would be for the others. However command line and While ProcessExists() are the way to go where possible.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Fine.

Heres one for Windows Defender:

RunWait('MSASCUI.EXE -UpdateAndQuickScan')

Heres one for Adaware:

$run = RunWait ( $root & "\Ad-Aware.exe /full +silent +archives" , $root & "\")

Shall I continue?

Link to comment
Share on other sites

Shall I continue?

Only if you feel like it. :) It's obvious that Google will provide solutions for most.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...