Followers 0

# 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 on other sites

You're going to have to parse the HTML file. It will take some creative efforts.

JS

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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

Automate input type=file (Related)

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

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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

Automate input type=file (Related)

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

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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

Automate input type=file (Related)

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