Sign in to follow this  
Followers 0
Kupo

Looping Send command

13 posts in this topic

Hey, im new to the autoit community, and just needing help with a simple script that presses the 1 key every 1.8 seconds and loops infintely

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

HotKeySet("{ESC}", "quit")

While 1
    ControlSend ( "Untitled - Notepad", "", "Edit1", "1")
    Sleep(1800)
WEnd

Func quit()
    Exit
EndFunc

Replace the "Title" and "Control ID" with your program, of course. See ControlSend, Sleep, and HotKeySet in the help file for explanations.

Edited by xcal

Share this post


Link to post
Share on other sites

There any way to make it send to active window?

im trying to make it just hit 1 over and over every 1.8 sec on a game window called CABAL, i just changed the notepad, untitled to the window name right? its not working.. maybe active window will work?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try...

HotKeySet("{ESC}", "quit")

While 1
    WinWaitActive("Untitled - Notepad") ;Replace with CABAL I suppose.
    Send ("1")
    Sleep(1800)
WEnd

Func quit()
    Exit
EndFunc

See Send and WinWaitActive in the help file.

edit - you can remove WinWaitActive("Untitled - Notepad") if you don't care if "1" is sent all willy nilly to anything. Really, though, look in the help file. It's one of the best I've ever seen.

Edited by xcal

Share this post


Link to post
Share on other sites

Hi,

although might have a look at TimerDiff(), it is more exactly then Sleep(...)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

does it have to be on the task list of task manager to run auto it

its a very strange startup for this game, you login from a website and it loads the game off the IE page, and i cant find it in processes or task list, but it does show on the start bar

BTW it still does not work after using the modified script, i think most likely due to its not an actuall process or somthing, im lost from here

Edited by Kupo

Share this post


Link to post
Share on other sites

Hi,

is it a browser game or a Java Webstart oder Java Applet game?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

That script diddnt work either.. i can also right click to do the same thing, i dunno if that helps

its basicly you login to cabaonline.com, download the game (500mb dl), then later you can login again and click play game, this loads the game somhow from the website, very odd

Share this post


Link to post
Share on other sites

Well ya, that wouldn't work either, since the pause isn't your problem. :P

I'm still learning autoit myself, so I'll sit back and see if anyone else can give you a hand. :nuke:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hotkeyset("^q","ExitProgram")
AdLibEnable("Spammer",1800)
While 1
WEnd

Func ExitProgram()
 Exit
EndFunc

Func Spammer()
;~  If WinActive("Cabal") = 1 Then
        Send("{1}")
;~  Endif
EndFunc

;~ <== that is a quote btw

Press CTRL+Q to exit, worked fine when I tested it, just remove quotes and change title name to whatever the Cabal title is (Exactly?) and it should only send there.

Edited by Rad

Share this post


Link to post
Share on other sites

AdLibEnable() isn't as accurate as using TimerDiff() in a loop. I did a test and it has the same variance as Sleep() did. Mind you, it's splitting hairs. :P

Share this post


Link to post
Share on other sites

Hi! Unfortunatly i'm totally noob in scripting and in AutoIt too :) i have almost the same problem like the topic opener. I need a script what is pressing a key or do a right click in the game cabal.I tried the sample what you are wrote here,but didn't work :P The application name is CABAL.Thanks your time and your help.

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