Guest Guest_lonereaper Posted June 13, 2004 Share Posted June 13, 2004 i have 2 if statements and one of them needs to be executed. first questionis should i use the do...until and if so how would i do it so that it will repeat until one of the if statements is executed.If WinActive("Packing Slip", "Done") Then$title = WinGetTitle ( "Packing Slip")Send("^p")WinWaitActive("Print", "General")Send("!p")WinWaitActive($title)Send("!{TAB}")WinWaitActive("FileMaker")Send("{ENTER}")EndIfIf WinActive("http://sellers.alibris.com/ops/displaypurchaseorder.cfm?Order_Nbr=", "Done") Then$title = WinGetTitle ( "http://sellers.alibris.com/ops/displaypurchaseorder.cfm?Order_Nbr=")Send("^p")WinWaitActive("Print", "General")Send("!p")WinWaitActive($title)Send("!{TAB}")WinWaitActive("FileMaker")Send("{ENTER}")EndIf Link to comment Share on other sites More sharing options...
pekster Posted June 13, 2004 Share Posted June 13, 2004 i have 2 if statements and one of them needs to be executed. first questionis should i use the do...until and if so how would i do it so that it will repeat until one of the if statements is executed.If you want the program to just sleep until either one of the statements is true, and then run the proper conditional statement, try something like this: Do Sleep(100) Until <CONDITION1> OR <CONDITION2> ;at this point in your code, either CONDITION1, or CONDITION2 is true If <CONDITION1> Then ;do stuff EndIf If <CONDITION2> Then ;do other stuff EndIf [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
Guest Guest_lonereaper Posted June 13, 2004 Share Posted June 13, 2004 Below is my script.If I log onto the web page before i run this script it works fine. but if i do not log in and the script actually enters the login and password for me (which is the bold section) then the script just stays at the Do...Until OR statement. the degub shows Sleep (100)AutoItSetOption("TrayIconDebug", 1)$ordernumber = ClipGet()WinWaitNotActive ( "FileMaker")Sleep(2000)If WinActive ("Alibris Sellers -- Welcome! - Microsoft Internet Explorer", "Done") ThenSend("^f")WinWaitActive("Find")Send ("Seller I.D.:")Send("{ENTER}")Send("{ESC}")Sleep(500)Send("{TAB}")Send("BWORMANX")Send("{TAB}")Sleep(500)Send("PASSWORD***")Send("{ENTER}")EndIfDo Sleep(100)Until WinActive("Packing Slip", "Done") OR WinActive("http://sellers.alibris.com/ops/displaypurchaseorder.cfm?Order_Nbr=" & $ordernumber, "Done")If WinActive("Packing Slip", "Done") Then$title = WinGetTitle ( "Packing Slip")Send("^p")WinWaitActive("Print", "General")Send("!p")WinWaitActive($title)Send("!{TAB}")WinWaitActive("FileMaker")Send("{ENTER}")EndIfIf WinActive("http://sellers.alibris.com/ops/displaypurchaseorder.cfm?Order_Nbr=" & $ordernumber, "Done") Then$title = WinGetTitle ( "http://sellers.alibris.com/ops/displaypurchaseorder.cfm?Order_Nbr=")Send("^p")WinWaitActive("Print", "General")Send("!p")WinWaitActive($title)Send("!{TAB}")WinWaitActive("FileMaker")Send("{ENTER}")EndIf Link to comment Share on other sites More sharing options...
tutor2000 Posted June 13, 2004 Share Posted June 13, 2004 Other people have written stuff that include checking on mouse type for load completion of a web page. Larry wrote this I just edited it Rick func pageloaded($a) MouseMove(0,0) $bSure = 0 While $bSure < 5 $ret=StatusBarGetText($a) == "Done" If StatusBarGetText($a) == "Done" or StatusBarGetText($a) =="" then $bSure = $bSure + 1 Else $bSure = 0 EndIf Sleep(150) Wend ;MsgBox(4096, "AutoIt", $ret) ;Return $a EndFunc Link to comment Share on other sites More sharing options...
pekster Posted June 13, 2004 Share Posted June 13, 2004 Below is my script. If I log onto the web page before i run this script it works fine. but if i do not log in and the script actually enters the login and password for me (which is the bold section) then the script just stays at the Do...Until OR statement. the degub shows Sleep (100)Do you not want it to run your Do loop if it logs you in? The only reason it would stay inside the loop is if both conditions are not met, and that means neigher window was becomming active. If you don't want to run the Do loop, use this method: If WinActive ("Alibris Sellers -- Welcome! - Microsoft Internet Explorer", "Done") Then ;do your your "bold" stuff here Else ;do your Do-Until stuff here EndIf That will only run the Do-Until if your login stuff was not done. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. 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