Jump to content
maddogrsf

Noob question about a script im writing concerning boolean operators statements and MOAR !

Recommended Posts

maddogrsf

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 AM

2)script creates an array containing the files inside the upload folder

3)script launches uptool

4)Script says to uptool 1 file at time, reading it from the array previously created, untill all files of the array are uploaded

5)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 uptool

Empty clipboard

send file to uptool

sleep100ms

click 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 code

if 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 input

the 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 by maddogrsf

Share this post


Link to post
Share on other sites
TheDcoder

No, Do...Until does not accept AND keyword, TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
maddogrsf

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 by maddogrsf

Share this post


Link to post
Share on other sites
MachinistProgrammer

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

​a 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

Share this post


Link to post
Share on other sites
SadBunny

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.

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

×