artur1poland Posted November 14, 2008 Share Posted November 14, 2008 Hello everyone ! I`m a new guy here and before I decided to add this post I`d read FAQ thouroghly. (My mother tongue is not English so sry for any mistakes in advance). So the problem is that my script should recognize whether certain window is active or not, if it is active or not then it should run proper function. At the beginning I`ve declared functions and the root cause is presumably at the bottom of the code and marked with '<-------------' The code: expandcollapse popup$a=0 Func A () If Not WinActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") Then WinActivate("AR System User - [L-Change (Modify)]","L-Change (Modify)") WinWaitActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") sleep(3000) MouseMove(1022,204) MouseDown("left") MouseUp("left") MouseMove(386,143) MouseDown("left") MouseUp("left") $a=$a+1 return $a EndFunc Func B () If Not WinActive("AR System User - Error","OK") Then WinActivate("AR System User - Error","OK") WinWaitActive("AR System User - Error","OK") MouseMove(307,25) MouseDown("left") MouseUp("left") sleep(3000) MouseMove(352,124) MouseDown("left") MouseUp("left") WinWait("AR System User - [L-Change (Modify)]","L-Change (Modify)") If Not WinActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") Then WinActivate("AR System User - [L-Change (Modify)]","L-Change (Modify)") WinWaitActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") MouseMove(1022,204) MouseDown("left") MouseUp("left") MouseMove(386,143) MouseDown("left") MouseUp("left") WinWait("Confirm Save Request ","Do you want to save ") If Not WinActive("Confirm Save Request ","Do you want to save ") Then WinActivate("Confirm Save Request ","Do you want to save ") WinWaitActive("Confirm Save Request ","Do you want to save ") MouseMove(123,16) MouseDown("left") MouseMove(122,14) MouseUp("left") MouseMove(125,103) MouseDown("left") MouseUp("left") sleep(3000) $a=$a+1 return $a EndFunc do Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("AR System User - [L-Change (Modify)]","L-Change (Modify)") If Not WinActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") Then WinActivate("AR System User - [L-Change (Modify)]","L-Change (Modify)") WinWaitActive("AR System User - [L-Change (Modify)]","L-Change (Modify)") MouseMove(216,298) MouseDown("left") MouseMove(217,298) MouseUp("left") MouseMove(204,384) MouseDown("left") MouseUp("left") MouseMove(166,403) MouseDown("left") MouseUp("left") Send("{SHIFTDOWN}c{SHIFTUP}ompleted") MouseMove(212,706) MouseDown("left") MouseUp("left") MouseMove(272,714) MouseDown("left") MouseUp("left") Send("{ENTER}") MouseMove(382,718) MouseDown("left") MouseMove(383,718) MouseUp("left") MouseMove(424,718) MouseDown("left") MouseUp("left") Send("{ENTER}") MouseMove(892,624) MouseDown("left") MouseUp("left") MouseMove(987,268);'Save' MouseDown("left") MouseUp("left") sleep(4000) If WinWait("AR System User - [L-Change (Modify)]","L-Change (Modify)") Then A(); <------------------ If WinWait("AR System User - Error","OK") Then B(); <------------------ until $a=4 So the thing is that sometimes ("AR System User - Error","OK") is not displayed and then my script stops. Many thanks in advance ! Link to comment Share on other sites More sharing options...
Chapi Posted November 14, 2008 Share Posted November 14, 2008 Quit the ";" and try again... Link to comment Share on other sites More sharing options...
artur1poland Posted November 14, 2008 Author Share Posted November 14, 2008 It still doesn`t work... Link to comment Share on other sites More sharing options...
Aceguy Posted November 14, 2008 Share Posted November 14, 2008 (edited) try changing If Not WinActive("AR Syst......... to If WinActive("AR Syst........")=0 then in ALL Winactive statements Edited November 14, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Chapi Posted November 14, 2008 Share Posted November 14, 2008 (edited) Sorry i see the ";" and asume that was the error. If the windows is not displaying then your script is runing but waiting for it, i asume... Try to set a timeout to the WinWait... $returnValue = WinWait("AR System User - Error","OK", 10) If $returnValue = 1 Then B() wait 10 seconds for the windows an then continue whit the script... Edited November 14, 2008 by Chapi Link to comment Share on other sites More sharing options...
jvanegmond Posted November 14, 2008 Share Posted November 14, 2008 try changing If Not WinActive("AR Syst......... to If WinActive("AR Syst........")=0 then github.com/jvanegmond Link to comment Share on other sites More sharing options...
Aceguy Posted November 14, 2008 Share Posted November 14, 2008 (edited) i think the problem is If WinWait("AR System User - [L-Change (Modify)]","L-Change (Modify)") Then A(); <------------------ If WinWait("AR System User - Error","OK") Then B(); <------------------ your using it in the wrong context... taken from helpfile... Pauses execution of the script until the requested window exists. If WinWait("AR System User - [L-Change (Modify)]","L-Change (Modify)") =1 then A() Edited November 14, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
artur1poland Posted November 14, 2008 Author Share Posted November 14, 2008 Thanks a lot guys for all of yours replies (especially for Chapi and Aceguy), I`ve just replaced If WinWait("AR System User - Error","OK") Then B(); with : $returnValue = WinWait("AR System User - Error","OK", 10) If $returnValue = 1 Then B() and it`s working correctly. Link to comment Share on other sites More sharing options...
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