Jump to content
Sign in to follow this  
Cherenkov

Issue with If condition

Recommended Posts

Cherenkov

Hi,

#include <MsgBoxConstants.au3>
#include <file.au3>
HotKeySet("{PAUSE}", "Terminate")
Func Terminate()
    Exit
EndFunc
$file=FileOpenDialog("Count lines","@directory","All files (*.*)")
$lines = _FileCountLines($file)
$y=97;
$x="Generate"
MouseClick("left",1400,560,1)
While $y <= 97
   $z=97;
   While $z<=122

         sleep(1000)
         send("{LSHIFT DOWN}")
         send("{TAB DOWN}")
         sleep(200)
         send("{LSHIFT UP}")
         send("{TAB UP}")
         sleep(200)
         send("^a")
         sleep(200)
         send($x)
         sleep(200)
         send(Chr($y));
         sleep(200);
         send(Chr($z));
         sleep(200);
         $z=$z+1;
         send("{TAB}")
         sleep(200)
         send("Passcode")
         sleep(200)
         send("{ENTER}")
         sleep(1000)

   $v=PixelGetColor(1400,700)
   $k=PixelGetColor(1400,385)

      If $v==4737096 Then

         send("{ENTER}")
         sleep(2000)
      ElseIf $v==3156000 Then
         send("{ENTER}")
         sleep(2000)
         send("{LSHIFT DOWN}")
         send("{TAB DOWN}")
         sleep(200)
         send("{LSHIFT UP}")
         send("{TAB UP}")
         sleep(200)
         send("^a")
         sleep(200)
         send("Debug")
         sleep(200)
         send(Chr("a"));
         sleep(200);
         send(Chr("a"));
         sleep(200);
         $z=$z+1;
         send("{TAB}")
         sleep(200)
         send("Passcode")
         sleep(200)
         send("{ENTER}")
         sleep(1000)
         send("{ESC}")
         sleep(500)
         MouseClick("left",1400,655,1)
         sleep(1000)
      Else
         $lines=$lines+1
         sleep(100)
         FileWriteLine ($file,$x & Chr($y) & Chr($z))
         sleep(100)
         send("{ESC}")
         sleep(500)
         MouseClick("left",1400,655,1)
         sleep(1000)
      EndIf


   WEnd
   $y=$y+1;
   sleep(5000)
WEnd

FileClose($file);

Everything was working fine before I added the ElseIf. I had the same problem when I first had a If and ElseIf. I transformed the ElseIf into a Else but now I need to add a ElseIf when a bug happens to solve it. I wonder what I am doing bad? :(

Edited by Cherenkov

Share this post


Link to post
Share on other sites
MikahS

What is the it that you are trying to automate? Maybe we can suggest a better way of accomplishing the task you are trying to do.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Cherenkov

What is the it that you are trying to automate? Maybe we can suggest a better way of accomplishing the task you are trying to do.

I lost an account name but I know the beginning. There's only two letters at the end I don't know (it was randomly generated by me but it didn't write down the name in a text file due to admin restriction). I also know the password. I need to try 24*24 possibilities... 

I just need to figure out how the If ... Then ElseIf ... Then IfEnd works. 

Edited by Cherenkov

Share this post


Link to post
Share on other sites
MikahS

I would just make the Else an Elseif and check for -1 as that is the return of PixelGetColor for a failure.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Jos

I lost an account name but I know the beginning. There's only two letters at the end I don't know (it was randomly generated by me but it didn't write down the name in a text file due to admin restriction). I also know the password. I need to try 24*24 possibilities... 

Let's not discuss anything to looks like a brute force attack.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×