Jump to content
Sign in to follow this  
omiden

Toggle On/Off Keys How? [ERROR Help]

Recommended Posts

omiden

Please read my last post below!

How would I add a toggle on/off key to this code, so when u hit like f3 its on then f4 off?

Also is there a keynumber for scrollwheel?

#include <Misc.au3>

$dll = DllOpen("user32.dll")
$ExitKey = '1B'; ESC

While 1
    Sleep(10)
    If _IsPressed("01", $dll) Then MouseMove(215, 485, 50)
    If _IsPressed($ExitKey, $dll) Then ExitLoop
    WEnd
    
    DllClose($dll)
Edited by omiden

Share this post


Link to post
Share on other sites
evilertoaster

Look at HotKeySet() in the helpfile.

Share this post


Link to post
Share on other sites
omiden

Look at HotKeySet() in the helpfile.

Thank you I will search

Share this post


Link to post
Share on other sites
omiden

Ok I read up on it and this is what I got but I get a error.

#include <Misc.au3>

$dll = DllOpen("user32.dll")
$ExitKey = '75'; ESC
HotKeySet ( "BD" [, "On"] )
HotKeySet ( "BB" [, "Off"] )



Func On()
While 1
    Sleep(10)
    If _IsPressed("01", $dll) Then MouseMove(640, 518, 100)
    If _IsPressed($ExitKey, $dll) Then ExitLoop
    WEnd
    
    DllClose($dll)
EndFunc

Func Off()
    While 1
    Sleep(10)
    If _IsPressed("01", $dll) Then MouseMove(0, 0, 0)
    If _IsPressed($ExitKey, $dll) Then ExitLoop
    WEnd
    
    DllClose($dll)
    EndFunc

Errors

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\***\Desktop\recoil.au3"    
C:\Users\***\Desktop\recoil.au3 (5) : ==> Error parsing function call.:
HotKeySet ( "BD" [, "On"] )
HotKeySet ( "BD" ^ ERROR
>Exit code: 1    Time: 0.212

Share this post


Link to post
Share on other sites
XxShadowxX

The brackets stand for optional arguments, they should not be in your actual script.

Those two lines should look like:

HotKeySet ( "BD" , "On")
HotKeySet ( "BB" , "Off")

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.