Sign in to follow this  
Followers 0
arminius

multible executions within a script?

7 posts in this topic

ok I'm a newb, and what I'm wanting to do is run a process but also run a progress meter on how long this process is taking

here is the coding

CODE
ProgressOn("Progress", "", "", 718, 606, 16)

Sleep(1*1000)

$Second = 0

$Min = 0

$Hour = 0

$Pro = 0

Do

ProgressSet($Pro , "", "Count is: "& $Hour &" Hours " & $min &" Mins " & $Second &" Secs")

GuiCtrlCreateProgress(60, 80, 150, 20)

If $Second = 59 Then $Second = -1

If $Second = -1 Then $Min = $Min + 1

If $Min = 60 Then $Min = -1

If $Min = -1 Then $Hour = $Hour + 1

If $Min = -1 Then $Min = $Min + 1

$Second = $Second + 1

$Pro = $Pro + 0.009

Sleep(999.9)

Until $Hour = 8

SoundPlay("C:\WINDOWS\Media\tada.wav")

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

as u can imagine it won't run the windows defender until the progress part is done, so can I tell it to do the progress timer while carrying on with the rest of the script?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not sure if I understand you correctly.

If you mean you want to see how long the application is running, then do this. First run the process, then begin the "timer loop". The loop should do:

Do
    ; Timer stuff
Until (($Hour == 8) or (not ProcessExists("....")))

If you mean you want to see how long it takes for the application to start, then do the same thing, but get rid of the not keyword in the Until code block. Or probably a more efficient way would to use the Timer* functions.

Edited by cppman

Share this post


Link to post
Share on other sites

I'm not sure if I understand you correctly.

If you mean you want to see how long the application is running, then do this. First run the process, then begin the "timer loop". The loop should do:

Do
    ; Timer stuff
Until (($Hour == 8) or (not ProcessExists("....")))

If you mean you want to see how long it takes for the application to start, then do the same thing, but get rid of the not keyword in the Until code block. Or probably a more efficient way would to use the Timer* functions.

the progress window popped up and the process continued but the timer isn't counting, just staying at zero, it's a step forward but a counter that doesn't count is useless

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ProgressOn("Progress", "", "", 718, 606, 16)
Run("notepad.exe")

$Second = 0
$Min = 0
$Hour = 0
$Pro = 0

Do
    ProgressSet($Pro , "", "Count is: "& $Hour &" Hours " & $min &" Mins " & $Second &" Secs")
    GuiCtrlCreateProgress(60, 80, 150, 20)
    If $Second = 59 Then $Second = -1
    If $Second = -1 Then $Min = $Min + 1
    If $Min = 60 Then $Min = -1
    If $Min = -1 Then $Hour = $Hour + 1
    If $Min = -1 Then $Min = $Min + 1
    $Second = $Second + 1
    $Pro = $Pro + 0.009
    Sleep(999.9)
Until (($Hour == 8) or (not ProcessExists("notepad.exe")))
SoundPlay(@WindowsDir & "\Media\tada.wav")
Sleep(1000)
This shows how long the application has been running.

But I'm still not sure what your asking. Could you explain?

Edited by cppman

Share this post


Link to post
Share on other sites

I'm glad for the help but I'm not seeing what use the notepad is?

this is the full unabridged script of the process I want to run

CODE
SoundPlay("C:\WINDOWS\Media\tada.wav")

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

SoundPlay("C:\WINDOWS\Media\tada.wav")

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

ControlClick("Windows Defender", "", "Scan options")

MouseClick("left", 512, 298)

Sleep(45*60*1000)

Sleep(45*60*1000)

SoundPlay("C:\WINDOWS\Media\tada.wav")

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

Sleep(25*1000)

ControlClick("Spybot - Search & Destroy", "", "&Check for problems")

Sleep(34*60*1000)

MouseClick("left", 350, 130)

MouseClick("left", 370, 130)

MouseClick("left", 570, 550)

Sleep(12*1000)

ControlClick("Warning", "", "No")

Sleep(3*1000)

ControlClick("Confirmation", "", "OK")

SoundPlay("C:\WINDOWS\Media\tada.wav")

Sleep(2*1000)

Run("C:\Program Files\Grisoft\AVG Anti-Spyware 7.5\avgas.exe")

Sleep(10*1000)

MouseClick("left", 723, 278)

MouseClick("left", 675, 406)

Sleep(40*60*1000)

SoundPlay("C:\WINDOWS\Media\tada.wav")

Sleep(2*1000)

Run("C:\Program Files\Clean Disk Security\clndisk.exe")

Sleep(5*1000)

MouseClick("left", 688, 344)

Run("C:\WINDOWS\wizmo.exe quiet blank")

Sleep(2*60*1000)

SoundPlay("C:\WINDOWS\Media\tada.wav")

Sleep(2*1000)

Run("C:\Program Files\Grisoft\AVG7\avgw.exe")

Sleep(7*1000)

ControlClick("AVG Free Edition - Test Center", "", "Scan Computer")

Sleep(7*1000)

ControlClick("AVG Free Edition", "", "&No")

what I want to do is when the script is first run a progress box will also open timing the total time of how long the script is running for,

under your latest coding it takes about 10 seconds for notepad to load, then when it does the timer does count as I want it to, but when notepad closes windows defender comes on but the timer pauses.

so really just wanna click on the script, the tada plays, windows defender pops up and the timer starts to count until the script terminates.

ProgressOn("Progress", "", "", 718, 606, 16)
Run("notepad.exe")

$Second = 0
$Min = 0
$Hour = 0
$Pro = 0

Do
    ProgressSet($Pro , "", "Count is: "& $Hour &" Hours " & $min &" Mins " & $Second &" Secs")
    GuiCtrlCreateProgress(60, 80, 150, 20)
    If $Second = 59 Then $Second = -1
    If $Second = -1 Then $Min = $Min + 1
    If $Min = 60 Then $Min = -1
    If $Min = -1 Then $Hour = $Hour + 1
    If $Min = -1 Then $Min = $Min + 1
    $Second = $Second + 1
    $Pro = $Pro + 0.009
    Sleep(999.9)
Until (($Hour == 8) or (not ProcessExists("notepad.exe")))
SoundPlay(@WindowsDir & "\Media\tada.wav")
Sleep(1000)
This shows how long the application has been running.

But I'm still not sure what your asking. Could you explain?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I used "notepad.exe" as an example because I do not have Windows Defender. Just change where it says "Notepad.exe" to the path to your executable.

Edited by cppman

Share this post


Link to post
Share on other sites

oh ok, well there were heaps of other programs ment to be run so I never thought it was the one specific program, I tried it though, and the progress bar isn't displaying anything at all.

Share this post


Link to post
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
Sign in to follow this  
Followers 0