Sign in to follow this  
Followers 0
blazekjc

New to autoit NEED HELP PLEASE

15 posts in this topic

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.

Share this post


Link to post
Share on other sites



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.

im not sure how do maximise the window but the other steps are ok,

just do

Send("{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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by blazekjc

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

No it didnt work :-(

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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,,

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Thanks it works !!! finally ty so much

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