Sign in to follow this  
Followers 0
AndreiVorcea

Hi

9 posts in this topic

#1 ·  Posted (edited)

im new in auto it and i want a litle help on my script

how can i put the function in endless loop ore return until exit key is presed

HotKeySet("{F10}", "first")
HotKeySet("{F8}", "ExitScript")

While 1
    Sleep(100)
WEnd

Func first()
Send("SPACE DOWN")
Sleep(160)
Send("SPACE UP")
EndFunc

Func ExitScript()
    Exit
EndFunc

thnx in advance for help

Edited by AndreiVorcea

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Global $Should_i_Run = False;this line ($Should_i_Run is just example name that you can change to anything else if needed)
HotKeySet("{F10}", "TurnOn");this line
HotKeySet("{F8}", "ExitScript")

While 1
    Sleep(100)
    If Should_i_Run Then first();this line
WEnd

Func TurnOn();and this func
    Should_i_Run = True
EndFunc
 
Func first()
    Send("SPACE DOWN")
    Sleep(160)
    Send("SPACE UP")
EndFunc

Func ExitScript()
    Exit
EndFunc

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

i dont want the while to loop,only the func part

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

"while" is "the loop" but regardless of that...

...you can add any loop inside func itself, you have 2 more loop options that arnt "while" loops, they are "do untill" and "for to next" loops, look in help file for more info.

the other way (that i dont see why anyone shud use) is recursion (google it if you need to c what recursion is) but i dont see any point of anyone using infinite func call inside itself with some exit case just for the sake of looping, it's bad to do it that way.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Global $Should_i_Run = False;this line ($Should_i_Run is just example name that you can change to anything else if needed)
HotKeySet("{F10}", "Toggle");this line
HotKeySet("{F8}", "ExitScript")

While 1
    Sleep(100)
WEnd

Func Toggle();and this func
    $Should_i_Run = Not $Should_i_Run
    While $Should_i_Run
        Send("SPACE DOWN")
        Sleep(160)
        Send("SPACE UP")
    WEnd
EndFunc   ;==>TurnOn

Func ExitScript()
    Exit (0)
EndFunc   ;==>ExitScript


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)

this one works nicely, what comand shold i use instead of

Send("SPACE DOWN") to keep pressed the space button for 500 miliseconds? not only send one impulse every 500 milisecond
Edited by AndreiVorcea

Share this post


Link to post
Share on other sites

Try using Opt('SendKeyDownDelay', 500)


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

i used Send("{SPACE DOWN}") instead of

Send("SPACE DOWN") and works like a charm!

Xx Code~Mega xX u made my day,thnx!

Share this post


Link to post
Share on other sites

Glad I could help.


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

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