supadodger Posted October 18, 2010 Share Posted October 18, 2010 #Include <IE.au3> Opt("TrayIconDebug", 1) Local $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward Local $GUI_Button_Home, $GUI_Button_Stop, $msg $oIE = ObjCreate("Shell.Explorer.2") GUICreate("Form1", 800, 768, 1, 1) $GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, 800, 768) GUISetState() ;Show GUI $oIE.navigate("http://megaupper.com/",0) _IELoadWait($oIE) ControlClick ("Form1","","[CLASS:Internet Explorer_Server; INSTANCE:1]","Left",2,749, 432) WinWait ("Choose File to Upload") ControlSetText ("Choose File to Upload","","[CLASS:Edit; INSTANCE:1]","c:\test.zip") ControlClick ("Choose File to Upload","","[CLASS:Button; INSTANCE:2]") it stays hung on the line ControlClick ("Form1","","[CLASS:Internet Explorer_Server; INSTANCE:1]","Left",2,749, 432) Link to comment Share on other sites More sharing options...
Realm Posted October 18, 2010 Share Posted October 18, 2010 (edited) Hello supadodger, It seems to work for me, I tested your original script, and made all the way to the file diaolog, but I noticed that it did not send the text to the edit control...so I changed the last 2 lines of your script. This I how I have automated File Dialogs before. Let Me know if this works for you: #Include <IE.au3> Opt("TrayIconDebug", 1) Local $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward Local $GUI_Button_Home, $GUI_Button_Stop, $msg $oIE = ObjCreate("Shell.Explorer.2") GUICreate("Form1", 800, 768, 1, 1) $GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, 800, 768) GUISetState() ;Show GUI $oIE.navigate("http://megaupper.com/",0) _IELoadWait($oIE) ControlClick ("Form1","","[CLASS:Internet Explorer_Server; INSTANCE:1]","Left",2,749, 432) WinWait ("Choose File to Upload") ControlSetText ("Choose File to Upload","","Edit1","c:\test.zip") ControlClick ("Choose File to Upload","","Button2") Edit: Cleaned up some typos Edited December 1, 2010 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
supadodger Posted October 18, 2010 Author Share Posted October 18, 2010 (edited) Hello supadodger,It seems to work for me, I tested your original script, and made all the way to the file diaolog, but I noticed that it did not send the text to the edit control...so I changed the last 2 lines of your script. This I how I have automated File Dialogs before.still the same problem. the whole script stalls for me as soon as the file select dialog is open.i am using internet explorer 8 dont know if that makes a difference. Edited October 18, 2010 by supadodger Link to comment Share on other sites More sharing options...
DaleHohm Posted October 18, 2010 Share Posted October 18, 2010 Please see the example in my sig for automating input type=file 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...
supadodger Posted October 20, 2010 Author Share Posted October 20, 2010 i didnt want to have mouse clicks so i did this. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=C:\upload.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <IE.au3> #NoTrayIcon WinWait ("Choose File to Upload","",10) Sleep(500) for $x = 1 to 10 ControlSetText("Choose File to Upload","","[CLASS:Edit; INSTANCE:" & $x & "]",$CmdLine[1]) ControlClick ("Choose File to Upload","","[CLASS:Button; INSTANCE:"& $x & "]") Sleep(1000) then you call c:\upload.exe $DIR\$FILENAMETOUPLOADHERE as long as it has the standard choose file to upload it will work... if not just change the window title. Link to comment Share on other sites More sharing options...
vamsikrishna Posted December 1, 2010 Share Posted December 1, 2010 i didnt want to have mouse clicks so i did this. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=C:\upload.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <IE.au3> #NoTrayIcon WinWait ("Choose File to Upload","",10) Sleep(500) for $x = 1 to 10 ControlSetText("Choose File to Upload","","[CLASS:Edit; INSTANCE:" & $x & "]",$CmdLine[1]) ControlClick ("Choose File to Upload","","[CLASS:Button; INSTANCE:"& $x & "]") Sleep(1000) then you call c:\upload.exe $DIR\$FILENAMETOUPLOADHERE as long as it has the standard choose file to upload it will work... if not just change the window title. Hi,I am trying to upload a file following the similar kind of code.It freezes after dialog box is opened and wont go further.It doesn't write file path in edit instance of dialog box.But when I reexecute the script or cancel dialog and click on browse button again ,then script works.It means it is not able to identify first opened window as active.Please give me solution. Here is my code:- #include <IE.au3> ; Internet Explorer is partly integrated in shell.application $oShell = ObjCreate("shell.application") ; Get the Windows Shell Object $oShellWindows=$oShell.windows ; Get the collection of open shell Windows $MyIExplorer="" for $Window in $oShellWindows ; Count all existing shell windows ; Note: Internet Explorer appends a slash to the URL in it's window name if StringInStr($window.LocationURL,"http://***.jsp") then $MyIExplorer=$Window exitloop endif next $oForm = _IEGetObjByName ($MyIExplorer, "alfFileInput") _IEAction($oForm, "click") $MyIExplorer=$Window WinWait ("Choose file") ;$Window = $MyIExplorer ControlSetText ("Choose file","","Edit1","c:\d.bmp") ; ControlClick ("Choose file","","Button2") and what is this size used for.?.I commented it anyways..still needs clarity. Link to comment Share on other sites More sharing options...
Realm Posted December 1, 2010 Share Posted December 1, 2010 vamsikrishna, Sorry about the , it has nothing to do with the script, it was extra garbage from a cut n paste that I overlooked. take that out and see if your script works. The as where it is placed would freeze/break your script just before it is to press the 'Button2'. Sorry for that overseen junk. Cleaned up. Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 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