Sign in to follow this  
Followers 0
not-me

How to fill web form inside opened site?

24 posts in this topic

can i know how to fill a form inside a website without needing to open the website (the website already opened) and without reload the site or using the mouse?

can i find a way to do that ?

i try to use _IEAttach by i get:

C:\Program Files\AutoIt3\Include\IE.au3 (2799) : ==> The requested action with this object has failed.:

Return HWnd($o_object.HWND ())

Return ^ ERROR

Thanks for all and for this forum.

Share this post


Link to post
Share on other sites



Can you show me your entire _IEAttach code?

And yes you can fill out the form using IE.au3 functions. Show me what you have and I'll try to help you.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, please do supply some code...

There are a couple of scenarios that will produce that error with _IEAttach. I am trying to erradicate them with a new release -- IE.au3 T2.0-6 pre-release - please test and report your results.

thanks,

Dale

Edit: tag typo

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

Share this post


Link to post
Share on other sites

someone, thank you for replying

but i deleted my code. can u help me in the hotmail login form as example:

This code to login to hotmail using IECreate

#include <IE.au3>
$oIE = _IECreate ("http://www.hotmail.com",1)
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
$username = "your username here"
$password = "your password here"
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

i want to do the same but without open the hotmail page (the hotmail page is already opened and i want to fill the username and pass in the form direclty)

i hope that u understand me .

Thanks alot

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If Dale comes back I'm a little curious to hear the answer, but I've never had good luck with using _IECreate ("", 1) but maybe its just me. What I find is more reliable is using _IEattach...

I can't check to see if this works right now since I'm at work and they don't allow me to go to any email sites... but try this

#include <IE.au3>
$handle = ControlGetHandle ("title", "text")
$oIE = _IEAttach($handle, "HWND")
;$oIE = _IECreate ("http://www.hotmail.com",1)
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
$username = "your username here"
$password = "your password here"
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

I think the best way of using _IEAttach is with handles, but you can also use title, text... plus others.

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

_IEAttach('titleofIEwindow',"Title") why not just go by title instead of using the title to get the handle

Share this post


Link to post
Share on other sites

I guess I use handles since a handle doesn't change... but your right you can definitely use either, and to some extent using the title is easier....

@Thatsgreat... are there any disadvantages to using the handle?


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

sorry someone but i got the same error when using ControlGetHandle.

DaleHohm i got the same error when i use IET2.0.6.au3

i dont know what is wrong with that ;)

Share this post


Link to post
Share on other sites

You made me pull out my tunnel to get around the internet restriction.. I used this code and it works for me

#include <IE.au3>
$handle = ControlGetHandle ("Sign In", "", "")
$oIE = _IEAttach($handle, "HWND")
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
$username = "your username here"
$password = "your password here"
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

With IEAttach set up like it is, its looking for the www.hotmail.com page (see the Sign In title). Like was said before you dont' have to use handles, but for the sake of it I left it in to show it how it would work


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Thank you someone, dont warry i will not tell your manager about what u did ;)

i did the same before but i got error:

Line 2799 (C:\Program Files\AutoIt3\Include\IE.au3 )

Return HWnd($o_object.HWND ())

Return ^ ERROR

can u give me the IE.au3 u used, it will be my last chance (i tired you)

Share this post


Link to post
Share on other sites

sorry someone but i got the same error when using ControlGetHandle.

DaleHohm i got the same error when i use IET2.0.6.au3

i dont know what is wrong with that ;)

I can't touch this without mor information and a reproducer.

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

Are you using the latest beta? I can tell you for a fact that it worked on my machine.... hmm. I'm confused... give us some more info, what ver of windows you are using.. and did you browse to the www.hotmail.com site BEFORE you ran the script? If not it wont' find any window with the title it is looking for.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

This is the full code i used:

;#include <IE.au3>
#include<IET.au3>
   $title=WinGetTitle("")
   $handle = ControlGetHandle ($title, "", "") 
   $oIE = _IEAttach($handle, "HWND")
   $o_form = _IEFormGetObjByName ($oIE, "f1")
   $o_login = _IEFormElementGetObjByName ($o_form, "login")
   $o_password = _IEFormElementGetObjByName ($o_form, "passwd")
   $o_signin = _IEFormElementGetObjByName ($o_form, "SI")
   $username = "your username here"
   $password = "your password here"
   _IEFormElementSetValue ($o_login, $username)
   _IEFormElementSetValue ($o_password, $password)
   _IEAction ($o_signin, "click")

I used $title=WinGetTitle("") to make it general to find the hotmail title in explorer or avant or maxthon

When i use #include <IE.au3> i got this error:

Line 2799 (C:\Program Files\AutoIt3\Include\IE.au3 )

Return HWnd($o_object.HWND ())

Return ^ ERROR

When i use #include <IET.au3> ( i rename IET2.0.6.au3 to IET.au3 and put in the include folder) i got this error:

Line 285(C:\Program Files\AutoIt3\Include\IET.au3 )

Return HWnd($o_object.HWND ())

Return ^ ERROR

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

You know WinGetTitle is not just for IE right? If you have Scite open or something else if could be returning that as the window...

Lets just kinda take it from the top, and try to find out whats going on.

This code will launch a new window... but does it work for you?

#include <IE.au3>
$oIE = _IECreate ("http://www.hotmail.com")
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
$username = "your username here"
$password = "your password here"
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

Also double check you are using the latest beta ...and what is avant or maxthon?

EDIT - Sorry if that came off as harsh.. I've been trying to get something of my own... dont' worry we'll get it

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

You know WinGetTitle is not just for IE right? If you have Scite open or something else if could be returning that as the window...

I know that, i open the hotmail page before i run the script ,i used WinGetTitle to get the hotmail page title because it diff when i use IE,avant or maxthon (avant and maxthon are tabbed web browser,based on IE, have many features based on IE)

the normal hotmail login code work fine with me (but it open a new window for the hotmail page)

but when i use $oIE = _IECreate ("http://www.hotmail.com",1) to attach to an existing window i got an error.

That is my problem,anywhere i use attch i got error ;)

Share this post


Link to post
Share on other sites

When i use #include <IET.au3> ( i rename IET2.0.6.au3 to IET.au3 and put in the include folder) i got this error:

Line 285(C:\Program Files\AutoIt3\Include\IET.au3 )

Return HWnd($o_object.HWND ())

Return ^ ERROR

This doesn't make sense - line 285 is in the middle of a comment block. Can you recheck what you are doing?

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

I guess how you want to procede depends a little on how you want your scirpt to work. Are you basically trying to browse to www.hotmail.com, and manually press a button and have it login, or are you trying to have a button press navigate you on your current IE tab(or however avant does it) to www.hotmail.com and then log you in?

Does that make sense? Dale would know for sure but I don't believe you can have the $s_string field of _IEAttach be blank... at least it didn't work for me.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

sorry DaleHohm the error in line 2850 not 285

someone,i want to open manually the hotmail (for example) then i press hotkey to run the script to put the username and password automatically.

The example script open the explorer (or open new tab) and then open the hotmail and fill the user and pass, all that done automatically

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Well this was a little more then I wanted to do... but Dale maybe you can shed some light on this. I couldn't seem to use IEattach with either text or title... I must have been doing something weird wrong. However I got it to work with handles. Heres the code

#include <IE.au3>

HotKeySet("{F7}","Hotmail")

While 1
    Sleep(1000)
WEnd


Func Hotmail()
$handle = WinGetHandle("")
$oIE = _IEAttach($handle, "HWND")
_IENavigate($oIE, "http://www.hotmail.com")
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")
$username = "your username here"
$password = "your password here"
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
EndFunc

Just note not me the script doesn't exit automatically. But you can see I used WinGetHandle with no problems but with WinGetTitle or text it woudn't attach. Probably something I did wrong but at any rate this code works

If you want to change it so you browse to hotmail.com yourself just remove the _IEnavigate line

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Well this was a little more then I wanted to do... but Dale maybe you can shed some light on this. I couldn't seem to use IEattach with either text or title...

You'd have to tell me what you were trying to attach to, what code you tried and what the output to the SciTe console is.

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