HighlanderSword Posted November 3, 2010 Share Posted November 3, 2010 (edited) Hello, I have an application called Maximo that uses Pushbuttons, the problem is that these buttons get assigned an new ID each time the application is used. I'm trying to identify how I can get the ID of the control once the form loads. Below is the code I've been trying to get to work. #include <IE.au3> ;Window name of the IE session to attach to $oIE = _IEAttach("View Shopping") ;Button text to search for --- THIS DOES NOT work, I have tried the tags of textbox,button,Text pb $xxme=mxid("Delete Cart","input") msgbox(0,"MX ID Value",$xxme &@crlf) ;This does work as I know the ID by using Debugbar to look it up $c_click = "mx782" $changes = _IEGetObjById($oIE, $c_click) $hwnd = _IEPropertyGet($oIE, "hwnd") ;This shows that it can find the text of the Button, it returns - Delete Cart ConsoleWrite(_IEPropertyGet($changes, "innertext") & @CRLF) ;This Displays - <BUTTON class="text pb" id=mx782 style="WIDTH: 80px" control="true" ctype="pushbutton" clicked="false">Delete Cart</BUTTON> ConsoleWrite(_IEPropertyGet($changes, "outerhtml") & @CRLF) _IEAction($changes, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") Func MXID($x,$TAG ) $oInputs = _IETagNameGetCollection ($oIE, $TAG) $gotit ="No Match" For $oInput In $oInputs if StringInStr($oInput.title ,$x) > 0 Then $gotit = $oInput.id EndIf Next return ($gotit) EndFunc Any ideas what I'm missing ? Edited November 3, 2010 by HighlanderSword Link to comment Share on other sites More sharing options...
bo8ster Posted November 4, 2010 Share Posted November 4, 2010 I can only suggest you print out "ConsoleWrite" $Tag and $x so you know waht is going on. Step through the program so can see where it is failing. Also to get more help use code tags and tidy. #include <IE.au3> ;Window name of the IE session to attach to $oIE = _IEAttach("View Shopping") ;Button text to search for --- THIS DOES NOT work, I have tried the tags of textbox,button,Text pb $xxme = mxid("Delete Cart", "input") MsgBox(0, "MX ID Value", $xxme & @CRLF) ;This does work as I know the ID by using Debugbar to look it up $c_click = "mx782" $changes = _IEGetObjById($oIE, $c_click) $hwnd = _IEPropertyGet($oIE, "hwnd") ;This shows that it can find the text of the Button, it returns - Delete Cart ConsoleWrite(_IEPropertyGet($changes, "innertext") & @CRLF) ;This Displays - <BUTTON class="text pb" id=mx782 style="WIDTH: 80px" control="true" ctype="pushbutton" clicked="false">Delete Cart</BUTTON> ConsoleWrite(_IEPropertyGet($changes, "outerhtml") & @CRLF) _IEAction($changes, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") Func MXID($x, $TAG) $oInputs = _IETagNameGetCollection($oIE, $TAG) $gotit = "No Match" For $oInput In $oInputs If StringInStr($oInput.title, $x) > 0 Then $gotit = $oInput.id EndIf Next return ($gotit) EndFunc ;==>MXID Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
HighlanderSword Posted November 4, 2010 Author Share Posted November 4, 2010 Hello, The part of the code that searches for the iD (MXId Function) works fine when using other Tags for other items on the page, its only when trying to use the funtion with location the ID for the Pushbuttons that I'm having issues and getting no match for the Text of the button. Any other Ideas ? Thanks Paul 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