andydis Posted April 1, 2016 Posted April 1, 2016 hello, new user to AUTOIT, I was wondering if its possible to do the following:- 1) if a (downloaded) file is an xml file then do x, if a downloaded files is a zip file then do y 2) we download "sales orders" from a website, each sales order has a unique code (for example 33598) The script ideally would find the next number up from when it was last ran and click the same distance to the right of that number (to download the file) is this possible?
markyrocks Posted April 1, 2016 Posted April 1, 2016 (edited) Yes definitely possible. You'd need to save the last file number in a file for the program to reference after it shut down. There's no need to click on anything bc the file can be opened using other methods depending on what your trying to accomplish. To determine the file extension you'd basically need to make a _FileListToArray then use the list to do a stringright () function to isolate the extension. The do whatever you need to do from there. That step maybe skipped for a more sophisticated method. I'd write a small example but I'm at work on a smartphone and it's kinda a pita. To accurately click link use _ieclicklinkbytext () Edited April 1, 2016 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning"
InunoTaishou Posted April 1, 2016 Posted April 1, 2016 Look at a browser UDF (Chrome, Firefox, Internet Explorer). I'm sure there's a way to parse the page for the download link without using MouseClick(x + some magic number, y + some magic number). I don't know what your url would look like but most will have the file name at the end of the url and that would include the extension. https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.zip autoit-v3.zip
andydis Posted April 6, 2016 Author Posted April 6, 2016 Ok i have down the IF statement for filetype by simply launching a batch file, The one i am stuck on is generate a sequential number ( not need to click as ive found the number is in the URL!) but i will also need a IF statement that says if the generatednumber containing the url bring back a error 404 within the page to stop the script any help?
UIL Posted April 6, 2016 Posted April 6, 2016 hello friend.. Please read the manual.. i use this code! $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop if StringRight( $sFileName , 4 ) = ".zip" then ;do this elseif StringRight( $sFileName , 4 )= ".xml" then ;do that EndIf EndIf
AutoBert Posted April 6, 2016 Posted April 6, 2016 (edited) and why not doing "this" or "that"? What's going wrong? Edited April 6, 2016 by AutoBert
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