Jump to content

Scrip request/help


Recommended Posts

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'

Link to comment
Share on other sites

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

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
Link to comment
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 :)

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