JayFran 0 Posted September 1, 2010 (edited) Ok, so I've been working on a little something for myself for 2weeks or so. I've been using a managers account to base my code off of and I discovered once I got my account that some of the id's are different in IE. And that only part of the code works and then it just fails and says error on line such and such. I was trying to come up with an IF statement but that was an epic fail. If someone can guide me in the right direction, I would gladly appreciate the help. Here is the code Im working on at the moment $try00 = _IEPropertyGet($oIE, "innerhtml") For $0try In $try00 If $list0 = "mx398" Then $0try = $t_inputid ;_IEAction($t_submit, "focus") ;Difference If $list1 = "mx404" Then $0try = $t_inputid $t_submit = _IEGetObjById($oIE, $t_inputid) Next _IEAction($t_submit1, "focus") Edited September 1, 2010 by JayFran Share this post Link to post Share on other sites
kaotkbliss 146 Posted September 1, 2010 Oi. You have no endif for your if statements... $0try is not defined $list0 is not defined It seems this is only a small part of the code and I really can't tell what exactly it is you are trying to do 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
JayFran 0 Posted September 1, 2010 (edited) Oi. You have no endif for your if statements... $0try is not defined $list0 is not defined It seems this is only a small part of the code and I really can't tell what exactly it is you are trying to do Thanks. I forgot about that. Here is the whole section of that code and the section afterwards. basically once IE page is loaded it finds the input element by its id (in which case can be either or) then it sends a ticket number; after that it pulls up the ticket info and goes from there. My code is done however once I ran it on my account i discovered some bugs and slight differences. expandcollapse popup; ================================================================================================= ; #ISM Home Page# ; ================================================================================================= ;Navigate to the ticket input $pause = _IELoadWait($oIE) WinWait("Start Center - Windows Internet Explorer") sleep(2000) $c_click = "mx46" $changes = _IEGetObjById($oIE, $c_click) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($changes, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") Sleep(1000) $c_click2 = "menu0_CHANGE_MODULE_middle_anchor" $changes2 = _IEGetObjById($oIE, $c_click2) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($changes2, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") sleep(1000) $c_click3 = "menu7_CHANGE_APP_middle_anchor" $changes3 = _IEGetObjById($oIE, $c_click3) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($changes3, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") sleep(1000) Do $done = _IEPropertyGet($oIE, "statusbar") If $done <> "Done" Then Sleep(3000) Until $done = "Done" ; ================================================================================================= ; #ISM Ticket Field Fill & Lookup# ; ================================================================================================= ;Insert Ticket info WinWait("Changes - Windows Internet Explorer") Sleep(2000) $try00 = _IEPropertyGet($oIE, "innerhtml") <----Heres The snippet of code -----> For $0try In $try00 If $list0 = "mx398" Then $0try = $t_inputid ;_IEAction($t_submit, "focus") ;Difference If $list1 = "mx404" Then $0try = $t_inputid Next $t_submit = _IEGetObjById($oIE, $t_inputid) _IEAction($t_submit1, "focus") #cs $t_inputid1 = "Change filter" $t_input1 = _IETagNameGetCollection($oIE, "input") For $t_input0 in $t_input1 $t_LinkText = _IEPropertyGet($t_input0 , "innertext") If StringInStr($t_LinkText, $t_inputid) Then _IEAction($t_input0 , "focus") ExitLoop EndIf Next #ce Send($t_number) Send("{Enter}") Sleep(4000) $t_submit = "mx534[R:0]" $ts = _IEGetObjById($oIE, $t_submit) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($ts, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ;Difference $t_submit1 = "mx528[R:0]" $ts1 = _IEGetObjById($oIE, $t_submit1) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($ts1, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ; ================================================================================================= ; #Ticket Upload# ; ================================================================================================= Edited September 1, 2010 by JayFran Share this post Link to post Share on other sites
JayFran 0 Posted September 1, 2010 (edited) Heres my code with no errors: $sHTML = _IEBodyReadHTML ($oIE) $try00 = _IETagNameGetCollection($sHTML, "input") $t0 = "mx398" $t1 = "mx404" For $0try In $try00 $list97 = _IEPropertyGet($sHTML, "innerhtml") If $list97 = $t0 Then $0try = $t0 If $list97 = $t1 Then $0try = $t1 Next $t_submit = _IEGetObjById($oIE, $0try) _IEAction($t_submit, "focus" If I run the code there is no error on compile however on execution I get variable must be an object. Any ideas? Edited September 1, 2010 by JayFran Share this post Link to post Share on other sites
JayFran 0 Posted September 1, 2010 Actually, I just figured it out. After 2days I got it. here is the final version of my code. it works on both accounts so thats great! Thanks for the feed back kaotkbliss. $sHTML = _IEBodyReadHTML ($oIE) $try00 = _IETagNameGetCollection($oIE, "input") $t0 = "mx398" $t1 = "mx404" For $0try In $try00 Global $list97 = _IEPropertyGet($oIE, "innerhtml") If $list97 = $t0 Then $0try = $t0 If $list97 = $t1 Then $0try = $t1 Next $t_submit = _IEGetObjById($oIE, $0try) _IEAction($t_submit, "focus") Share this post Link to post Share on other sites
kaotkbliss 146 Posted September 1, 2010 I didn't really do anything, you got it all by yourself 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites