Sign in to follow this  
Followers 0
Guest Guest_lonereaper

do until

5 posts in this topic

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}")

EndIf

If 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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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") Then

Send("^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}")

EndIf

Do

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}")

EndIf

If 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

Share this post


Link to post
Share on other sites

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


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

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.

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