Sign in to follow this  
Followers 0
st4vr0s

If winexists ....were am I going wong?

2 posts in this topic

Hi,

I've created a script some time ago which worked well, however the software has recently changed and I'm a little stuck. The orginal script looks like this

sleep (1000)
Run ("C:\WINDOWS\system32\mspaint.exe")
WinWait("Untitled - Paint")
if not WinActive ("Untitled - Paint") then WinActivate ("Untitled - Paint")
WinWaitActive ("Untitled - Paint")
Send("{CTRLDOWN}v{CTRLUP}")
Sleep (2000)
Send("{CTRLDOWN}s{CTRLUP}")
WinWait("Save As")
if not WinActive ("Save As") then WinActivate ("Save As")
WinWaitActive("Save As")
Sleep (2000)
Send ("Performance Test 1")
Sleep(2000)
Send ("!s")
Sleep(2000)
Send("!{F4}")
WinWait ("Performance Test 1.png - Paint")
WinActivate ("Performance Test 1.png - Paint")
Sleep(2000)
Send("!{F4}")
Sleep(2000)
Send("!{F4}")
Sleep (5000)

If for example the .jpg exists I want to overwrite it. I thought this would work but it the script doesnt finish...

Send ("{PRINTSCREEN}")
sleep (1000)
Run ("C:\WINDOWS\system32\mspaint.exe")
WinWait("Untitled - Paint")
if not WinActive ("Untitled - Paint") then WinActivate ("Untitled - Paint")
WinWaitActive ("Untitled - Paint")
Send("{CTRLDOWN}v{CTRLUP}")
Sleep (2000)
Send("{CTRLDOWN}s{CTRLUP}")
WinWait("Save As")
if not WinActive ("Save As") then WinActivate ("Save As")
WinWaitActive("Save As")
Sleep (2000)
Send ("Performance Test 1")
Sleep(2000)
Send ("!s")
While 1
if WinExists ("Confirm Save As","Yes") Then
Sleep (2000)
Send ("!Y")
EndIf
WEnd
WinWait ("Performance Test 1.png - Paint")
WinActivate ("Performance Test 1.png - Paint")
Sleep(2000)
Send("!{F4}")
Sleep(2000)
Send("!{F4}")
Sleep (5000)

Can anyone point me in the right direction? TBH I'm not totally sure how While and Wend works even after reading the help file or why there is a 1 after the While.

I added this earlier due to software change and this worked..

WinWait("Run all benchmark tests?")
if not WinActive ("Run all benchmark tests?") then WinActivate ("Run all benchmark tests?")
WinWaitActive("Run all benchmark tests?")
Send ("{ENTER}")
while 1
if WinExists ("WARNING","Cancel") then
ControlClick("WARNING","Cancel","[CLASS:Button; INSTANCE:2]") 
EndIf
WEnd
WinWait ("PassMark Rating (PerformanceTest 7.0)","The PassMark Rating for this computer is")
if not WinActive ("PassMark Rating (PerformanceTest 7.0)","The PassMark Rating for this computer is") Then WinActivate ("PassMark Rating (PerformanceTest 7.0)","The PassMark Rating for this computer is")
WinWaitActive("PassMark Rating (PerformanceTest 7.0)","The PassMark Rating for this computer is")
sleep (1000)
Send ("{PRINTSCREEN}")

Any ideas would be useful.

Thanks

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