Sign in to follow this  
Followers 0
cassetti

Getting Text From Table On Website

9 posts in this topic

Hey all, just wondering how to do this

i'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 again

After 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 was

in 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?

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Dale

I think an "$oDiv" may work better than an "$oDic" :)

Share this post


Link to post
Share on other sites

@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)

Share this post


Link to post
Share on other sites

@DaleHolm

Wow you have done alot of work on the IE.au3 file. I didnt realize it had this functionality.

Excellent!

JS

Thanks 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

Share this post


Link to post
Share on other sites

Thanks JS -- nothing new there however... that functionality has been in IE.au3 V1 for 9 months :)

Dale

Well.. 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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#9 ·  Posted (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/05

I 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 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

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