Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

Hmm im trying to make a script that will goto http://imageshack.us, type in the upload box and then press host, but i cant seem to get it to type in the upload box.. heres my code

#include <IE.au3>

$IE = _IECreate()
_IENavigate($IE, "http://imageshack.us/iframe.php")
$form = _IEFormGetObjByIndex($IE, 0)
$input = _IEFormElementGetObjByName($form, "fileupload")
_IEFormElementSetValue($input, "your username here")

Exit
Link to comment
Share on other sites

Hmm im trying to make a script that will goto http://imageshack.us, type in the upload box and then press host, but i cant seem to get it to type in the upload box.. heres my code

#include <IE.au3>

$IE = _IECreate()
_IENavigate($IE, "http://imageshack.us/iframe.php")
$form = _IEFormGetObjByIndex($IE, 0)
$input = _IEFormElementGetObjByName($form, "fileupload")
_IEFormElementSetValue($input, "your username here")

Exit
I'll say what DaleHohm has said time and again, post the problems or questions for help in support

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hmm im trying to make a script that will goto http://imageshack.us, type in the upload box and then press host, but i cant seem to get it to type in the upload box.. heres my code

#include <IE.au3>

$IE = _IECreate()
_IENavigate($IE, "http://imageshack.us/iframe.php")
$form = _IEFormGetObjByIndex($IE, 0)
$input = _IEFormElementGetObjByName($form, "fileupload")
_IEFormElementSetValue($input, "your username here")

Exit
IIRC, IE does not let you populate a file (upload) box via scripting through the Document object. You will likely need to break out of the IE object for that portion of the sccript and use "standard" AutoIT techniques.
Link to comment
Share on other sites

IIRC, IE does not let you populate a file (upload) box via scripting through the Document object. You will likely need to break out of the IE object for that portion of the sccript and use "standard" AutoIT techniques.

Thanks, your answer is correct. The OP re-asked the question in V3 Support and I answered him here... I asked him to come back here and edit the quistion above with a pointer to the new topic, but he did not do so.

Dale

Edit: 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

Link to comment
Share on other sites

I've toyed around with IE.au3 a bit, it's pretty interesting. But it can't help me as of yet, I need it to read text within a frame that does NOT exist in the body of the source.

What I'm doing is making a game bot which can run a game minimized, I've managed to do it quite successfully with mouseclick simulation, copying and reading text and other clever techniques, but I was hoping for something that could read the text and search for certain strings without manipulating the mouse/keyboard.

I don't know how possible it would be to do this, or if there is already a way, but I would love to see this! :)

Link to comment
Share on other sites

@Diverge -- can you please move your question to the V4 Support forum... this thread is too long to work point-specific issues.

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

Yes, it's designed to do exactly that. It'll do certain things, like trigger on responces. Say for example, it recognizes text that displays that I have gained a level. It will trigger the level function, then resume with the script.

*edit*

You edited your above post, which was origionally asking me a question =P

Edited by pacman1176
Link to comment
Share on other sites

I've toyed around with IE.au3 a bit, it's pretty interesting. But it can't help me as of yet, I need it to read text within a frame that does NOT exist in the body of the source.

What I'm doing is making a game bot which can run a game minimized, I've managed to do it quite successfully with mouseclick simulation, copying and reading text and other clever techniques, but I was hoping for something that could read the text and search for certain strings without manipulating the mouse/keyboard.

I don't know how possible it would be to do this, or if there is already a way, but I would love to see this! :)

@pacman1176

Sounds like you need to get a reference to an individual frame and then look at the body of the document included in the frame.

Please move any further discussion to the V3 Support forum as this thread is tool long to discuss point-issues.

thanks,

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

You're missing my point, the text isn't located within the body of the html. It's based on javascript which creates a changing interface. But I didn't think this could be done, sigh.

I'm guessing that you haven't actually tried reading the document body. The DOM doesn't care whether the content came from the original file on the server, whether it was generated by Javascript or whatever other creative means -- it simply gives you what you ask for based on the rendered content in the browser.

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

Dale,

Have you looked into the new patch that Microsoft is going to release next Tuesday? it is going to totally Fu&# with IE automation by disabling all ActiveX controls by default.

Apparently you can activate the ActiveX controls programatically by using the command Here: MSDN Link

More information Here: MSDN Link 2

Info on the Hotfix that is going to be in the IE rollup next week is Here: IE Update

Mike

Link to comment
Share on other sites

Thanks for the heads up Mike. I don't anticipate any problems however. Neither IE.au3 nor AutoIt directly use the affected mechanisms:

After a forthcoming update, Microsoft Internet Explorer users will not be able to directly interact with Microsoft ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements. Users will be able to interact with such controls after activating their user interfaces. A new MSDN topic describes how Internet Explorer will handle ActiveX controls, shows how to load ActiveX controls so their interfaces are activated, and describes the impact of this behavior on accessibility tools and applications hosting the WebBrowser Control.

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

Hey I gotta tell you, awsome job man, this is GREAT! Anyways, I got a problem. I was trying to automate a hotmail action and it wouldn't work. I'm sorry if you already covered this problem, because I only read your first few posts to learn from the examples.

I'm trying to automate a send email task and heres my code so far.

#include <IE.au3>

; Create a browser window and navigate to hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

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

; Set field values and submit the form
_IEFormElementSetValue($o_login, "MY EMAIL")
_IEFormElementSetValue($o_password, "MY PW")
_IEFormSubmit($o_form)

_IELoadWait($oIE)

_IEClickLinkByText ($oIE, "New Message")

_IELoadWait($oIE)



$o_form = _IEFormGetObjByName($oIE, "composeform")

$o_to = _IEFormElementGetObjByName($o_form, "to")
$o_subject = _IEFormElementGetObjByName($o_form, "subject")
$o_outgoingemail = _IEFormElementGetObjByName($o_form, "outgoing")


_IEFormElementSetValue($o_to, "EMAIL HERE")
_IEFormElementSetValue($o_subject, "SUBJECT HERE")
_IEFormElementSetValue($o_outgoingemail, "CONTENTS HERE")


;_IEClickLinkByText ($oIE, "Send")

;_IELoadWait($oIE)

;_IEQuit($oIE)

MsgBox(0, "", "done!")

Btw I modified some info, such as my email and pw. Now, the problem I am having is with the email contents. I watch it sign me in, go to compose new message. Then it inputs the email im sending to, then it inputs the subject. But it doesn't input the contents of the email. I think I may have gotten the wrong source. The following code is the source from the composition page.

}
function window.document.composeform.to.onkeydown() 
{
return SetFocus();
}
function window.document.composeform.cc.onkeydown() 
{
return SetFocus();
}
function window.document.composeform.bcc.onkeydown() 
{
return SetFocus();
}
function window.document.composeform.subject.onkeydown() 
{
return SetFocus();
}
function window.document.composeform.outgoing.onkeydown() 
{
return SetFocus();
}       
function SetFocus() 
{

As you can see, I used the Form Objects and the Elements from there. They work perfectly for the subject and the email, but it doesn't work for the actual contents. It doesn't display anything. Can someone tell me what would be the correct source to put in there to make it so that it puts text in the email contents area?

[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Link to comment
Share on other sites

  • Moderators

Well i have problems with trying to login on php webpages like :

http://www.autoitscript.com/forum/index.ph...t=Login&CODE=00

and

http://www.gfxintervention.com/forums/logi...e611380bd37047a

is it me or aren't we able to do that with IE.au3 atm ???

This will login to the second webpage:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.gfxintervention.com/forums/login.php")

; get pointers to the login form and the username, password, and autologin fields
$o_form = _IEFormGetObjByIndex($oIE, 0)
$o_login = _IEFormElementGetObjByName($o_form, "username")
$o_password = _IEFormElementGetObjByName($o_form, "password")
$o_autologin =  _IEFormElementGetObjByName($o_form, "autologin")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "your username")
_IEFormElementSetValue($o_password, "your password")
If _IEFormElementGetState($o_autologin) == "False" Then _IEFormCheck($o_autologin)
_IEFormSubmit($o_form)

Func _IEFormElementGetState($o_object)
  ; $o_object - Form Element object
    If IsObj($o_object) Then
        If $o_object.checked == True Then
            Return "True"
        Else
            Return "False"
        EndIf   
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc ;==>_IEFormElementGetState

Func _IEFormCheck($o_object)
 ; $o_object - IE form object
 ; return 1 always
    If IsObj($o_object) Then
        SetError(0)
        $o_object.Click ()
        Return 1
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc;==>_IEFormCheck
Link to comment
Share on other sites

@GodandRock

The message area is not a form element, but rather an iframe.

Give this a try and open a topic in V3 support if you need more assistance.

$oFrame = _IEFrameGetObjByName( $oIE, "richedit")
_IEBodyWriteHTML( $oFrame, "here is my message text")

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

It didn't work, Scite gives me this error:

C:\Documents and Settings\Minhaj & Jaudat\Desktop\AutoIt Scripts\IE.au3 (441) : ==> The requested action with this object has failed.: 
If IsObj($o_object.document.parentwindow.frames ($s_name, $i_index)) Then 
If ^ ERROR

I did beta run and it gives an error due to the line:

$oFrame = _IEFrameGetObjByName( $oIE, "richedit")

Can you help me out? That line shows up fine on syntax check but it gives an error while running.

[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Link to comment
Share on other sites

With the Compose message page displayed, this worked fine for me:

#include <IE.au3>
$oIE = _IEAttach("Hotmail")
$oFrame = _IEFrameGetObjByName( $oIE, "richedit")
_IEBodyWriteHTML( $oFrame, "here is my message text")

Please

Give this a try and open a topic in V3 support if you need more assistance.

This thread is too long to work point issues.

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

Hi @ all,

i have a little question. Does anyone know how i can use this "onclick" action?

<input type="image" onclick="this.form.wui_event_id.value='onclick';this.form.wui_target_id.value='sendButton';this.form.submit();return false;" src="https://www.orange.ch/static/portal/images/send.de.gif" alt="senden" name="sendButton"/>

I tried with _IEFormSubmit($o_form) but won't work :-S

Thanks a lot,

Regads

CoDeX2k

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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