Jump to content

IE new functions


yehia
 Share

Recommended Posts

hi all just wasted about 2 days to write down those functions

i was working on a program that have an IE object embedded and i had to go to MSDN to get some object methods and properties since there was no functions for what i wanned in the UDFs

and here is a list of what i came up with in the end :

_IEElementReplaceText()

_IEDocMoveElement()

_IEDocInsertElement()

_IEPopupCreate()

_IEPopupHide()

_IEFrameScrollTo()

_IEElementScrollIntoView()

_IEGetElementFromPoint()

_IEFrameSetPos()

_IEBodyFindText()

_IEElementSetBKColor()

_IEElementSetColor()

_IEWindowExists()

_IECheckOnline()

_IEElementSetCursor()

maybe more to come but i don't think so

anyway if i saw someone interested in this maybe i will create some examples

please make a comment if you think this helps

hope this helps all

Yehia

previous downloads 31

Edit: updated a function and posted the code after applying the error check system

IE New.au3

Edited by yehia
Link to comment
Share on other sites

I agree totally. For this to be added to the current autoit version, you have to error check the functions. The dev team will not do it for you. Regarding your script, some of these functions could prove potentially useful.

Link to comment
Share on other sites

It would be best if you used the current variables in your UDF, but many people have used their own variables. I would try to use as many of the current variables as you can without changing how they work. If you need to create another variable to check for another error, do that. It is better to have more variables and error checking than no error checking at all.

Link to comment
Share on other sites

Good work there. I recommend you get DaleHohm to look at them. If he is happy with them you have a change to get them added.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

thanks all

@ LOULOU r u talking about the value property?

if so i have IE 8 beta and it works, u can manipulate the value

anyway to test this the property is named value so all u have to do is get an element then $element.value = "your value string"

and i guess there is another way through textrange elements but so far i only managed to use body text elements only

Edit: oh and one more way you can set the mode of IE8 to work under a lower version mode like IE7 and 6

Edited by yehia
Link to comment
Share on other sites

thanks all

@ LOULOU r u talking about the value property?

if so i have IE 8 beta and it works, u can manipulate the value

anyway to test this the property is named value so all u have to do is get an element then $element.value = "your value string"

and i guess there is another way through textrange elements but so far i only managed to use body text elements only

Edit: oh and one more way you can set the mode of IE8 to work under a lower version mode like IE7 and 6

Try to automate an Input type = file , and try to assign a value in the texte zone where you chose the name of the file , and you will see it is impossible due to security restriction, what i find is a way to bypass this problem

Link to comment
Share on other sites

yes LOULOU change the mode to any previous version and there will be nomore security restriction

once more thats right from MSDN

http://msdn.microsoft.com/en-us/library/ms535128(VS.85).aspx

Internet Explorer 8 and later. When a file is selected by using the input type=file object, the value of the value property depends on the value of the "Include local directory path when uploading files to a server" security setting for the security zone used to display the Web page containing the input object.

The fully qualified filename of the selected file is returned only when this setting is enabled. When the setting is disabled, Internet Explorer 8 replaces the local drive and directory path with the string C:\fakepath\ in order to prevent inappropriate information disclosure.

To illustrate, suppose you attempt to upload a file named C:\users\contoso\documents\file.txt. When you do this, the value of the value property is set to c:\fakepath\file.txt.

Link to comment
Share on other sites

Hi, Loulou !

an idea on How to automate Input type=file with IE8?

Cet exemple de code fonctionne (pour moi):
$ie = ObjCreate("InternetExplorer.Application")
$ie.Navigate("file: ///L:/miniedit_tst3.htm")
$ie.Visible=1
Sleep(1024)  ;wait for full load 
inputfile('champinput','C:\fichier.dat')
Exit

Func inputfile($id,$filename)
   $ie.Navigate("javascript: document.getElementById('"& $id &"').click();")
   Sleep(1024) ;wait depend of computer's speed 
   Send($filename)
   ;Sleep(1024)  ;wait only for user see the filename sended
   Send("{ENTER}")
EndFunc

Ne pas oublier de changer l'URL, ni de mettre le bon ID de l'input, et de choisir un nom de fichier existant.

Edited by Michel Claveau
Link to comment
Share on other sites

In IE8, the input type=file text box is read-only. You can't even type into it with the keyboard. They long ago disabled the ability to set the value with script. You need to click on the associated "Browse..." button and automate filling in the file selection popup box with standard Win* functions.

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!

In IE8, the input type=file text box is read-only. You can't even type into it with the keyboard. They long ago disabled the ability to set the value with script. You need to click on the associated "Browse..." button and automate filling in the file selection popup box with standard Win* functions.

You are right. But, if you want use the Autoit's IE-library (#include <IE.au3>), it not will run. Because _IEAction($inputobj, "click") wait the end of the dialog box.

My exemple of code run ok, but because it do not wait, after the click.

Link to comment
Share on other sites

In IE8, the input type=file text box is read-only. You can't even type into it with the keyboard. They long ago disabled the ability to set the value with script. You need to click on the associated "Browse..." button and automate filling in the file selection popup box with standard Win* functions.

Dale

Like this:

#include <IE.au3>

$oIE = _IE_Example("form")
$oT = _IEGetObjById($oIE, 'fileExample')
MouseMove(_IEPropertyGet($oT, "screenx") + _IEPropertyGet($oT, "width") - 10, _
          _IEPropertyGet($oT, "screeny") + _IEPropertyGet($oT, "height")/2)
MouseClick("left")
WinWait("Choose File to Upload")
$hChoose = WinGetHandle("Choose File to Upload")
ControlSend($hChoose, "", "Edit1", "C:\AUTOEXEC.BAT")
ControlClick($hChoose, "", "Button2")

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

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