Sign in to follow this  
Followers 0
johnmcloud

Wait for a file/Do action in sequence

7 posts in this topic

#1 ·  Posted (edited)

Hi guys, i need an help for a script. The situation is:

I have a txt file with some command for a FTP site. I can download only ONE file at the time with a particular software for the company where I work, so i need to copy-paste the link on the software, wait for the download, than copy paste the second link ect..

The folder of download is the same for every file.

The procedure is:

1) Take the first line of the txt, copy-paste on the software ( LINK1)

2) Wait for the download is finished ( i have think to use FileExist, but i don't know the name of the file. I can't use IE or internal autoit function for download the file )

3) Take the second line of the txt, copy-paste on the software ( LINK2 )

4) Wait for the download is finished ( so i have 2 file in the same folder )

5) Take the third line of the txt, copy-paste on the software ( LINK3 )

6) etc...

The txt is:

LINK1
LINK2
LINK3
etc...

For read the line i have think to use FileOpen/FileReadLine or _FileReadToArray, but the problem is how to understand when a file ends/download is finished, and then copy the second line in the software

Thanks for any help ;)

Edited by johnmcloud

Share this post


Link to post
Share on other sites



file ends/download is finished, and then copy the second line in the software

huh, you have to find a way to check when a download is finished.

You can try to read the controls of the software (autoit3info will help you), but I don't think this will work.

Second option I'm thinking about, check if the file [being] downloaded is already opened (means that it's not finished).

You can list all the files in the download directory at run time then each time there is a new file, then it's the file being downloaded.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

You can try to read the controls of the software (autoit3info will help you), but I don't think this will work.

Not work, no way to use autoit3info on that software

Second option I'm thinking about, check if the file [being] downloaded is already opened (means that it's not finished).

You can list all the files in the download directory at run time then each time there is a new file, then it's the file being downloaded.

Br, FireFox.

I thought about using DirGetSize for check it out the number of the file but the file is created at the startup of the download, so a file exist also if it's not finished.

Share this post


Link to post
Share on other sites

You could get a list of files in the download directory via _FileListToArray() twice, once before you start the download and again after a few seconds. Compare the two lists for changed files and use a method similar to what FireFox has suggested to check whether the file is available.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

I thought about using DirGetSize for check it out the number of the file but the file is created at the startup of the download, so a file exist also if it's not finished.

That's why I said you need to check if the file is opened.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

johnmcloud,

Take a look at seangriffin's FielSystemMonitor UDF. I have used to to identify file copy completion so you should be able to identify download completion as well. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hi Melba,

can you show me a little example usign that UDF? You can use at the top of the script:

$my_url = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"
ShellExecute("iexplore.exe", $my_url)
; Save the file in @WorkingDir & "Test" or anything you want

For check it out if work also on download

Thanks ;)

Edited by johnmcloud

Share this post


Link to post
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
Sign in to follow this  
Followers 0