Jump to content

Save directly to a folder (X:client/download)


solnar
 Share

Recommended Posts

Greetings, I have a script that downloads PDFs from a portal updated daily. It cycles through the page for 15 files, and then refreshes the browser to load another 15.

At the beginning of the script, I have to select the folder I want for the first download and then automatically that folder is chosen for the rest.

Right now I have it clicking through to get to the folder (listed below). Problem is if the amount of folders change in the parent folder, then the X Y is off.

How can I make that particular folder the default folder in the Save As dialog box? We have about 7 network drives.

I have looked here and seached, but cannot seem to find exactly what I need. I thought perhaps it might be a Global function for settting, but cannot get it to work.

Thanks!

Randy - (Quite new to AutoIt)

_WinWaitActivate("Save As","")

;click through to X drive/client/SE_branch/downloads

;path should be changed for each client instance

;SE_branch path

MouseClick("left",53,178,1)

MouseClick("left",152,92,2)

MouseClick("left",157,192,2)

MouseClick("left",341,94,2)

MouseClick("left",153,229,2)

MouseClick("left",194,108,2)

Link to comment
Share on other sites

You shouldn't be using mouse clicks to do this, just do a FileCopy on the list of files on the mapped drive(s) instead. Using one of the FileListToArray functions that searches subfolders would get you the list of all the files/folders in the path and then you'd just have to loop through the array to get the file names to copy.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks Brewman, but I am not seeing how that will work.

- the program clicks the hyperlink, a new browser window opens.

- the program clicks from a drop down menu, and chooses PDF format.

- it then asks open or save, and I have the send (s) programmed to bring up the Save As dialog box.

- at that point, I copy text from the previous page (name of the company) and add a time stamp, then key ENTER.

I am not really copying anything, just saving these PDFs into a folder with timestamp, etc.

Thanks, Randy

Link to comment
Share on other sites

Where are these files coming from?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Basically it is a medical billing processor. My client has multiple clients that funnel billing through this one processor. So I have multiple logins for each clients statements. The first part of my program logs in, so depending on which login it uses, it should save those particular files to that particular clients folder.

ie > Login is Oracle23 --- I have to save those PDFs to X:OracleDownloads

ie > Login is Yuengling25 --- I have to save those PDFs to X:YuenglingDownloads

Edited by solnar
Link to comment
Share on other sites

If this is done through the browser, you might want to look at the _IE* functions, I don't have any experience with using these so I won't be of much help in that regard.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I don't suppose INetGet() would provide what you need?

It does not seem like it would. I have to choose the file type to download from a dropdown menu, and the resulting URL is a long string that changes.

Thanks, Randy

Link to comment
Share on other sites

  • 2 weeks later...

I looked at the _IE* and INetGet() functions, but did not really see a way to save directly to the folder I needed. So I adjusted the folder location to always be at the top, and went with the click through method for the 1st row/file, then skipped that step for the remaining 14 files. Thanks !

<p>;Start row 1

_WinWaitActivate("Report List - Windows Internet Explorer","")

Sleep(5000)

MouseClick("left",451,253,1)

;1st variable coordinate

MouseMove(429,328)

Sleep(3000)

MouseDown("left")

;2nd variable coordinate

MouseMove(300,328)

Sleep(3000)

MouseUp("left")

Send("{CTRLDOWN}c{CTRLUP}")

Sleep(3000)

;3rd variable coordinate

MouseClick("left",953,332,1)

_WinWaitActivate("Report Viewer - Windows Internet Explorer","")

Sleep(8000)

MouseClick("left",531,69,1)

Sleep(3000)

MouseClick("left",483,128,1)

Sleep(3000)

MouseClick("left",579,68,1)

Sleep(5000)

Send("s")

_WinWaitActivate("Save As","")

;click through to X drive/1_Downloads/Client

;path should be changed for each client instance

;Client1 path for STATION1

MouseClick("left",57,174,1)

MouseClick("left",153,91,2)

MouseClick("left",164,194,2)

MouseClick("left",177,76,2)

;this last coordinate needs to be changed for each client

MouseClick("left",127,75,2)

Sleep(3000)

;extra double click to select default file name and overwrite

MouseClick("left",295,367,2)

Send("{CTRLDOWN}v{CTRLUP}")

Send("log"&@YEAR&@MON&@MDAY&"_"&@hour&@min&@sec&"{Enter}")

Sleep(3000)

_WinWaitActivate("Download complete","")

MouseClick("left",379,239,1)

Sleep(3000)

_WinWaitActivate("Report Viewer - Windows Internet Explorer","")

MouseClick("left",1004,17,1)

;Start row 2

Edited by solnar
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...