blazekjc Posted November 28, 2007 Share Posted November 28, 2007 I am new to scripting but the program am i trying to create is rather simple. Basicly all i want is to maximize the program, then start a loop that does this.... hit Tab key Sleep (2000) hit number 3 key Sleep(10000) hit number 1 key then repeat... I have little / no experiance with autoit, is there anyone that could write this script really fast or help me with it. Link to comment Share on other sites More sharing options...
eldara Posted November 28, 2007 Share Posted November 28, 2007 I am new to scripting but the program am i trying to create is rather simple.Basicly all i want is to maximize the program, then start a loop that does this....hit Tab keySleep (2000)hit number 3 keySleep(10000)hit number 1 key then repeat...I have little / no experiance with autoit, is there anyone that could write this script really fast or help me with it.im not sure how do maximise the window but the other steps are ok,just doSend("{tab}")sleep(2000)Send("3")sleep("10000")Send("1")There is probably an easy way to loop it, im not sure only found out about this yesterday sorry if im no help Link to comment Share on other sites More sharing options...
SadBunny Posted November 28, 2007 Share Posted November 28, 2007 Check WinSetState() and it's helpfile, it will allow you to maximize a window (or perform other window operations). For infinite looping, try: While 1 Send("{tab}") sleep(2000) Send("3") sleep("10000") Send("1") WEnd (Note: you might want to add another Sleep() after sending "1" otherwise the "{TAB}" send might come too quickly.) Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
blazekjc Posted November 29, 2007 Author Share Posted November 29, 2007 (edited) OK i got the program going good but there is a one problem. I am trying to use the program inside the .exe file that is running but for somereason the script always pauses when the .exe file is maximized then when i go back to the desktop it starts again. Is there any way i can run this simple program while the file is maximized??? Edited November 29, 2007 by blazekjc Link to comment Share on other sites More sharing options...
AlmarM Posted November 29, 2007 Share Posted November 29, 2007 WinSetState("YourProgram", "", @SW_MAXIMIZE) Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
blazekjc Posted November 29, 2007 Author Share Posted November 29, 2007 WinSetState ( "Archlord", "", @SW_ENABLE) WinSetState ( "Archlord", "", @SW_MAXIMIZE) Sleep (5000) Send ("{TAB}") Sleep (2000) Send ("{3}") Sleep (9000) this is what i have.. i plan to loop the bottom part but i need to get it working first. Not sure what i did wrong but the program does not maximize and the script always stops when then program is maximized. Link to comment Share on other sites More sharing options...
AlmarM Posted November 29, 2007 Share Posted November 29, 2007 WinSetState ("Archlord", "", @SW_ENABLE) WinSetState ("Archlord", "", @SW_MAXIMIZE) While 1 Sleep (5000) Send ("{TAB}") Sleep (2000) Send ("{3}") Sleep (9000) WEnd Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
blazekjc Posted November 30, 2007 Author Share Posted November 30, 2007 I tried exactly what you put, When i run the script the program never maximizes and it still isnt enabled, like the script will pause when it maximized. I dont think either of the WinSetState lines are working right. No idea why maybe this should be different ("Archlord", "", ??? Not sure if this will help but the path is C:\Program Files\Codemasters\Archlord.exe and it just says Archlord on the bar on the desktop. WinSetState ("Archlord", "", @SW_ENABLE) WinSetState ("Archlord", "", @SW_MAXIMIZE) While 1 Sleep (5000) Send ("{TAB}") Sleep (2000) Send ("{3}") Sleep (9000) WEnd Link to comment Share on other sites More sharing options...
schilbiz Posted November 30, 2007 Share Posted November 30, 2007 Minimize the App, hold your mouse over it on your taskbar, whatever the name of the App says is the name you need to input into the code, use sleep at the top of your code so you have time to highlight the app. Once you execute the script make sure to highlight the game app and then wait 3-5 seconds and it should work. Sleep(5000) WinSetState ("Name Here", "", @SW_ENABLE) WinSetState ("Name Here", "", @SW_MAXIMIZE) While 1 Sleep (5000) Send ("{TAB}") Sleep (2000) Send ("{3}") Sleep (9000) WEnd PS: Devs are getting better at detecting scripts like this, use at your own risk. Link to comment Share on other sites More sharing options...
blazekjc Posted November 30, 2007 Author Share Posted November 30, 2007 No it didnt work :-( Link to comment Share on other sites More sharing options...
schilbiz Posted November 30, 2007 Share Posted November 30, 2007 No it didnt work :-(I tried exactly what I showed you on a few different apps and it worked fine, you need to make sure the name is exactly the same, caps, symbols, spaces etc..If you put the Sleep(5000) on top you wouldn't need the Maximize function if you just enter the game, the script will execute on the active window after 5 seconds. Link to comment Share on other sites More sharing options...
schilbiz Posted November 30, 2007 Share Posted November 30, 2007 You can try this, Sleep(5000) WinSetState ("Name Here", "", @SW_ENABLE) WinActivate("Name Here", "") WinSetState ("Name Here", "", @SW_MAXIMIZE) While 1 Sleep(5000) Send("{TAB}") Sleep(2000) Send("{3}") Sleep(9000) WEnd Link to comment Share on other sites More sharing options...
blazekjc Posted December 2, 2007 Author Share Posted December 2, 2007 No this does nothing still... i dont know how u got this to work but for some reason it doesnt for me. I did exactly what you said . Im on vista,, Link to comment Share on other sites More sharing options...
schilbiz Posted December 2, 2007 Share Posted December 2, 2007 No this does nothing still... i dont know how u got this to work but for some reason it doesnt for me. I did exactly what you said . Im on vista,, Put this at the top of your code. #RequireAdmin Link to comment Share on other sites More sharing options...
blazekjc Posted December 3, 2007 Author Share Posted December 3, 2007 Thanks it works !!! finally ty so much Link to comment Share on other sites More sharing options...
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