sdfg4545 Posted March 3, 2010 Share Posted March 3, 2010 I am using this function: _IEGetObjByName Using a MsgBox, I try to evaluate the return code. The message box contains no message (there is no return value?). What is returned on success and on failure? The documentation says an object returned on success and 0 on failure. MsgBox seems to have neither. My Code: trying to get a 'Export To Excel' button by name *************** ;button: <input type="submit" name="TriageResult1:btExport" value="Export to Excel" id="TriageResult1_btExport" /> $oIE = _IEAttach ($hWnd, "embedded") $oSubmit = _IEGetObjByName($oIE, "TriageResult1:btExport") MsgBox($oSubmit) ;dislays empty msg box if ($oSubmit = 0) Then HandleError("_IEGetObjByName- EXPORT TO EXCEL...", @error, $iTryLoop) EndIf Link to comment Share on other sites More sharing options...
JohnOne Posted March 3, 2010 Share Posted March 3, 2010 MsgBox($oSubmit) does that even work ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Beege Posted March 3, 2010 Share Posted March 3, 2010 It returns an object. A msgbox is used to display a string, which is why nothing is being displayed. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
sdfg4545 Posted March 3, 2010 Author Share Posted March 3, 2010 I have used successfully it in some situations. Seems like it doesnt work with _IEGetObjByName???? Am I using it incorrectly? Is there a better way to evaluate the return val of the function? Link to comment Share on other sites More sharing options...
sdfg4545 Posted March 3, 2010 Author Share Posted March 3, 2010 Is there an autoIt function that converts the object into a string? Link to comment Share on other sites More sharing options...
sdfg4545 Posted March 3, 2010 Author Share Posted March 3, 2010 I will try to use "ObjName". Other Options? Returns the name or interface description of an Object ObjName ( $Objectvariable [,Flag] ) Return Value Success: Returns a string representing the name Failure: Sets @error and Returns "" Link to comment Share on other sites More sharing options...
Beege Posted March 3, 2010 Share Posted March 3, 2010 Yes. In your case you could use something like this to verify. $oSubmit = _IEGetObjByName($oIE, "TriageResult1:btExport") If $oSubmit = 0 then Msgbox(0,'','Error geting object') Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 3, 2010 Share Posted March 3, 2010 I have used successfully it in some situations.I would dearly love to see an example of just one of those situations... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JohnOne Posted March 3, 2010 Share Posted March 3, 2010 Indeed. I could concieve it working something like MsgBox(0,"",$oSubmit) but MsgBox($oSubmit) I just cannot see that. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
sdfg4545 Posted March 3, 2010 Author Share Posted March 3, 2010 - sorry, didnt mean "MsgBox($oSubmit)", meant MsgBox(0,"",$oSubmit) - seems like IEGetObjByName returns 0 if fails, returns "DispHTMLInputElement" if success (getting button) and returns nothing if page hasnt loaded or something has gone wrong Have been playing with it, this is what I will do now: $oIE = _IEAttach ($hWnd, "embedded") $oSubmit = _IEGetObjByName($oIE, "TriageResult1:btExport") if (StringCompare(ObjName($oSubmit), "DispHTMLInputElement") <> 0) Then HandleError("_IEGetObjByName- EXPORT TO EXCEL...", @error, $iTryLoop) SendMail("autoit script fail: imedic download", $sAllErrorMsgs) Exit EndIf Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 3, 2010 Share Posted March 3, 2010 A little over done, since _IEGetObjByName() sets @error (see help file): $oSubmit = _IEGetObjByName($oIE, "TriageResult1:btExport") If @error Then ; Handle error EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 3, 2010 Share Posted March 3, 2010 I could concieve it working something likeMsgBox(0,"",$oSubmit)I'd still like to see a working example of that! I don't think AutoIt has any method built in to cast any object as a string. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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