kin Posted November 22, 2005 Share Posted November 22, 2005 Hello all, first i want to excuse if this question is stupid as i am a newbie , but it is important for me how to do it. I must send some archive files every day to a *.jsp page. I found the Internet Explorer Automation UDF Library for AutoIt3 from DaleHohm and 10x to this automation i can navigate to the requested link, but i can't find nothing about attaching a file in Internet Explorer. The situation is a little more complicated because when i choose the file, start one program which calculate the hash sum of the file, and during these time the 'Submit' button is disabled. Can anyone help me with these or i am on the wrong track 10x in advance to all Link to comment Share on other sites More sharing options...
DaleHohm Posted November 22, 2005 Share Posted November 22, 2005 Hello all,first i want to excuse if this question is stupid as i am a newbie , but it is important for me how to do it. I must send some archive files every day to a *.jsp page. I found the Internet Explorer Automation UDF Library for AutoIt3 from DaleHohm and 10x to this automation i can navigate to the requested link, but i can't find nothing about attaching a file in Internet Explorer. The situation is a little more complicated because when i choose the file, start one program which calculate the hash sum of the file, and during these time the 'Submit' button is disabled. Can anyone help me with these or i am on the wrong track10x in advance to allHello kin,Welcome to the forums.I have to admit to not having done any testing with fileUpload and IE.au3, but <input type="file"> is set up as a normal form element.I'm not understanding exactly what trouble you are having so I'll need you to provide more detail. Preferably, privide an example publicly available on the Internet that allows for demonstration and testing.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 More sharing options...
kin Posted November 23, 2005 Author Share Posted November 23, 2005 Hello kin, Welcome to the forums. I have to admit to not having done any testing with fileUpload and IE.au3, but <input type="file"> is set up as a normal form element. I'm not understanding exactly what trouble you are having so I'll need you to provide more detail. Preferably, privide an example publicly available on the Internet that allows for demonstration and testing. Dale Hello Dale, 10x for the fast reply, i will paste some example, because i don't know for something like these on the internet. This is is my work, and it is a little more complicated.here are the View Source: <FORM NAME="signerForm" ACTION="/boricalogs/UploadFileServlet" ENCTYPE="multipart/form-data" METHOD="post" onsubmit="this.elements['Submit'].disabled=true;"> <table border=0 cellpadding="0" cellspacing="0" align="center" class="btxt" > <tr><td> </td> <td> <font size="-1" color="blue"> </td></tr> <tr><td>Име на фаил </td> <td><input type="hidden" name="currentPath" value="/BIDILog.do"> <input type="hidden" name="logType" value="BI"> <input type="hidden" name="processFileAction" value="/registerBIDIFile.do"> <INPUT NAME=cardfilefile CLASS="btxt" TYPE=FILE size="45" maxlength="50" onchange="sign()" disabled /> </td> </tr> <tr><td> </td> <td> <table width="100%" border=0 cellpadding="0" cellspacing="0" align="center" class="btxt" > <tr> <td CLASS="btxt" align="left" > <INPUT TYPE="hidden" NAME="fileSign" SIZE=50 > <INPUT TYPE="hidden" NAME="clientCert" SIZE=350> </td> <td align="right"><INPUT CLASS="clsLoginSend" type="submit" name="Submit" value="Send" disabled ></td> </tr> </table> </td> </tr> </table> </FORM></td></tr> And my programm passage : $Biname="t:\Bi511216.zip" $url="https://intranet_url/" $o_IE=_IEAttach($url,"url") if Not IsObj($o_IE) Then MsgBox(0,"","No open IE") Exit 1 EndIf _IENavigate ($o_IE, "https://intranet_url/BIDILog.do") _IEClickLinkByText ($o_IE, "Refresh") $osignForm = _IEFormGetObjByName($o_IE, "signerForm") $oInput = _IEFormElementGetObjByIndex($osignForm, 3) _IEFormElementSetValue($oInput, $Biname) $oInput.fireEvent("onchange") _IELoadWait($o_IE) #cs $oSubmitButton = _IEFormElementGetObjByIndex($osignForm, 6) $oSubmitButton.Click _IELoadWait($o_IE) _IEFormSubmit($osignForm) _IELoadWait($o_IE) #ce This work when i want to change some other type like options and so on but when i want to put the file name in this form nothing is shown and if i submit the form i receive the message that there is no file attached. 10x in advance to all Link to comment Share on other sites More sharing options...
kin Posted November 29, 2005 Author Share Posted November 29, 2005 Hi all,i have make a litle web site example for my tries. Here is the code and the link.http://topbgproperty.com/k.phpSource: $Biname="c:\RI511280.ZIP" $url="http://topbgproperty.com/k.php" $o_IE=_IEAttach($url,"url") if Not IsObj($o_IE) Then MsgBox(0,"","Not Found") Exit EndIf $oForm = _IEFormGetObjByIndex($o_IE, 0) $oRegion = _IEFormElementGetObjByIndex($oForm, 0) MsgBox(0,"",@error) _IEFormElementSetValue($oRegion, $Biname) $oRegion.fireEvent("onchange") MsgBox(0,"",@error) ;_IEFormSubmit($oForm)I don't know what to do, to attach the file. Any help will be appreciated. P.S. Excuse for my bad english. 10x to all Link to comment Share on other sites More sharing options...
DaleHohm Posted November 29, 2005 Share Posted November 29, 2005 Hello Kin,I said I had not done any testing with "type=file" fields, but in fact this same question was raised once before and I had forgotten about it. The behavior you are seeing is an apparently intentional restriction of the DOM in both IE and Netscape that prevents the value of this element from being directly scriptable.See the other discussion here where I suggest a workaround of giving focus to the input box and then using the AutoIt Send function to input your filename (in your example $oRegion.focus followed by a Send("filename")).BTW, you will want to use the Submit (or simulate a .click on the submit button) and not use the .fireEvent which requires an onclick= action be specified for the form.DaleHi all,i have make a litle web site example for my tries. Here is the code and the link.http://topbgproperty.com/k.phpSource: $Biname="c:\RI511280.ZIP" $url="http://topbgproperty.com/k.php" $o_IE=_IEAttach($url,"url") if Not IsObj($o_IE) Then MsgBox(0,"","Not Found") Exit EndIf $oForm = _IEFormGetObjByIndex($o_IE, 0) $oRegion = _IEFormElementGetObjByIndex($oForm, 0) MsgBox(0,"",@error) _IEFormElementSetValue($oRegion, $Biname) $oRegion.fireEvent("onchange") MsgBox(0,"",@error) ;_IEFormSubmit($oForm)I don't know what to do, to attach the file. Any help will be appreciated. P.S. Excuse for my bad english. 10x to all 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 More sharing options...
kin Posted November 30, 2005 Author Share Posted November 30, 2005 Hello Kin,I said I had not done any testing with "type=file" fields, but in fact this same question was raised once before and I had forgotten about it. The behavior you are seeing is an apparently intentional restriction of the DOM in both IE and Netscape that prevents the value of this element from being directly scriptable.See the other discussion here where I suggest a workaround of giving focus to the input box and then using the AutoIt Send function to input your filename (in your example $oRegion.focus followed by a Send("filename")).BTW, you will want to use the Submit (or simulate a .click on the submit button) and not use the .fireEvent which requires an onclick= action be specified for the form.DaleHi Dale,10x again for the fast reply. I will use this way to upload files, but i have one last specific question. In my real example which is Reply#2 i have button Submit disabled. Is there a function which check the status of the button and if it is enabled to click it. For now i use Sleep() function but the time is different every time and i want to make it faster then Sleep()10x in advance Link to comment Share on other sites More sharing options...
DaleHohm Posted November 30, 2005 Share Posted November 30, 2005 In my real example which is Reply#2 i have button Submit disabled. Is there a function which check the status of the button and if it is enabled to click it. For now i use Sleep() function but the time is different every time and i want to make it faster then Sleep()The .disabled property of an element can be queried (it is a read/write property) so you could easilyWhile $oSubmit.disabled sleep(100) Wendto idle waiting for it to become enabled. 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 More sharing options...
kin Posted December 2, 2005 Author Share Posted December 2, 2005 The .disabled property of an element can be queried (it is a read/write property) so you could easilyWhile $oSubmit.disabled sleep(100) Wendto idle waiting for it to become enabled. Dale 10x Dale, this spend mi a time. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now