cassetti Posted May 9, 2006 Share Posted May 9, 2006 Hey all, just wondering how to do thisi'm working on a script to automatically upload this file to a site for work so i don't have to do the same boring thing over and over againAfter i upload, the page that loads up, is pretty much the same page as the original page for uploading, except there is a part that states what the status of the upload wasin the source code it looks like this:<div class="errorMessages"> <div class="message error">The file "" is not valid.</div></div>obviously whatever is in the place of "The file "" is not valid." is what i want to pull out.i want to store that to a variable to so ican use_filewritelog to write it to the log file i created.Any suggestions or ideas on how to do that easily? Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 9, 2006 Share Posted May 9, 2006 You're going to have to parse the HTML file. It will take some creative efforts. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted May 9, 2006 Share Posted May 9, 2006 (edited) Untested, but IE.au3 makes short work of this... #include <IE.au3> $oIE = _IEAttach("your title here") $oDivs = _IETagNameGetCollection($oIE, "div") For $oDiv in $oDivs If $oDiv.className = "message error" Then $sMyMessage = $oDiv.innerText ExitLoop EndIf Next Dale Edit: $oDic -> $oDiv (thanks bd), Also looks like the property name is .className instead of .class Edited May 9, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 9, 2006 Moderators Share Posted May 9, 2006 Untested, but IE.au3 makes short work of this... #include <IE.au3> $oIE = _IEAttach("your title here") $oDivs = _IETagNameGetCollection($oIE, "div") For $oDiv in $oDivs If $oDic.class = "message error" Then $sMyMessage = $oDiv.innerText ExitLoop EndIf Next DaleI think an "$oDiv" may work better than an "$oDic" Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 9, 2006 Share Posted May 9, 2006 @DaleHolm Wow you have done alot of work on the IE.au3 file. I didnt realize it had this functionality. Excellent! JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted May 10, 2006 Share Posted May 10, 2006 @DaleHolmWow you have done alot of work on the IE.au3 file. I didnt realize it had this functionality.Excellent!JSThanks JS -- nothing new there however... that functionality has been in IE.au3 V1 for 9 months Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 10, 2006 Share Posted May 10, 2006 Thanks JS -- nothing new there however... that functionality has been in IE.au3 V1 for 9 months DaleWell.. I only really paid any attention to it when it first came out as I dont use IE, and didnt see a need for it, but you have some very very nice features in there!!Love it,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
cassetti Posted May 10, 2006 Author Share Posted May 10, 2006 WOW! Awesome guys!!! thanks!! I'm going to test it out now.... Error in the code, i understand what you are doing - but its saying there is an error in the ie.au3 file C:\Program Files\AutoIt3\beta\Include\ie.au3 (1190) : ==> The requested action with this object has failed.: Return $o_object.GetElementsByTagName ($s_TagName) Return $o_object.GetElementsByTagName ($s_TagName)^ ERROR I think it may be because of the extremely old version of ie.au3 i'm using? - back from 7/24/05 Link to comment Share on other sites More sharing options...
DaleHohm Posted May 10, 2006 Share Posted May 10, 2006 (edited) WOW! Awesome guys!!! thanks!! I'm going to test it out now.... Error in the code, i understand what you are doing - but its saying there is an error in the ie.au3 file C:\Program Files\AutoIt3\beta\Include\ie.au3 (1190) : ==> The requested action with this object has failed.: Return $o_object.GetElementsByTagName ($s_TagName) Return $o_object.GetElementsByTagName ($s_TagName)^ ERROR I think it may be because of the extremely old version of ie.au3 i'm using? - back from 7/24/05I didn't test with IE.au3 version 1, but I don't expect it to be different -- no significant changes to _IETagNameGetCollection() This works for me: #include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "www.autoitscript.com") $oDivs = _IETagNameGetCollection($oIE, "div") For $oDiv in $oDivs If $oDiv.className = "NLHSTitle" Then $sMyMessage = $oDiv.innerText ExitLoop EndIf Next ConsoleWrite($sMyMessage & @CR) Dale Edit: left out $oIE in navigate Edited May 10, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble 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