st4vr0s Posted January 7, 2010 Posted January 7, 2010 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
AdmiralAlkex Posted January 7, 2010 Posted January 7, 2010 1= True, so While True means you have an infinite loop You need to add a ExitLoop to exit it, or you could change to WinWait(). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now