Jump to content

_IEFormSubmit() For GUI IE


Didonet
 Share

Recommended Posts

I have this code:

$oIE = _IECreateEmbedded()
GUICreate("login", 600, 400, 0, 0);
GUICtrlCreateObj($oIE,-1,-1,630,570)
GUISetState()
_IENavigate ($oIE, "http://site.com/")
$oUser=_IEGetObjById($oIE,"user")
$oPass=_IEGetObjById($oIE,"parm")
_IEFormElementSetValue ($oUser, $username)
_IEFormElementSetValue ($oPass, $password)

_IEFormSubmit($oIE, 0) Do not works...

The site form is this:

<script>
function proc (){
document.auth.hs.value = hex_h(document.auth.parm.value+document.auth.ht.value);
document.auth.parm.value='';
}
</script>
<form name="auth" method=post action="page" autocomplete="off">
User: <input name="user" type="text" class="search" size=10>
Pass: <input name="parm" type="password" size=10>
<input type=checkbox name=save onchange=chk()>
<font size=1>remember the user and pass</font>
<input name="hs" type="hidden">
<input name="p" type="hidden" value="log">
<input name="ht" type="hidden" value=SID>
<input name=bsend value="Login" type="submit" onclick=proc()>
<input name=bsend value="Logout" type="submit" onclick=proc()>
</form>
Link to comment
Share on other sites

The remarks for _IEFormSubmit point you to _IEAction for another technique - have you tied that? What is giving you trouble?

Dale

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

I try with this:

$oIE = _IECreateEmbedded()
GUICreate("login", 600, 400, 0, 0);
GUICtrlCreateObj($oIE,-1,-1,630,570)
GUISetState()
_IENavigate ($oIE, "http://site.com/")
$oUser=_IEGetObjById($oIE,"user")
$oPass=_IEGetObjById($oIE,"parm")
_IEFormElementSetValue ($oUser, $username)
_IEFormElementSetValue ($oPass, $password)
$oSubmit = _IEGetObjByName ($oIE, "Login")
_IEAction ($oSubmit, "click")

But i get this error:

--> IE.au3 V2.3-1 Warning from function _IEGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.3-1 Error from function _IEAction, $_IEStatus_InvalidDataType

Link to comment
Share on other sites

_IEObjGetByName() means use the name of the object NOT the value, but try this:

$oIE = _IECreateEmbedded()
GUICreate("login", 600, 400, 0, 0);
GUICtrlCreateObj($oIE,-1,-1,630,570)
GUISetState()
_IENavigate ($oIE, "http://site.com/")
$oUser=_IEGetObjById($oIE,"user")
$oPass=_IEGetObjById($oIE,"parm")
_IEFormElementSetValue ($oUser, $username)
_IEFormElementSetValue ($oPass, $password)
$obk = _IEFormGetObjByName($oIE, 'auth')
_IEFormSubmit($obk)
Link to comment
Share on other sites

Nothing happens with this...

Now in the help i see something that i can use:

$oSubmit = _IEGetObjByName ($oIE, "bsend", -1)

#include <IE.au3> 
_IEGetObjByName ( ByRef $o_object, $s_Id [, $i_index = 0] )


 
Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object 
$s_Id Specifies name or id of the object you wish to match 
$i_index Optional: If name of id occurs more than once, specifies instance by 0-based index
0 (Default) or positive integer returns an indexed instance
-1 returns a collection of the specified objects

Ok, but i can not understand what it returns when i have "-1" in option.

"-1 returns a collection of the specified objects " What means this ? Array?

Link to comment
Share on other sites

You forum etiquette - hijacking other's threads and thread bumping - is pissing me off.

I can answer your questions, but I think I'd like to give you a little time to research them yourself first.

You can look at some of the links in my sig for documentation, also look in the Obj/COM section of the helpfile for information on collections. I'll alse tell you that I have answered the Collection vs Array question many times and you can search the forum to find those discussions.

Another hint is that you don't need a collection to solve your problem, but rather to get an object reference to a specific Submit button istance.

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

You forum etiquette - hijacking other's threads and thread bumping - is pissing me off.

I can answer your questions, but I think I'd like to give you a little time to research them yourself first.

You can look at some of the links in my sig for documentation, also look in the Obj/COM section of the helpfile for information on collections. I'll alse tell you that I have answered the Collection vs Array question many times and you can search the forum to find those discussions.

Another hint is that you don't need a collection to solve your problem, but rather to get an object reference to a specific Submit button istance.

Dale

Oh... As I say, my English is not very good. Even i understand your post in half...

And as I say again... I check the Help file, then Google, the forum and next i create a topic.

If i understand everything maybe this topic will not exists now...

My objective isn't to spam the forum. I'm seeking for help... but i didn't find it...

"You forum etiquette - hijacking other's threads and thread bumping - is pissing me off."

Is this is some kind of insult?

I'll be glad if u help me.. not just "look there, look here, look the help...". I look every where! And i can't find the way i can do it!.... :)

Edited by Didonet
Link to comment
Share on other sites

Bumping threads in typically not necessary in this forum because of how active it is. Doing so several times in a few hours will get you nowhere.

I'll answer your question when I have the time later this evening. In the mean time I suggest you try to find out what "pissing me off" means - I predict this is not the last time you'll hear 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

Link to comment
Share on other sites

For a description of Collections, please see here: #291414

In your case, you want to act upon the second INPUT TYPE=SUBMIT button in the collection of objects on your page with a name attribute "name=bsend". Assuming there are no other HTML elements on the page before the form you show in your example HTML, you would use:

$oLogIn = _IEGetObjByName($oIE, "bsend", 0) ; The first one is index 0, second is index 1
$oLogout = _IEGetObjByName($oIE, "bsend", 1) ; The first one is index 0, second is index 1oÝ÷ Ù.r^¶§mç(ëºÚ"µÍÌÍÛÒQHHÒQPÜX]Q[XYY

BÕRPÜX]][ÝÛÙÚ[][ÝË


NÂÕRPÝÜX]SØ    ÌÍÛÒQKLKLK
Ì
MÌ
BÕRTÙ]Ý]J
BÒQS]]H
    ÌÍÛÒQK  ][ÝÚËÜÚ]KÛÛKÉ][ÝÊBÌÍÛÕÙWÒQQÙ]ØRY
    ÌÍÛÒQK  ][ÝÝÙ][ÝÊBÌÍÛÔÜÏWÒQQÙ]ØRY
    ÌÍÛÒQK  ][ÝÜI][ÝÊBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÕÙ  ÌÍÝÙ[YJBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔÜË    ÌÍÜÜÝÛÜ
BÌÍÛÓÙÚ[HÒQQÙ]ØS[YJ    ÌÍÛÒQK  ][ÝØÙ[   ][ÝË
BÌÍÛÓÙÛÝ]HÒQQÙ]ØS[YJ  ÌÍÛÒQK  ][ÝØÙ[   ][ÝËJBÒQPXÝ[Û
    ÌÍÛÓÙÚ[   ][ÝØÛXÚÉ][ÝÊHÈÜÚ[ÙHÈ    ÌÍÛÓÙÛÝ]

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

Yeah, i think i get it! :))

Is that means, this code will works, if there are many submit buttons?

$bbt1 = _IEGetObjByName($oIE, "bsend", 0)

$bbt2 = _IEGetObjByName($oIE, "bsend", 1)

$bbt3 = _IEGetObjByName($oIE, "bsend", 2)

$bbt4 = _IEGetObjByName($oIE, "bsend", 3)

$bbt5 = _IEGetObjByName($oIE, "bsend", 4)

?

I'm really glad, u help me...thanks.. and thanks... and Thanks! :)

Link to comment
Share on other sites

Correct.

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

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