Sign in to follow this  
Followers 0
JayFran

Variables question

6 posts in this topic

#1 ·  Posted (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 by JayFran

Share this post


Link to post
Share on other sites



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


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#3 ·  Posted (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.

; =================================================================================================
;                                           #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 by JayFran

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JayFran

Share this post


Link to post
Share on other sites

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

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