Automating the IE Save AS file Dialog
Posted 06 November 2011 - 10:15 PM
After having recieved and absolute ton of assistance from all the user posts here, I feel obliged to share a bit of code I created to interact with the file-download dialog in IE. There might be better/easier ways, but I sure couldn't find them...or make them work in AutoIT as a newbie. I know there is an INetGet tool, but it won't work on the pages I'm using (security stuff...dynamic linking and my general ignorance). The code below will change the default text to a directory name, click the button, and replace the original file name back into the box. It's probably the equivalent of digital duct-tape, but I hope it can help somebody.
Note: I have the destination directory stored in a variable ($dest) from a FileSelectFolder call. I'm not sure all the sleep() steps are essential, but it doesn't hurt ot have a little patience.
....after having a link clicked elsewhere in the script....snip:
ControlClick("File Download","","Button2") ; this clicks the default "save" button on the first dialog
WinWait("Save As") ; Wait for the "Save As" box to pop up
$filename=ControlGetText("Save As","Save &in:","Edit1") ;Get the file name before we erase it
ControlSetText("Save As","Save &in:","Edit1","") ; erase the file name to make room for the $dest string
ControlSetText("Save As","Save &in:","Edit1", $dest) ; set the Edit1 text to the $dest and hit the button to swithc directories.
ControlSetText("Save As","Save &in:","Edit1", $filename) ; reset the name of the file to the original value.
- adarsh12in likes this
Posted 07 November 2011 - 10:20 AM
Posted 07 November 2011 - 11:42 AM
Posted 07 November 2011 - 06:26 PM
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
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users