Sign in to follow this  
Followers 0
ConsultingJoe

Ie Udf Help For Ai Test Taker

13 posts in this topic

Hey guys, love the udf but I have a quick question

how can I grab the data from the tables(question) and chose an answer for this site:

http://zerocool60544.t35.com/files/test.html

I wnat to make an AI test taker that learns what answers were wrong and retakes the test until it is a perfect score

Some of the functions don't give enough info

Thanks a lot


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hopefully this will get you started:

#include <IE.au3>
$oIE = _IECreate ()
_IENavigate ($oIE, "http://zerocool60544.t35.com/files/test.html")
                                                
; Get a reference to the sixth table on the webpage (where question 1 is stored)
$oTable = _IETableGetObjByIndex ($oIE, 7)
                
; Read the table cells into a 2-D array
$aProfile = _IETableWriteToArray ($oTable)
                
_IEQuit ($oIE)
                
; Write the array contents to the console
For $i = 0 to Ubound($aProfile, 2) - 1
    ConsoleWrite("Array Dim (1): " & $aProfile[0][$i] & " Array Dim (2): " & $aProfile[1][$i] & @CR)
Next

From what I can tell each question is in a different table. So question 1 is in the sixth table, but question 2 is in the eighth table and so on...

Edited by big_daddy

Share this post


Link to post
Share on other sites

yeah it did, thanks


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

One Thing, The html is in a frame. there are 3 total. the test frames title:

Take Assessment: Midterm Exam

I tried:

#include <IE.au3>
AutoItSetOption( "WinTextMatchMode", 2)
TrayTip("", "select the browser to search in", 3)
while 1
    $title = WinGetTitle ( "" )
    if StringInStr( $title, " - Microsoft Internet Explorer") Then ExitLoop
    WEnd
$title = StringReplace($title, " - Microsoft Internet Explorer", "")
$oIE = _IEAttach ($title)
_IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")

;$oIE = _IECreate ()
;_IENavigate ($oIE, "C:\Documents and Settings\war_driver\Desktop\test.htm")
                                                
for $r = 7 to 172
$oTable = _IETableGetObjByIndex ($oIE, $r)
                
; Read the table cells into a 2-D array
$aProfile = _IETableWriteToArray ($oTable)
                

                
; Write the array contents to the console
For $i = 1 to Ubound($aProfile, 2) - 2
    MsgBox(0,"","Question: " & $aProfile[1][$i] & @CR)
Next
next
;_IEQuit ($oIE)

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

the following line does nothing:

_IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")

I presume what you really want is:

$oFrame = _IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")

followed by:

$oTable = _IETableGetObjByIndex ($oFrame, $r)

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

the following line does nothing:

_IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")

I presume what you really want is:

$oFrame = _IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")

followed by:

$oTable = _IETableGetObjByIndex ($oFrame, $r)

Dale

I tried that but I get an error from the _IEFrameGetObjByName saying object failed.

could it be the wrong name, I even tried_IEFrameGetObjByName($oIE, "")

this is my code:

#include <IE.au3>
AutoItSetOption( "WinTextMatchMode", 2)
TrayTip("", "select the browser to search in", 3)
while 1
    $title = WinGetTitle ( "" )
    if StringInStr( $title, " - Microsoft Internet Explorer") Then ExitLoop
    WEnd
$title = StringReplace($title, " - Microsoft Internet Explorer", "")
$oIE = _IEAttach ($title)


;$oIE = _IECreate ()
;_IENavigate ($oIE, "C:\Documents and Settings\war_driver\Desktop\test.htm")
                                                
for $r = 7 to 172
;$oTable = _IETableGetObjByIndex ($oIE, $r)
$oFrame = _IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")
$oTable = _IETableGetObjByIndex ($oFrame, $r)               
; Read the table cells into a 2-D array
$aProfile = _IETableWriteToArray ($oTable)
                

                
; Write the array contents to the console
For $i = 1 to Ubound($aProfile, 2) - 2
    MsgBox(0,"","Question: " & $aProfile[1][$i] & @CR)
Next
next
;_IEQuit ($oIE)

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

I tried that but I get an error from the _IEFrameGetObjByName saying object failed.

could it be the wrong name, I even tried_IEFrameGetObjByName($oIE, "")

this is my code:

#include <IE.au3>
AutoItSetOption( "WinTextMatchMode", 2)
TrayTip("", "select the browser to search in", 3)
while 1
    $title = WinGetTitle ( "" )
    if StringInStr( $title, " - Microsoft Internet Explorer") Then ExitLoop
    WEnd
$title = StringReplace($title, " - Microsoft Internet Explorer", "")
$oIE = _IEAttach ($title)
;$oIE = _IECreate ()
;_IENavigate ($oIE, "C:\Documents and Settings\war_driver\Desktop\test.htm")
                                                
for $r = 7 to 172
;$oTable = _IETableGetObjByIndex ($oIE, $r)
$oFrame = _IEFrameGetObjByName($oIE, "Take Assessment: Midterm Exam")
$oTable = _IETableGetObjByIndex ($oFrame, $r)               
; Read the table cells into a 2-D array
$aProfile = _IETableWriteToArray ($oTable)
                

                
; Write the array contents to the console
For $i = 1 to Ubound($aProfile, 2) - 2
    MsgBox(0,"","Question: " & $aProfile[1][$i] & @CR)
Next
next
;_IEQuit ($oIE)
Yes, that is an unlikely Frame name... it looks more like a Title.

Take a look at the source for "<frame name=" or <frame id="

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

#8 ·  Posted (edited)

Yes, that is an unlikely Frame name... it looks more like a Title.

Take a look at the source for "<frame name=" or <frame id="

Dale

ok yeah I got it, I changed it to:

#include <IE.au3>
AutoItSetOption( "WinTextMatchMode", 2)
TrayTip("", "select the browser to search in", 3)
While 1
    $title = WinGetTitle("")
    If StringInStr($title, " - Microsoft Internet Explorer") Then ExitLoop
WEnd
$title = StringReplace($title, " - Microsoft Internet Explorer", "")
$oIE = _IEAttach ($title)
;$oIE = _IECreate ()
;_IENavigate ($oIE, "C:\Documents and Settings\war_driver\Desktop\test.htm")
For $r = 7 To 172
;MsgBox(0,"",_IEFrameGetNameByIndex($oIE, 1))
    $oFrame = _IEFrameGetObjByName ($oIE, _IEFrameGetNameByIndex ($oIE, 1))
    $oTable = _IETableGetObjByIndex ($oFrame, $r)
; Read the table cells into a 2-D array
    $aProfile = _IETableWriteToArray ($oTable)
; Write the array contents to the console
    For $i = 1 To UBound($aProfile, 2) - 2
        MsgBox(0, "", "Question: " & $aProfile[1][$i] & @CR)
    Next
Next

but now it will give me a object error or just exit like it didn't find the table.

This is what it looks like

Posted Image

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

You need to start checking the return value of each of the _IExxx function calls. If any one of them returns an error and you don't know it, using the value in subsequent calls will give you cryptic object errors.

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

You need to start checking the return value of each of the _IExxx function calls. If any one of them returns an error and you don't know it, using the value in subsequent calls will give you cryptic object errors.

Dale

got this back for the returns, what is this:

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00ù00

ù00ù00ù00ù00ù00ù00


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Did you try to get the return value of a function that returns an object?

Share this post


Link to post
Share on other sites

got this back for the returns, what is this:

ù00ù

So by "checking" I meant using isObj() to see if it is an object at all (it will be 0 if the function errors out). If it is an object, you can use ObjName() to see if it is the right type of object. Object variables are a special variant variable type and viewing them as a string may well look like what you showed above.

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

So by "checking" I meant using isObj() to see if it is an object at all (it will be 0 if the function errors out). If it is an object, you can use ObjName() to see if it is the right type of object. Object variables are a special variant variable type and viewing them as a string may well look like what you showed above.

Dale

You know, thanks a lot guys for all your help but for my midterm I just wrote a script with send to answer all the question true about 2 times and copy and pasted in to find and search to see If the question was right or not before. I did it 80 times. I got an 85%.

This is just over my head. I will still use this for basic scripts because it is a great UDF but some of it is just too much for me.

Thanks again

I'm currently into Speech recognition and Remote PC stuff right now anyways


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

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