Sign in to follow this  
Followers 0
GeekOrGuru

EMERGENCY! In A Bind!

7 posts in this topic

#1 ·  Posted (edited)

Trying to restore a NAS server from a backup. Somehow there are at least two encryption keys on the backup set. Trying to create a script that will cycle between the two keys until the restore is complete. Essentially need it to loop between the two keys every time the window becomes active.

I know this is bad form to not spend more time learning and trying things on my own, but I'm really in a bind here to get this done!

I've tried the While, WEnd statements, but never really used them before and don't understand what I was doing wrong. I essentially got caught in an endless loop and couldn't get out!

Please help!

Stronghold Script.au3

#region --- Internal functions Au3Recorder Start ---

Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc

#endregion --- Internal functions Au3Recorder End ---

_WinWaitActivate("Encrypting Key Request","")
Send("password1")
MouseClick("left",382,435,1)
Send("password2")
MouseClick("left",382,435,1)

;;I need a loop in here that cycles back and forth between the two passwords each time the window becomes active.
;;I also need a way to manually break the loop incase neither password/key works...so something else can be tried.
Edited by GeekOrGuru

Share this post


Link to post
Share on other sites



HotKeySet("{ESC}", "_exit")
;This way, when you press {ESC} the script will call the function _exit
;This supercedes current loops

Func _exit()
;Exits the script
Exit
EndFunc

While 1
WinWaitActive("Encrypting Key Request")

Send("password1")
MouseClick("left",382,435,1)

Send("password2")
MouseClick("left",382,435,1)

;I assume that instead of sending a mouseclick you could press ENTER instead?
;Send("{ENTER}")
WEnd

Could this work?


Share this post


Link to post
Share on other sites

Thanks BoonPek!

I'll give it a shot in a minute as soon as it calls for another password/key. This is close to what I had before, but like I said...I got caught in an endless loop with no way out!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I don't see what the while loop in your script. Even if you don't have a condition to escape the while loop, you can still kill it through the tray icon or the task manager. Also if you have a while loop waiting for something generally it is good to put a sleep(10) so it doesn't eat your cpu.

There is no such thing as an emergency, we are all in the same place when we die.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

Thanks BoonPek!

I'll give it a shot in a minute as soon as it calls for another password/key. This is close to what I had before, but like I said...I got caught in an endless loop with no way out!

This time, if you want to escape the script simply press the ESC key.

Mr. Dictator here has good tips too. Thank you!


Share this post


Link to post
Share on other sites

I don't see what the while loop in your script. Even if you don't have a condition to escape the while loop, you can still kill it through the tray icon or the task manager. Also if you have a while loop waiting for something generally it is good to put a sleep(10) so it doesn't eat your cpu.

There is no such thing as an emergency, we are all in the same place when we die.

I'll try the sleep.

But, I don't know what happened, but <Break> nor <Cntrl><C> worked to stop the script earlier. I could move my mouse and it would immediately return to the "MouseClick" zone. I would up remoting into my own system via LogMeIn and got it killed that way. WACKY!

Share this post


Link to post
Share on other sites

ctrl+c is to stop batch scripts unless you told Autoit to override it, and autoit is a different world than batch. I don't know anything about "<break>" , the rest of what you said I have no clue what you are saying.

Stop Panicking.

(disclaimer: I had way to much mead wine with dinner and probably blew up my liver, so take may useless advice with caution.)

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
Sign in to follow this  
Followers 0