Jump to content

Recommended Posts

Posted

i'm gd in java but i have never touched anything related to scripts so pls help me. What i need is a very simple script. here it goes.

do all commands below on ge.exe [ assume ge.exe is already running ]

press space

30 secs passed

press control and space together

30 secs passed

infinite loop

Posted

Take a look at the help file. Search for send (), sleep(), and while.

is this correct? without the loop.

Send("ge.exe{SPACE}")

Sleep(20000) ;twenty seconds

Send("ge.exe{^SPACE}") // press control and space together

Sleep(20000) ;twenty seconds

Posted

get rid of the ge.exe in the send commands. If you want it to just send to ge.exe, then you need to use controlsend (window title, keys). But as long as ge.exe is the active window it should work.

Posted (edited)

i do not understand (and i'm quite rushing for time)

this is my latest version

i want this script to work whether ge.exe is minimised or active

While(True)

Send("ge.exe{SPACE}")

Sleep(1000) ;1seconds

Send("ge.exe{CTRLDOWN}")

Send("ge.exe{SPACE}")

Send("ge.exe{CTRLUP}")

Sleep(1000) ;1seconds

WEnd

Edited by scg
Posted

if you wnat it to work even if its not active then you need to use controlsend and the title of the window to send to.

is it like this?

i do not konw what text and controlID parameters are for though i read the help file

While(True)

ControlSend("ge.exe", "", "", "{SPACE}")

Sleep(2000) ;2 seconds

ControlSend("ge.exe", "", "", "{CTRLDOWN}")

ControlSend("ge.exe", "", "", "{SPACE}")

ControlSend("ge.exe", "", "", "{CTRLUP}")

Sleep(2000) ;2 secs

WEnd

Posted (edited)

I really think you need to look at and run the examples. First you need to use the Run command to open ge.exe, then you need to possibly use WinWait. You'll need the name of the window and, optionally any text in the window. Then you'll need the control IDs in the window, which you'll need to use the AutoIt Window Info program to find.

Edited by GMK
Posted

I really think you need to look at and run the examples. First you need to use the Run command to open ge.exe, then you need to possibly use WinWait. You'll need the name of the window and, optionally any text in the window. Then you'll need the control IDs in the window, which you'll need to use the AutoIt Window Info program to find.

firstly, this program assumes ge.exe is already running. its a game. so how am i supposed to find the name of the window? the application is just ge.exe. control id? whats that. i read it but i have no idea what is does. pls help tks.

Posted (edited)

Maybe try this:

If the game is fullscreen just comment out WinActivate

Send only sends keystrokes to the active window

Once your game is running hit Shift-Alt-d to trigger event

;Swap out ge.exe for the window title i.e. "Notepad"
;WinActivate ( "ge.exe")

HotKeySet("+!d", "automate")  ;Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func automate()
While 1

Send("{SPACE}")

;Wait 1 second
Sleep(1000) ;1seconds
Send("{CTRLDOWN}")
Send("{SPACE}")
Send("{CTRLUP}")

;Wait 1 second
Sleep(1000) 

WEnd
EndFunc
Edited by weaponx
Posted

Going by the first post, perhaps this would work best:

;Swap out ge.exe for the window title i.e. "Notepad"
;WinActivate ( "ge.exe")

HotKeySet("+!d", "automate")  ;Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func automate()
   While 1
      Send("{SPACE}") ;Press SPACE
      Sleep(30000) ;Wait 30 seconds
      Send("^{SPACE}") ;Press CTRL-SPACE
      Sleep(30000) ;Wait 30 seconds
   WEnd
EndFunc

GMK, your first one ( that you replaced ) as well as weaponx's and mine all doesn't really work. All of them have the same problem

The problem is that once i maximise the game, one of the commands will be activated in the game (e.g space or ctr space)

After which nothing will happen after that. the loop is still obviously running, cos when i minimise the game, i can see those commands still periodically being activated, but when i maximise the game the script simply has no effect at all.

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
×
×
  • Create New...