dreadx Posted October 30, 2009 Posted October 30, 2009 What I need help with is creating an "if" statement that changes the behavior of the program if a box pops up on the screen. I need to program to stop and start over if the box pops up or continue if it does not. The box I am referring to is pictured in the attached file. I have also included my very simple code. Thank you in advance for any help. expandcollapse popupHotKeySet("x", "MyExit") For $i = 0 to 214 WinActivate("[CLASS:XLMAIN]", "") ;Activates Excel Sleep(100) Send("^c") ;copy SID Sleep(100) Send("{Down}") WinActivate("[CLASS:ThunderRT6FormDC]", "") ;Activates Citrix Window Sleep(300) ControlClick("Application Access Administration - UAT", "", "[ID:3]") Sleep(200) Send("{TAB 6}") Sleep(200) Send("{Down 2}") Sleep(200) Send("{TAB 6}") Sleep(100) Send("^v") ;paste SID Send("{TAB 6}") Sleep(100) Send("{Enter}") Sleep(500) Send("{Enter}") Sleep(500) Send("{TAB 8}") Sleep(100) Send("{Enter}") Sleep(200) Send("{Enter}" ) ;Clears error if there is one Sleep(100) Send("{TAB 8}") ;moves to cost center Sleep(100) Send("{up}") Sleep(300) Send("{down}") Sleep(100) Send("{TAB 1}") ; moves to user status Sleep(100) Send("{Down}") ;Changes to Inactive Sleep(100) Send("{TAB 5}") ;Moves to Save Sleep(100) Send("{Enter}") Sleep(100) Send("{Enter}") Sleep(100) Send("{TAB 17}") ; Move to close Sleep(500) Send("{Enter}") ;Back to main search screen Sleep(500) Send("{TAB}") Sleep(100) Next Func MyExit() Exit EndFunc
Bert Posted October 30, 2009 Posted October 30, 2009 what point is the box going to show up if it does? you could do a if>then statement there. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Baraoic Posted October 30, 2009 Posted October 30, 2009 (edited) Personally I wouldn't make the script use all those tabs and you should see if you can ControlSend your text to the field that you want to put the SID in. You could also use the excel UDF to open the document and copy the cells to a variable then ControlSend it to where you need it. As far as your if then statement it looks like your error comes up once you press search after you pasted the SID well if it always looks like that then you could do something like this Send("{TAB 6}") Sleep(100) Send("^v") ;paste SID Send("{TAB 6}") Sleep(100) Send("{Enter}") If WinExists("User Maintenance") Then WinClose("User Maintenance") ; or could do a Send("^{F4}") or Send("{ENTER}") EndIf Edited October 30, 2009 by Onichan
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