Sign in to follow this  
Followers 0
Alvin1991

Scrip request/help

8 posts in this topic

Well, I tried searching for it, but I don't seem to find what I need, or probably I just skipped it.. x.x;

I'm just wondering, how do I add a Start/Stop Command to the scrip? Erm, I'm pretty new at using this.

I'm using Autoit-v3

I.E.

I run the scrip, it doesn't run yet, until I press "Home"(As if I was to set this as start)

Then the scrip starts running,

Then when I press "End"(As if I was to set it to stop/pause)

Basically, I'm trying to make it press F1 and left click.

With a start/stop button. x_x'

Share this post


Link to post
Share on other sites

Welcome to AutoIt.

Look here

Ah, thanks, I'll take a good look at it.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You'll need to take a look at "HotKeySet()"

Something like this:

;Set hotkeys:
HotKeySet("{home}","start")
HotKeySet("{end}","stop")

;Idle around..
While 1
    Sleep(25)
WEnd

;Functions:
Func start()
    MsgBox(0,"","Now your script started working!")
EndFunc
Func stop()
    MsgBox(0,"","Now your script stopped working!")
EndFunc
Edited by Nahuel

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You'll need to take a look at "HotKeySet()"

Something like this:

;Set hotkeys:
HotKeySet("{home}","start")
HotKeySet("{end}","stop")

;Idle around..
While 1
    Sleep(25)
WEnd

;Functions:
Func start()
    MsgBox(0,"","Now your script started working!")
EndFunc
Func stop()
    MsgBox(0,"","Now your script stopped working!")
EndFunc
I did something very similar like that, but I probably had the HotKeySet part setted wrong, thanks for your example.

Ok, when I insert this:

HotKeySet("{home}","start")

HotKeySet("{end}","stop")

It always erro me, and say it is a unknown command.

Edited by Alvin1991

Share this post


Link to post
Share on other sites

I did something very similar like that, but I probably had the HotKeySet part setted wrong, thanks for your example.

Ok, when I insert this:

HotKeySet("{home}","start")

HotKeySet("{end}","stop")

It always erro me, and say it is a unknown command.

well of course:

HotKeySet(Key , Function)

start and stop are functions that I defined:

;Functions:
Func start()
    MsgBox(0,"","Now your script started working!")
EndFunc
Func stop()
    MsgBox(0,"","Now your script stopped working!")
EndFunc

The help file has more examples and detailed information :)

Share this post


Link to post
Share on other sites

Ok, I did everything right so far I think?

But when I press "End"(Stop) it doesn't stop?

is it suppose to be pause instead?

Share this post


Link to post
Share on other sites

You have to put inside the start function whatever you want to do, so when you press "Home" it will call 'start()' and your script will start working.

Another example:

HotKeySet("{pause}","TogglePause")
HotKeySet("{home}","Start")
HotKeySet("{end}","Stop")

Global $Paused

While 1
    Sleep(25)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc
Func Start()
    While NOT $Paused
        ToolTip(@HOUR&":"&@MIN&":"&@SEC,0,0,"Current time")
        Sleep(1000)
    WEnd    
EndFunc
Func Stop()
    ToolTip("bye bye!",0,0,"Current time")
    Sleep(1000)
    Exit
EndFunc

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