wintech2003 Posted March 4, 2010 Posted March 4, 2010 Hi there, So I have created an autoit script (noob here, just started using it since yesterday) which grabs the hardware id from the "James Cameron's Avatar The Game" activation wizard, pastes it into the keygen, gets the activation key from the keygen and pastes it back to the activation wizard. Now the problem is that if you click "Next >" after having pasted the activation key, the Game starts and I want to close it, so that I can start if from a Game Loader. Here's my code: Run("D:\Program Files\James Cameron's AVATAR - THE GAME\bin\Avatar.exe") // Run the main executable WinWait("Activation Wizard", "", 5) // Wait 5 seconds to see if the activation wizard pops up If WinExists("Activation Wizard") Then // If it does then ... WinActivate ( "Activation Wizard" ) // ... bring it to the front ControlClick( "Activation Wizard", "", "[CLASSNN:TTntButton.UnicodeClass4]" ) // Click "Next" ControlCommand( "Activation Wizard", "Manual", "[CLASS:TTntRadioButton.UnicodeClass; INSTANCE:2]", "Check", "" ) // Check the "Manual" option ControlClick( "Activation Wizard", "", "[CLASSNN:TTntButton.UnicodeClass4]" ) // Click "Next" $hardware_id = ControlGetText( "Activation Wizard", "", "[CLASSNN:TTntEdit.UnicodeClass1]" ) // Assign a hardware_id Run("Z:\game_tools\avatar\keygen.exe") // Run the keygen WinWait("James Cameron's AVATAR™ Offline Activation Keygen - RELOADED") // Wait until it has loaded WinActivate("James Cameron's AVATAR™ Offline Activation Keygen - RELOADED") // Bring it to the front ControlSetText( "James Cameron's AVATAR™ Offline Activation Keygen - RELOADED", "", "[CLASSNN:Edit1]", $hardware_id ) // Paste the hardware_id ControlClick( "James Cameron's AVATAR™ Offline Activation Keygen - RELOADED", "Generate", "[CLASSNN:Button1]" ) // Click "Generate" $activation_key = ControlGetText( "James Cameron's AVATAR™ Offline Activation Keygen - RELOADED", "", "[CLASSNN:Edit2]" ) // Get the activation_key WinClose("James Cameron's AVATAR™ Offline Activation Keygen - RELOADED") // Close the keygen WinActivate ( "Activation Wizard" ) // Bring the activator to the front ControlSetText ("Activation Wizard", "", "[CLASSNN:TTntEdit.UnicodeClass3]", $activation_key ) // Paste the activation_key ControlClick ("Activation Wizard", "Next >", "[CLASSNN:TTntButton.UnicodeClass4]" ) // Click "Next" // Now from this point on, right after clicking Next, the Game starts loading into D3D mode. // What I want is to kill "avatar.exe", be sure that its not running any more, and then End the script. // I tried the following, but with no luck... :( WinWait("Activation Wizard") // Also tried without this... ProcessClose("Avatar.exe") ProcessWait("Avatar.exe") EndIf // I used an If / EndIf statement so that the script does not load, if the Activation Wizard does not popup. Exit So... any ideas on how to kill avatar.exe after the script has clicked Next, and be SURE that it's not running anymore, BEFORE the script ends? Thanks a lot!
JohnOne Posted March 4, 2010 Posted March 4, 2010 Im not sure your script will end while waiting for a process you just closed. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
wintech2003 Posted March 4, 2010 Author Posted March 4, 2010 Isn't there a wait-until-not-exists process monitoring function? I just want to kill the .exe and check if it's closed. If it's not, the script should wait, until it is. When it's closed, then it should end.
picea892 Posted March 4, 2010 Posted March 4, 2010 Maybe this snippet will help you run("notepad.exe") sleep(3000) ProcessClose("notepad.exe") while ProcessExists("notepad.exe") sleep(100) WEnd
AdmiralAlkex Posted March 4, 2010 Posted March 4, 2010 ProcessClose("Avatar.exe") ProcessWait("Avatar.exe") Did you really think that through? You should at least do a ProcessWait before the ProcessClose, to make sure that Avatar.exe has had time to start. And what's the point with waiting for a process to exist after you have tried to close it? You want ProcessWaitClose, or as picea showed, a loop with ProcessExists. ProcessWait("Notepad.exe") ProcessClose("Notepad.exe") ProcessWaitClose("Notepad.exe") Or for fun: Do Sleep(100) Until ProcessExists("Notepad.exe") ProcessClose("Notepad.exe") While ProcessExists("Notepad.exe") ;Two kinds of loops in the same script? Oh no! :P sleep(100) WEnd .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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