Jump to content
Sign in to follow this  
cjetalaD

Simple question :)

Recommended Posts

cjetalaD

Hi, I just wrote my first script in AI (Suitable acronym? :)) and it is currently triggered by NumLock, and stopped by / key next to it. I was wondering if thre is a way to toggle it with Spacebar, or use Mousewheel up/down, or Mouse4/5 to trigger it?

Thanks in advance :)

Edited by cjetalaD

Share this post


Link to post
Share on other sites
poisonkiller

Could you post your script please?

Share this post


Link to post
Share on other sites
cjetalaD

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.9
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

dim $num

$num = 10

HotKeySet("{NUMLOCK}", "Start")
Hotkeyset("{NUMPADDIV}", "Stop")
HotKeySet("{NUMPADMULT}", "Close")

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate("Bunnyhopper", 200, 48)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState(@SW_SHOW)

While 1
  Sleep(1000); Idle around
WEnd

Func Close()
  Exit
EndFunc

Func Start()
    $num = 10
    Do 
    Sleep(25)
    Send("{SPACE}")
    Until $num = 5
EndFunc

Func Stop()
    $num = 5
EndFunc

Edited by cjetalaD

Share this post


Link to post
Share on other sites
cjetalaD

Is there anyway to toggle using spacebar?

Share this post


Link to post
Share on other sites
poisonkiller

For Start() function, don't start sending {SPACE} when it's still a hotkey.

Func Start()
    $num = 10
    HotKeySet("{SPACE}")
    Do
    Sleep(25)
    Send("{SPACE}")
Until $num = 5
HotKeySet("{SPACE}", "Start")
EndFunc

EDIT: Yes, HotKeySet("{SPACE}", "Start") should be it.

Edited by poisonkiller

Share this post


Link to post
Share on other sites
cjetalaD

Another quick one, I'm trying to get the value from the input box to be assigned to the speed varaible, saving me having to recompile, I've read the online help, still having trouble getting it to work though :)

EDIT: The code, of course:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.9
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

dim $num
dim $time

$num = 10
$time = 50

;HotKeySet("{NUMLOCK}", "Start")
HotKeySet("{SPACE}", "Start")
Hotkeyset("{NUMPADDIV}", "Stop")
HotKeySet("{NUMPADMULT}", "Stop2")
HotKeySet("{NUMPADSUB}", "Close")

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate("Bunnyhopper", 180, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUICtrlCreateLabel("SpaceBar to Enable.", 30, 10)
GUICtrlCreateLabel("* then \ to Disable.", 30, 25)
GUICtrlCreateLabel("- to Close.", 30, 40)
$input = GUICtrlCreateInput("", 30, 60)
$ok = GUICtrlCreateButton("OK", 100, 58, 60)
GUICtrlRead($input, 1)
GUICtrlSetOnEvent($ok, "Ok")
GUISetState(@SW_SHOW)

Func Ok()
$time = $input
EndFunc

While 1
  Sleep(1000) ; Idle around
WEnd

Func Close()
  Exit
EndFunc

Func Start()
    $num = 10
    HotKeySet("{SPACE}")
    Do
    Sleep($time)
    Send("{SPACE}")
Until $num = 5
EndFunc

Func Stop()
    $num = 5
    HotKeySet("{SPACE}", "Start")
EndFunc

Func Stop2()
    $num = 5
EndFunc
Edited by cjetalaD

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  

×