Jump to content

Controlsend issue


Recommended Posts

Hello again every one i have one very strange issue.

first of all as i said in a previous thread im writing a script to interact with an app called  Z_o_o_m File & image uploader" (to cut it short i will call it uptool from now on) to know more how my small project works you can have a look at my previous thread if this would also allow you to solve my issue .

anyway here is part of my actual source code

 

;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 (700)
      ControlSend ("Open","","[CLASSNN:Edit1]", $array[$i])
      sleep (500)
      Controlclick("Open","","[CLASSNN:Button2]")
      sleep (200) ;this lines actually say what file to upload starting from the first file in the array list
        ....rest of the source code

 

the issue is the following : sometimes , RANDOMLY apparently , when the script has to send $i (file name to upload) it will send it wrong.

 

lets suppose this $i = c:\backups\folderxyz\filexyz.extension

 

most of the time it will send it  correctly but some times it wil result into

c.|backups\folderxyz\filexyz.extension

or c:|backups\folderxyz\filexyz.extension

or c.\backups\folderxyz|filexyz.extension

 

or similar results as " someone" is pressing , randomly, an "SHIFT" input that if it occurs in : to . or \ to | or . to : will make my script fail as the software wont , of course , finde any file as the given path is inconsistent

 

got any hints to know what is the reason of this abnormal random behaviour ?  got any suggestion how to solve it ( i was thinking to add some string with regex checking to match values but that will add more code and every one knows that the more line there are the higher are the bugs :D )  so maybe the autoit has some regedit strings or something to finetune its functions ?

 

regards

 

Link to comment
Share on other sites

this random shift is in Send and Control Send.

 

I use a loop with ControlSetText() to make sure the edit box gets whats coming to it in a proper fashion :)

$iAttempts = 0
    While Not(ControlGetText($hWnd, '', 'Edit1') == $sFileName )
        Sleep(250)
        $iAttempts += 1
        ControlSetText($hWnd, '', 'Edit1', $sFileName)
        If @error Then ConsoleWrite(@ScriptLineNumber & ':' & @error & @TAB & @extended & @CRLF)
        If $iAttempts >= $iRetry Then
            SetError(2,1,-1)
        EndIf
    WEnd

 

Edited by Shane0000
cant spell L-O-O-P
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...