Search the Community
Showing results for tags 'saveas'.
-
Hi all, I'm trying to download a file as a result of an interrogation to a report server, this means I don't have a direct URL from which to download directly the file. I need to interact with the classic "Save as" dialog box To perform this task I wrote a simple piece of code I'm supposed to work, it could be summarized as follows Local $hWndDwnld=WinActivate("Download del file") Sleep(500) If @error Then ConsoleWrite('WinActivate' & '@error = ' & @error & @CRLF & '@extended = ' & @extended) ConsoleWrite("Wait for download file dialog..." & @CRLF) Local $hWndDwnld=WinWaitActive("Download del file") ConsoleWrite(".. found." & @CRLF) WinActivate($hWndDwnld) Endif ;~ waiting for window ControlSend($hWndDwnld, "", "", "!v") ;~ send ctrl+v WinWait("Salva con nome") WinActivate("Salva con nome") ControlSetText("Salva con nome", "", "[CLASS:ToolbarWindow32; INSTANCE:3]", $dest) Sleep(1500) ControlSetText("Salva con nome","","[CLASS:Edit; INSTANCE:1]","") Sleep(1500) $filename="aReport.csv" ;~ ControlSetText("Salva con nome","&Salva","Edit1", $filename) ControlSetText("Salva con nome","","[CLASS:Edit; INSTANCE:1]", $filename) Sleep(1500) $filename=ControlGetText("Salva con nome","&Salva","Edit1") ConsoleWrite(" --> " & $filename & @CRLF) ControlClick("Salva con nome","","Button1")It's based mostly on this post: https://www.autoitscript.com/forum/topic/134561-automating-the-ie-save-as-file-dialog/ What I'would like to obtain is changing the filename and the directory as in the two variables $filename and $dest. Instead I get the file named as provided by the report server and suggested at first in the SaveAs window and dowloaded in the last folder browsed, to be more clear none of the ControlSetText instructions in the snippet above work. TIA for any help. PS: the script is based on the Italian language settings for the WinOS, for the English language the "Download del file" and "Salva con nome" strings should be replaced by "File Download" and "Save As" respectively.