maddogrsf Posted June 10, 2015 Share Posted June 10, 2015 (edited) Hi all im writing a small script that will let me automate my fileuploading need to my cloudspace. to do so im invoking in my script a small freeware software called " Z_o_o_m File & image uploader" (to cut it short i will call it uptool from now on) The project is planned to work in this way :1)script exe evoked by Windows scheduled task Every night at 1:00 AM2)script creates an array containing the files inside the upload folder3)script launches uptool4)Script says to uptool 1 file at time, reading it from the array previously created, untill all files of the array are uploaded5)When all file uploaded script erases all file in the upload folder and now lets get to the problem all works flawlessy except for the fact that SOMETIMES the upload tool fails the upload ( this can be to various reason , being an unattended script many thing can happen as : connection lost , connection problem on the filehost side and more so i was thinking of a filter that actually check if the file is actually uploaded to do so i tought to interact with uptool in such way:Launch uptoolEmpty clipboardsend file to uptoolsleep100msclick in the area where it show the result of the upload in uptool (this areaof uptool was programed by the author of uptool as if upload successful pastes automatically by its own url of the upload if upload unsuccessful pastes a standard error message " error download url not found" if upload not yet complete it makes clipboard empty, so this will be the filter of choice)if clipboard empty then sleep until clipoboard gets either the url or the error codeif error code happens erase from the result area the error message (so that it gets empty again) then go in the uptool filelist area (that has only one file in the list) click , send home shift end (to select all files even if it is 1 file in the list this will make it coordinates not necessary) then send the reupload inputthe question is : Does the Do.... until ..... accept bolean operator "AND" DO reupload until value got from message area is not "" and not "error" ? thank you PS this is my suorce code so far ;BEGIN UPLOADER For $i = 1 To $arrayLength - 1 WinActivate(" File & Image Uploader 7.1.3 = Freeware =","") sleep (300) Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASS:SysHeader32; INSTANCE:1]","left", 1, 483, 9) ;set the listing by alphabetical order Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASS:TPanel; INSTANCE:1]","left", 1, 14, 23) ;click on the select file input sleep (500) ControlSend ("Open","","[CLASSNN:Edit1]", $array[$i]) sleep (400) Controlclick("Open","","[CLASSNN:Button2]") sleep (400) ;this lines actually say what file to upload starting from the first file in the array list Do sleep (100) ClipPut("") ;clipoard empty sleep (100) Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASSNN:TTntListView.UnicodeClass1]") ;click to the output area of uptool to get either error code or down link Send("{HOME}") Send("{SHIFTDOWN}{END}{SHIFTUP} ") Send("{DEL}") Local $LINKZ = ClipGet() Until $LINKZ <> "" i was thinking to add a selection the end of this code Select Case $LINKZ = "Error: Download link not found!" Do the reup thingies untli $LINKZ <> "" AND LINKZ <> "Error: Download link not found!" Case $LINKZ <>"Error: Download link not found!" AND $LINKZ <> "" proceeed with normal script end selection Edited June 10, 2015 by maddogrsf Link to comment Share on other sites More sharing options...
TheDcoder Posted June 10, 2015 Share Posted June 10, 2015 No, Do...Until does not accept AND keyword, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
maddogrsf Posted June 10, 2015 Author Share Posted June 10, 2015 (edited) thank you for fast response i added a part of my source code with comments. do you have an alternative to solve my problem ? hope the surce code can help you.. or atleast suggestions Edited June 10, 2015 by maddogrsf Link to comment Share on other sites More sharing options...
MachinistProgrammer Posted June 10, 2015 Share Posted June 10, 2015 thank you for fast response i added a part of my source code with comments. do you have an alternative to solve my problem ? hope the surce code can help you.. or atleast suggestionsa reasonably easy solution would be;BEGIN UPLOADER For $i = 1 To $arrayLength - 1 WinActivate(" File & Image Uploader 7.1.3 = Freeware =","") sleep (300) Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASS:SysHeader32; INSTANCE:1]","left", 1, 483, 9) ;set the listing by alphabetical order Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASS:TPanel; INSTANCE:1]","left", 1, 14, 23) ;click on the select file input sleep (500) ControlSend ("Open","","[CLASSNN:Edit1]", $array[$i]) sleep (400) Controlclick("Open","","[CLASSNN:Button2]") sleep (400) ;this lines actually say what file to upload starting from the first file in the array list Do sleep (100) ClipPut("") ;clipoard empty sleep (100) Controlclick(" File & Image Uploader 7.1.3 = Freeware =","","[CLASSNN:TTntListView.UnicodeClass1]") ;click to the output area of uptool to get either error code or down link Send("{HOME}") Send("{SHIFTDOWN}{END}{SHIFTUP} ") Send("{DEL}") Local $LINKZ = ClipGet() Select Case $LINKZ = "Error: Download link not found!" ContinueLoop Case $LINKZ <>"Error: Download link not found!" AND $LINKZ <> "" ExitLoop Until $LINKZ <> "" All my projects live on github Link to comment Share on other sites More sharing options...
SadBunny Posted June 10, 2015 Share Posted June 10, 2015 No, Do...Until does not accept AND keyword, TD ??Works fine for me:Local $a = 0 Local $b = 0 Do $a += 1 $b += .5 Sleep(100) ConsoleWrite($a & ", " & $b & @CRLF) Until $a >= 10 And $b >= 10 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
TheDcoder Posted June 10, 2015 Share Posted June 10, 2015 @SadBunny EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
maddogrsf Posted June 10, 2015 Author Share Posted June 10, 2015 hey guys thx for your replies i just back from my office time , will test first how i thought @ first using either "Do until AND" or using "while do until wend". sycam0inc ---- your solution looks VERY ELEGANT , and so so simple . i didnt even knew there was such contine loop and exit loop ! im a novice ! i will test it also ! THANK YOU ! Link to comment Share on other sites More sharing options...
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