Jump to content
Sign in to follow this  
darzanmihai

Small question using IE.au3

Recommended Posts

darzanmihai

I have a question about using IE.au3 to send a picture path to a control in a web page.

I have uploaded a print screen whith it and to test it I have used:

#include <IE.au3>

$oIE = _IECreate("http://www.postlets.com", 1, 1, 1, 0)
_IELoadWait($oIE)
$j=0
$o_form = _IEFormGetObjByName($oIE, "create4")
For $c in $o_form
    If $c.name = "imagefile[]" Then $c.click
Next

...this will open the file open dialog, but I do not need it this way. I need it to directly set the value with the path to the picture, but I do not know how because the name "imagefile[]" confuses me and I do not know how to handle it especialy because all of the photo inputs have the same name...

Could someone help me with this one?

Thx in advance!


I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites
mvendak

You want to set the .value of an input type=file object directly, but that is not possible, its read-only. Anyway, i guess you should try to .focus on the control, Send() the filename, then submit the form.

"The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only." - http://msdn.microsoft.com/en-us/library/ms535126(VS.85).aspx

Share this post


Link to post
Share on other sites
darzanmihai

You want to set the .value of an input type=file object directly, but that is not possible, its read-only. Anyway, i guess you should try to .focus on the control, Send() the filename, then submit the form.

"The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only." - http://msdn.microsoft.com/en-us/library/ms535126(VS.85).aspx

Thx for your reply!

It works as you said, but isn't it any other more elegant way?


I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites
mvendak

Well, setting file inputs by scripts is not a feature of DOM, so i guess there is not much to do, at least not by using the dom. Imho, this method i posted shouldn't be working either, it could lead to security issues. Btw, are you sure that the site you are writing your script for allows these pictures to be uploaded automaticaly, moreover, in a hidden window, so the user can't see the actual website, or is this against their terms of use? I suggest reading that first, before you get yourself banned or something :)

Share this post


Link to post
Share on other sites
DaleHohm

Suggest you read the remarks for _IEFormElementSetValue and see the example there.

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  

×