Sign in to follow this  
Followers 0
Drew

User Defined Hotkey

7 posts in this topic

I'm trying to set my program to allow users to define their own hotkeys.

I'm unsure as to how to go about this.

Is there a UDF made or some way of going about this?

Share this post


Link to post
Share on other sites



; Press Esc to terminate script, Pause/Break to "pause"
$pausekey = "{PAUSE}"
$exitkey = "{ESC}"
$showmessagekey = "+!d" ;Shift-Alt-d

Global $Paused
HotKeySet($pausekey, "TogglePause")
HotKeySet($exitkey, "Terminate")
HotKeySet($showmessagekey, "ShowMessage")

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

Have a look in example scripts too. I have seen a few floating about there.... :)

Share this post


Link to post
Share on other sites

I'm not sure how that works... I would still have to put the hotkey in the script.

I need users to be able to set their own hotkey , WITHOUT being able to edit the source.

I'm thinking , going by your example , $showmessagekey = input box blah blah..

but what about the users who don't understand what to enter there , therefore fudging the script all together...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Excuse me? I greatly appreciate your help, so please don't let this offend you...

BUT... I have been pondering and trying things for the last 45 minutes. And Yes, I took your advice, and ever since I posted my last response I have been using the search tool searching the Example forum for anything with the word "hotkey" in it.

So please... Do not make an opinion about me without knowing what I have and have not done.

Does anyone try anything around here anymore,

To answer your question, Yes. There are still a few of us who , yes need help, but also like to do things on our own when we can.

Edit:

Excuse my rant , I forgot to Thank you for the link. Thanks.

Edited by Drew

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

I made one a week ago, but didn't post ot. Here it is: http://www.autoitscript.com/forum/index.php?showtopic=72588


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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