Sign in to follow this  
Followers 0
burger

IE include problem

21 posts in this topic

I'm attempting to run a file with the Beta version 3.1.1.133. The first line of the file is: #include <IE.au3>

An error message come up: Line 311 (File "C:\Program Files\AutoIt3\Include\IE.au3"):

Case "0"

Error: "Case" statement with no matching "Select" statement

What am I doing wrong?

Share this post


Link to post
Share on other sites



I'm attempting to run a file with the Beta version 3.1.1.133. The first line of the file is: #include <IE.au3>

An error message come up: Line 311 (File "C:\Program Files\AutoIt3\Include\IE.au3"):

Case "0"

Error: "Case" statement with no matching "Select" statement

What am I doing wrong?

Even though you think you are running the beta, you are in fact running the previous productions version (this is caused by the use of a SWITCH statement that the old production version does not understand).

I actually suggest taht you upgrade to the new 3.2(.1) version and this should not be an issue for you.

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

#3 ·  Posted (edited)

Even though you think you are running the beta, you are in fact running the previous productions version (this is caused by the use of a SWITCH statement that the old production version does not understand).

I actually suggest taht you upgrade to the new 3.2(.1) version and this should not be an issue for you.

Dale

Thanks.

Edited by burger

Share this post


Link to post
Share on other sites

Thanks.

I did as you suggested, I even uninstalled all betas. I'm still having the same issue. Is there there a way to confirm the version I'm running?

Share this post


Link to post
Share on other sites

I did as you suggested, I even uninstalled all betas. I'm still having the same issue. Is there there a way to confirm the version I'm running?

I apologize, the error now refer to a line in my file which comes from an old example. The line it has a problem with is

.fo

Share this post


Link to post
Share on other sites

Put this in your code:

ConsoleWrite("AutoIt Version --> " & @AutoItVersion & @CR)

Give us some of your code so we can have a look see.

I did as you suggested, I even uninstalled all betas. I'm still having the same issue. Is there there a way to confirm the version I'm running?

Share this post


Link to post
Share on other sites

Put this in your code:

ConsoleWrite("AutoIt Version --> " & @AutoItVersion & @CR)

Give us some of your code so we can have a look see.

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://mywebpage")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "mylogin"
$password = "mypasswrd"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

This code is working fine now however, the page takes too long to load so the inputs never get entered. How can I delay the input until the page loads? Thanks

Share this post


Link to post
Share on other sites

This code is working fine now however, the page takes too long to load so the inputs never get entered. How can I delay the input until the page loads? Thanks

I doubt that it is the page taking too long, instead that the page never finishes loading. Your current script will create the browser, navigate to the webpage, and wait till the page is finished loading before moving on.

Share this post


Link to post
Share on other sites

I doubt that it is the page taking too long, instead that the page never finishes loading. Your current script will create the browser, navigate to the webpage, and wait till the page is finished loading before moving on.

You are correct. I got it to work by using Send("login{TAB}password{ENTER}") instead of FormElementSetValue. Thanks.

Share this post


Link to post
Share on other sites

You are correct. I got it to work by using Send("login{TAB}password{ENTER}") instead of FormElementSetValue. Thanks.

That may work most of the time, but it would be more error proof getting the FormElementSetValue working. It you could provide a link I will take a look at it and see what I can figure out.

Share this post


Link to post
Share on other sites

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://mywebpage")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "mylogin"
$password = "mypasswrd"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
The code above is exactly what I use to log into Hotmail. Is this script for "http://www.hotmail.com"

or something similar and not "http://mywebpage" on line 3.

This script as is has never failed me yet. And that was one of the things that surprised me, was how fast it loaded and logged in.

vim

Share this post


Link to post
Share on other sites

Here is the link. If you can get the Form method to work I'd be greatful.

http://lifecalc.com/cgi-bin/openwebmail/openwebmail.pl

Here you go...

#include <IE.au3>

_IEErrorHandlerRegister()

$sUserName = "Your Username"
$sPassword = "Your Password"

$sURL = "http://lifecalc.com/cgi-bin/openwebmail/openwebmail.pl"
$oIE = _IECreate($sURL)

$oForm = _IEFormGetObjByName($oIE, "login")
$oUserName = _IEFormElementGetObjByName($oForm, "loginname")
$oPassword = _IEFormElementGetObjByName($oForm, "password")

_IEFormElementSetValue($oUserName, $sUserName)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)

Share this post


Link to post
Share on other sites

Here you go...

#include <IE.au3>

_IEErrorHandlerRegister()

$sUserName = "Your Username"
$sPassword = "Your Password"

$sURL = "http://lifecalc.com/cgi-bin/openwebmail/openwebmail.pl"
$oIE = _IECreate($sURL)

$oForm = _IEFormGetObjByName($oIE, "login")
$oUserName = _IEFormElementGetObjByName($oForm, "loginname")
$oPassword = _IEFormElementGetObjByName($oForm, "password")

_IEFormElementSetValue($oUserName, $sUserName)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)
I know your code is correct and I used a previous snippet of yours:

===================================================

#include <IE.au3>

$oIE = _IECreate("http://lifecalc.com/cgi-bin/openwebmail/openwebmail.pl")

$oForms = _IEFormGetCollection($oIE)

MsgBox(0, "Form(s) Info", "There are " & @extended & " form(s) on this page")

$i = 0

For $oForm In $oForms

MsgBox(0, "HTML for Form " & $i, $oForm.innerHTML)

$i += 1

Next

===================================================

But how do you know to get the correct values for IEFormElementGetObjByName on "loginname"/"password"?

I see the "loginname"/"password" inside that HTML mess, but what line is the the key?

Thanks!

vim

Share this post


Link to post
Share on other sites

But how do you know to get the correct values for IEFormElementGetObjByName on "loginname"/"password"?

I see the "loginname"/"password" inside that HTML mess, but what line is the the key?

Thanks!

vim

This line gives you the name of the form:

<form method="post" action="/cgi-bin/openwebmail/openwebmail.pl" enctype="application/x-www-form-urlencoded" name="login">

This these two lines give you the input names:

<input type="text" name="loginname" size="14" onchange="" />

<input type="password" name="password" size="14" onchange="" />

Share this post


Link to post
Share on other sites

This line gives you the name of the form:

This these two lines give you the input names:

Thank you, that's a big help. Now I know what to look for.

vim

Share this post


Link to post
Share on other sites

Thank you, that's a big help. Now I know what to look for.

vim

Thank you Big Daddy!

Share this post


Link to post
Share on other sites

Thank you Big Daddy!

No problem, glad I could help!

Share this post


Link to post
Share on other sites

Created by the browser, but not a window with a browser control -- use standard AutoIt window and control commands to manipulate it.

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

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