Jump to content

is it just me or IE.au3?


Recommended Posts

I get the error

: ERROR: ObjName(): undefined function.

        If (ObjName($o_window.document)

when running the following code...

#include <IE.au3>

$urlNum = 1000
$url1 = "http://www.paradiseloop.com/forum/posting.php?mode=reply&t="
$url = $url1 + $urlNum

$oIE = _IECreate()

for $urlNum = 1000 to 2000
   
   
   _IENavigate($oIE, "http://autoitscript.com")
   _IELoadWait($oIE, 50)
   
   $site_body = _IEBodyReadHTML($oIE)
   
   $str1 = "Sorry, but only can reply to posts in this forum."
   $str2 = "This topic is locked: you cannot edit posts or make replies."
   $str3 = "this must be replaced"
   
   if StringInStr ($site_body, $str1) = 0 Or StringInStr ($site_body, $str2) = 0 OR StringInStr ($site_body, $str3) = 0 Then
      
      $f_form = _IEFormGetObjByName($oIE, "post")
      $f_subject = _IEFormGetObjByName($f_form, "subject")
      $f_message = _IEFormGetObjByName($f_form, "message")
      
      _IEFormElementSetValue($f_subject, "wow")
      _IEFormElementSetValue($f_message, "nice...")
      
    ;_IEFormSubmit($f_form)
      
    sleep (100000000000)
      
   EndIf
   
   $urlNum = $urlNum + 1
   $url = $url1 + $urlNum
   
   sleep (10000)
Next

_IEQuit($oIE)

I thought the problem occurred because I did not have the latest beta but I installed it and ran it but I still get the error. Any idea anyone? Is it my mistake or is there something up with IE.au3 (which i doubt)

BTW, it says that the error is in the IE.au3 file....

Edited by ame1011
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

If your using SciTe, it's the AU3Check, just hit continue it will work.

<{POST_SNAPBACK}>

thanks for the reply, i'll try that when i get home from work. New version of scite comming soon, btw?
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

thanks for the reply, i'll try that when i get home from work. New version of scite comming soon, btw?

<{POST_SNAPBACK}>

actually i think the issue is you're not running it with the Beta... ALT {F5} to run from beta may get rid of those errors...and when you compile make sure to beta compile, ALT{F7}
Link to comment
Share on other sites

actually i think the issue is you're not running it with the Beta... ALT {F5} to run from beta may get rid of those errors...and when you compile make sure to beta compile, ALT{F7}

<{POST_SNAPBACK}>

If it is a run-time error, then the latest beta is not being used. If Au3Check is being run, it will give the error today regardless of the beta version because its definitions have not been updated yet.

There is a forum topic dedicated to Au3Check -- it would be best to inquire/watch there for updates.

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

actually i think the issue is you're not running it with the Beta... ALT {F5} to run from beta may get rid of those errors...and when you compile make sure to beta compile, ALT{F7}

<{POST_SNAPBACK}>

I specifically made sure that I was running the script from the beta... the problem does not lie there.
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

This really isn't very complicated and there is nothing wrong with IE.au3

The latest version of IE.au3 uses a new AutoIt beta command introduced in beta version 3.1.1.63.

If you are running AutoIt from SciTe, it will run Au3Check prior to executing your code. Au3Check tries to check your code for syntax, report problems it thinks it has found and if it finds trouble gives you the opportunity to abort or continue to the actual running of your code.

As of today, Au3Check thinks that ObjName is a syntax error since its definitions have not yet been updated to include it. If you are running beta 3.1.1.63 or higher, then simply tell it you want to continue and execute the code and all should be fine.

If you continue on and run the code and you get another error about ObjName() then there is a good chance that you did not execure the beta even though you have it installed. SciTe tries to make it easy to switch between the production release and an installed beta by putting a command for each on the Tools menu -- F5 executes the production release, Alt-F5 executes the beta.

If you are concerned about the version that is actually running, place the following line at the top of your code:

MsgBox(0,"AutoIt Version",@AutoItVersion)

You'll get a messagebox that verifies the version that is actually being run.

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

This really isn't very complicated and there is nothing wrong with IE.au3

The latest version of IE.au3 uses a new AutoIt beta command introduced in beta version 3.1.1.63.

If you are running AutoIt from SciTe, it will run Au3Check prior to executing your code.  Au3Check tries to check your code for syntax, report problems it thinks it has found and if it finds trouble gives you the opportunity to abort or continue to the actual running of your code.

As of today, Au3Check thinks that ObjName is a syntax error since its definitions have not yet been updated to include it.  If you are running beta 3.1.1.63 or higher, then simply tell it you want to continue and execute the code and all should be fine.

If you continue on and run the code and you get another error about ObjName() then there is a good chance that you did not execure the beta even though you have it installed.  SciTe tries to make it easy to switch between the production release and an installed beta by putting a command for each on the Tools menu -- F5 executes the production release, Alt-F5 executes the beta.

If you are concerned about the version that is actually running, place the following line at the top of your code:

    MsgBox(0,"AutoIt Version",@AutoItVersion)

You'll get a messagebox that verifies the version that is actually being run.

Dale

<{POST_SNAPBACK}>

I ran the msgbox code at the top of my script and it displayed the version number 3.1.1.65. I AM running the latest beta, but Au3Check still shows that there is an error with that new function being used in ie.au3. I chose to ignore this message thinking that the problem lay only in au3check. Unfortunately, when I came accross the part in my code where the new function was being utilized, I got an error and my script was terminated. This function is simply not working for me even though I am running the latest beta. Any thoughts?
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

I chose to ignore this message thinking that the problem lay only in au3check. Unfortunately, when I came accross the part in my code where the new function was being utilized, I got an error and my script was terminated.

If everything you say is correct, then this should not happen... it is certainly not happening for me and I am running 3.1.1.65 as well.

Please post the exact run-time messages/errors you are receiving and a small reproducer.

Thanks,

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

If everything you say is correct, then this should not happen... it is certainly not happening for me and I am running 3.1.1.65 as well.

Please post the exact run-time messages/errors you are receiving and a small reproducer.

Thanks,

Dale

<{POST_SNAPBACK}>

My Code:

#include <IE.au3>
$urlNum = 1000
$url1 = "http://www.paradiseloop.com/forum/posting.php?mode=reply&t="
$url = $url1 & $urlNum
$oIE = _IECreate()
_IELoadWait($oIE, 50)
for $urlNum = 1000 to 2000
    _IENavigate($oIE, $url)
    _IELoadWait($oIE, 50)
    $site_body = _IEBodyReadHTML($oIE)
    $str1 = "Sorry, but only can reply to posts in this forum."
    $str2 = "This topic is locked: you cannot edit posts or make replies."
    $str3 = "this must be replaced"
    if StringInStr ($site_body, $str1) = 0 Or StringInStr ($site_body, $str2) = 0 OR StringInStr ($site_body, $str3) = 0 Then
        $f_form = _IEFormGetObjByName($oIE, "post")
        $f_subject = _IEFormGetObjByName($f_form, "subject")
        $f_message = _IEFormGetObjByName($f_form, "message")
        _IEFormElementSetValue($f_subject, "wow")
        _IEFormElementSetValue($f_message, "nice stuff!")
   ;_IEFormSubmit($f_form)
        sleep (100000000000);remove
    EndIf
    $urlNum = $urlNum + 1
    $url = $url1 + $urlNum
    sleep (10000)
Next
_IEQuit($oIE)

The error:

ERROR: ObjName(): undefined function.
        If (ObjName($o_window.document)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Edited by ame1011
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

OK, so I went to this site, I registered for an account so that I could skip the login screen and I do get an error running your script, but it has nothing to do with ObjName (see the SciTe transcript below). I do get the Au3check error as expected, but the runtime error has to do with trying to act on a form that doesn't exist on the page that your script navigated to.

I'm guessing that your If statement just prior to the form commands is not what you want... and that you really want womething more like (notice the Not):

if Not (StringInStr ($site_body, $str1) = 0 Or StringInStr ($site_body, $str2) = 0 OR StringInStr ($site_body, $str3) = 0) Then

The trouble appears to be in the logic of your code. Granted, IE.au3 is giving you a cryptic error message, but this will get much better now that I have ObjName to work with and do better error trapping.

Dale

Your real errors:

>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /prod /ErrorStdOut /in "C:\AutoItScripts\teste.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams    
>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Production\Au3Check\au3check.dat
C:\AutoItScripts\IE\IE.au3(275,39) : ERROR: ObjName(): undefined function.
        If (ObjName($o_window.document)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\AutoItScripts\teste.au3 - 1 error(s), 0 warning(s)
>AU3Check Ended with Error(s).
>Running: (3.1.1.65):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoItScripts\teste.au3"    
C:\AutoItScripts\IE\IE.au3 (728) : ==> Variable must be of type "Object".: 
If IsObj($o_object.document.forms.item ($s_name, $i_index)) Then 
If IsObj($o_object^ ERROR
>AutoIT3.exe ended.
>Exit code: 0    Time: 19.547

Edit: fixed lots of typos

My Code:

#include <IE.au3>
$urlNum = 1000
$url1 = "http://www.paradiseloop.com/forum/posting.php?mode=reply&t="
$url = $url1 & $urlNum
$oIE = _IECreate()
_IELoadWait($oIE, 50)
for $urlNum = 1000 to 2000
    _IENavigate($oIE, $url)
    _IELoadWait($oIE, 50)
    $site_body = _IEBodyReadHTML($oIE)
    $str1 = "Sorry, but only can reply to posts in this forum."
    $str2 = "This topic is locked: you cannot edit posts or make replies."
    $str3 = "this must be replaced"
    if StringInStr ($site_body, $str1) = 0 Or StringInStr ($site_body, $str2) = 0 OR StringInStr ($site_body, $str3) = 0 Then
        $f_form = _IEFormGetObjByName($oIE, "post")
        $f_subject = _IEFormGetObjByName($f_form, "subject")
        $f_message = _IEFormGetObjByName($f_form, "message")
        _IEFormElementSetValue($f_subject, "wow")
        _IEFormElementSetValue($f_message, "nice stuff!")
  ;_IEFormSubmit($f_form)
        sleep (100000000000);remove
    EndIf
    $urlNum = $urlNum + 1
    $url = $url1 + $urlNum
    sleep (10000)
Next
_IEQuit($oIE)

The error:

ERROR: ObjName(): undefined function.
        If (ObjName($o_window.document)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

<{POST_SNAPBACK}>

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

Link to comment
Share on other sites

OK, so I went to this site, I registered for an account so that I could skip the login screen and I do get an error running your script, but it has nothing to do with ObjName (see the SciTe transcript below).  I do get the Au3check error as expected, but the runtime error has to do with trying to act on a form that doesn't exist on the page that your script navigated to. 

I'm guessing that your If statement just prior to the form commands is not what you want... and that you really want womething more like (notice the Not):

if Not (StringInStr ($site_body, $str1) = 0 Or StringInStr ($site_body, $str2) = 0 OR StringInStr ($site_body, $str3) = 0) Then

The trouble appears to be in the logic of your code.  Granted, IE.au3 is giving you a cryptic error message, but this will get much better now that I have ObjName to work with and do better error trapping.

Dale

Your real errors:

>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /prod /ErrorStdOut /in "C:\AutoItScripts\teste.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams 
>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Production\Au3Check\au3check.dat
C:\AutoItScripts\IE\IE.au3(275,39) : ERROR: ObjName(): undefined function.
        If (ObjName($o_window.document)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\AutoItScripts\teste.au3 - 1 error(s), 0 warning(s)
>AU3Check Ended with Error(s).
>Running: (3.1.1.65):C:\Program Files\AutoIt3\autoit3.exe "C:\AutoItScripts\teste.au3"  
C:\AutoItScripts\IE\IE.au3 (728) : ==> Variable must be of type "Object".: 
If IsObj($o_object.document.forms.item ($s_name, $i_index)) Then 
If IsObj($o_object^ ERROR
>AutoIT3.exe ended.
>Exit code: 0   Time: 19.547

Edit: fixed lots of typos

<{POST_SNAPBACK}>

it's always something stupid.... I thank you very much for taking the time to help me.
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

  • 2 years later...

I was wondering...how could I select an object in a form by its value?...could this be possible?

I have to do a script on a webpage that doesn't have "names" for the buttons in it...just values...for example in the form named "TZ" I do have a button with no name...but with the value "Next"...how could I select it....Thanks! :)

Link to comment
Share on other sites

I was wondering...how could I select an object in a form by its value?...could this be possible?

I have to do a script on a webpage that doesn't have "names" for the buttons in it...just values...for example in the form named "TZ" I do have a button with no name...but with the value "Next"...how could I select it....Thanks! :)

Start a new topic for your new question. This has nothing to do with the topic (from 2005!) that you dug up. Don't hijack other topics, start your own...

:)

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...