Jump to content

unable to save the file downloaded file to desired location( Solved)


Recommended Posts

Hello,

I have written a code which downloads files from a web application.  

steps 

1. click on  save -> save as 

2.window pop  opens-> then do control set to give the desired  file location and File name

Surprisingly  the code that i have written works well on my windows but  on other systems  it goes to their default download location  with default  file name ,(does not  change the file name).

#include <IE.au3>
#include <Crypt.au3>
#include <Excel.au3>
#include <File.au3>

Local $hIE = WinGetHandle("[Class:IEFrame]")
Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]")

$WinHndz = WinGetHandle("xyz")
WinActivate($WinHndz)

If WinExists($hIE,"") Then
   $WinHndz = WinGetHandle("xyz")
   WinActivate($WinHndz)
   ControlClick($WinHndz,"","DirectUIHWND1","left",1,838,28)
   ControlSend($WinHndz,"","DirectUIHWND1","{UP}a")
   sleep(1000)
   ControlSetText("Save As", "", "Edit1", @ScriptDir &"\EVM file" &"\test.xlsx")
   sleep(1000)
   ControlClick("Save As", "", "Button1")
EndIf

image.png.d718fe9d164f4dbe311f28cf41ba35ea.png

 

Could someone tell me what is that I'm doing  wrong ? please..

Note: i can see controlSetText doing its job , however when it clicks on save button it goes to default   download location.

 

 

Edited by spoo
Solved
Link to comment
Share on other sites

Local $hIE = WinGetHandle("[Class:IEFrame]")
Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]")

$WinHndz = WinGetHandle("Airbus Enhanced Configurator")
WinActivate($WinHndz)

If WinExists($hIE,"") Then

   $WinHndz = WinGetHandle("Airbus Enhanced Configurator")
   WinActivate($WinHndz)
   ControlClick($WinHndz,"","DirectUIHWND1","left",1,838,28)
   ControlSend($WinHndz,"","DirectUIHWND1","{UP}a")
   sleep(500)
   ConsoleWrite(@ScriptDir &"\EVM file" &"\"&$sheet_name  & @CRLF)
   ControlSetText("Save As", "", "Edit1", @ScriptDir &"\EVM file" &"\"&$sheet_name&".xlsx")
   ControlSend("Save As", "", "Edit1","{END}x{BACKSPACE}")
   ControlClick("Save As", "", "Button1")
EndIf

 

for Some reason 

after controlSetText   ,controlSend had to be given.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...