Jump to content

Very Simple Script help


Recommended Posts

anyone please give me a very simple script i cant do it myself im too noob at autoit i might aswell learn something from it :D

anyway the script i want it to press "Z" every 0.1 sec in a loop and i want to have a "F12" hotkey to start and stop it

im sure its very easy to make its short and simple but i just cant get the damn commands right i tried to do it myself

Link to comment
Share on other sites

see this command :

Send

--------------------------------------------------------------------------------

Sends simulated keystrokes to the active window.

and :

While...WEnd

--------------------------------------------------------------------------------

Loop based on an expression.

Link to comment
Share on other sites

Also See:

HotKeySet

Sleep

Also, look at my sig for a simple tutorial on starting with AutoIt! (Credit to Valuater)

#)

Edit: Here is the link: http://www.autoitscript.com/forum/index.php?showtopic=21048

Edited by nfwu
Link to comment
Share on other sites

Have a look at This tutorial you will learn a lot from it.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

HI,

have a start with:

HotKeySet("{F11}", "_run"); change to F12 ...
HotKeySet("{ESC}", "end")

Global $status = 0

While 1
    Sleep(10)
WEnd

Func _run()
    If $status = 0 Then
        $status = 1
    ElseIf $status = 1 Then
        $status = 0
    EndIf
    While $status
        Send("Z")
        Sleep(100)
    WEnd
EndFunc ;==>_run

Func end()
    Exit(0)
EndFunc

Edit: It isn't 100 % correct, because the sleep(100) could be a bit ... ! If you need it exactly every 100ms you should have to deal with TimerInit.

So long,

Mega

Edited by th.meger

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

Link to comment
Share on other sites

  • Moderators

i know all those commands but i have no idea how to structure them i get an error every time

here is what i tried to do :

HotKeySet ("F12" [, "Pause"] )

While
    WinActive("MapleStory")
WEnd

Sleep(100)
Send ("Z")
Remove the "[" "]" brackets, those only show you that something (a parameter) is optional.

HotKeySet ("{F12}" , "Pause")

While 1;Need something here other than blank or 0
;WinActive("MapleStory")
    Sleep(100)
WEnd

Func Pause()
   MsgBox(0, '', 'You made it to the pause function')
EndFunc
Also use curly brackets "{" "}" around your "hotkey buttons like Fxnumber and Insert/Pause/etc..

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Time for a break down! zzz~

HotKeySet("{F12}", "_Stop") ;;If you press {F12}, it calls the function _Stop

Global $notstop = 1 ;;Create a variable called $notstop.

while $notstop = 1 ;;While $notstop is equal to 1,
   Sleep(100) ;;wait for 100 milliseconds
   Send("z") ;; send the z keystroke
wend
Exit ;;Quit application

Func _Stop() ;;Control would come here if you press {F12}, because of the HotKeySet in the first line.
   $notstop = 0 ;;Set $notstop to 0, which would cause the while loop to terminate.
EndFunc

#)

Link to comment
Share on other sites

HI,

@nfwu: Your solution has no loop. It starts only one time and then it could be stopped. That's it.

But maybe that's what he/she wants. :D

So long,

Mega

So, it is on you Nefarious9, to tell us, what fits your needs. :D

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...