getafix Posted July 27, 2010 Share Posted July 27, 2010 Hello Everyone, I am basically new to AutoIt and this forum I need help in creating an AutoIt script to handle the IE save as dialogue and then want the file to be saved in a specific location (Example C:\users) I have an AutoIt script which handles the Internet Explorer 'save as ' dialogue as below . -------------------------------------------------------------------------------------------- AutoItSetOption("WinTitleMatchMode", "2") WinWait("File Download") $title = WinGetTitle("File Download") WinActivate($title) WinWaitActive($title) Send("s") WinWait("Save As") $title = WinGetTitle("Save As") WinActivate($title) WinWaitActive($title) $filename = ControlGetText($title, "", "Edit1") $fullpath = $CmdLine[1] & "\" & $CmdLine[2] & "-" & $filename ControlSetText($title, "", "Edit1", $fullpath) Send("{ENTER}") ConsoleWrite($fullpath) ------------------------------------------------------------------------------------------ But can anyone help me in modifying the code so that it saves the file in my desired location For example if i want to save the file under "C:\users\test.html" How can i pass this parameter in the AutoIt script Any help would be highly appreciated Link to comment Share on other sites More sharing options...
Juvigy Posted July 27, 2010 Share Posted July 27, 2010 Change this: $fullpath = $CmdLine[1] & "\" & $CmdLine[2] & "-" & $filename to $fullpath = "C:\users\test.html" Link to comment Share on other sites More sharing options...
tobject Posted July 27, 2010 Share Posted July 27, 2010 Use _INetGetSource or InetGet Press F1 and there are samples in Help file If you already have links you can do something like array of Names, array of links ....... for $Indx1 = 0 to $ElCount-1 $sFileName=String("images\"&$NamesArray[$Indx1]&@MON&@MDAY&@YEAR&".png") $hDownload=InetGet($LinksArray[$Indx1], $sFileName, 1, 1) Do Sleep(250) Until InetGetInfo($hDownload, 2) Link to comment Share on other sites More sharing options...
getafix Posted July 27, 2010 Author Share Posted July 27, 2010 (edited) Change this: $fullpath = $CmdLine[1] & "\" & $CmdLine[2] & "-" & $filename to $fullpath = "C:\users\test.html" Hi Juvigy, Thanks for your very quick reply I modified the code as below: ---------------------------------------------- AutoItSetOption("WinTitleMatchMode", "2") WinWait("File Download") $title = WinGetTitle("File Download") WinActivate($title) WinWaitActive($title) Send("s") WinWait("Save As") $title = WinGetTitle("Save As") WinActivate($title) WinWaitActive($title) $filename = ControlGetText($title, "", "Edit1") $fullpath = "C:\Users\Test.html" ControlSetText($title, "", "Edit1", $fullpath) Send("{ENTER}") ConsoleWrite($fullpath) $title = WinGetTitle("Download Complete") WinActivate($title) WinWaitActive($title) Send("{ENTER}") ----------------------------------------------------- No problems i can get the file Test.html saved under my C:\Users directory ! However the final Send{ENTER} command does not seems to work The "Download Complete" dialogue does not get closed ? How do i get AutoIt to close the D'ownload complete' dialogue" Many thanks! Edited July 27, 2010 by getafix Link to comment Share on other sites More sharing options...
Juvigy Posted July 27, 2010 Share Posted July 27, 2010 Use WinClose() Link to comment Share on other sites More sharing options...
getafix Posted July 27, 2010 Author Share Posted July 27, 2010 Use WinClose()Hi Juvigy,Thanks for the replyCould you let me know which part of the code should i put the WinClose() statement I tried putting at the end of my code like below but no luck!ConsoleWrite($fullpath)$title = WinGetTitle("Download Complete")WinActivate($title)WinWaitActive($title)Send("{ENTER}") WinClose() However the main task of saving the file to my desired location worked !So i am happy about it Link to comment Share on other sites More sharing options...
Juvigy Posted July 27, 2010 Share Posted July 27, 2010 Something like this should work: Change Send("{ENTER}") WinClose() to WinClose($title) Check out the help file - there are examples there. Link to comment Share on other sites More sharing options...
getafix Posted July 27, 2010 Author Share Posted July 27, 2010 Something like this should work: Change Send("{ENTER}") WinClose() to WinClose($title) Check out the help file - there are examples there. Thanks a lot Juvigy I shall implement that when i get to work tomorrow. Yes i shall have a look at the documentation in detail Cheers 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