Jump to content

Trouble with _IEFormGetCollection()


Recommended Posts

My head is about to EXPLODE because I can't figure out how to set the data in this browse input, I believe using _IEFormGetCollection() and _IEFormElementGetCollection() will do the trick but I truthfully don't have much experience using it... I'm trying to set the browse element to a file name.

Example : "c:\file\file.zip"

Here is the form

<form enctype="multipart/form-data" action="" method="POST" onsubmit="set_pleasewait()">
       <input type="HIDDEN" name="MAX_FILE_SIZE" value="10240000">
       <input type="FILE" name="scanfile" value="Browse...">

       <input type="HIDDEN" name="action" value="process">
       <input type="SUBMIT" id="submitbutton" value="Submit" disabled>
       &nbsp;&nbsp;&nbsp;<a href="http://virusscan.jotti.org/de" title="Auf Deutsch"><img src="images/de.png" border="0" alt=""></a>
      </form>

From http://virusscan.jotti.org/

I so far have this:

_IENavigate($oIE,"http://virusscan.jotti.org/")
            $oForm = _IEFormGetCollection ($oIE, 0)
            $oFile = _IEFormElementGetObjByName ($oForm, "scanfile")
            _IEFormElementSetValue ($oFile, "c:\file\file.zip" )

Thanks

P.S. I'll thank you in the morning, im tired atm. Thanks though

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Apparently

--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType (Browser securuty prevents SetValue of TYPE=FILE)

A work around..see if it works

_IEAction($oFile, "focus")

Send("C:\file\file.zip")

Edited by Generator
Link to comment
Share on other sites

Please read the information in the helpfile about _IEFormElementSetValue (particularly the Remarks). Also look at the output in the SciTe console -- it should lead you to the answer.

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

Thanks DaleHolm, I hadn't seen that, I used this:

$oIE2 = _IECreate("http://virusscan.jotti.org/",0,0)
            $oForm = _IEFormGetCollection ($oIE2, 0)
            $oFile = _IEFormElementGetObjByName ($oForm, "scanfile")
            _IEAction($oFile, "focus")
            $hIE = _IEPropertyGet($oIE2, "hwnd")
            ControlSend($hIE, "", "Internet Explorer_Server1", GUICtrlRead($FilePath))

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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