Sign in to follow this  
Followers 0
i386

Configurable HotKeySet

8 posts in this topic

I was wondering if there is any possible way to have a 'configurable' HotKey.

Say, like in a game or in another program (ie: Microsoft Word) the HotKey is set but the User can change the HotKey if they would like. Is there anyway that this could be done and then saved to a file, say an .ini file and recalled for later?

If this has already been done and I missed it, then I am sorry for this post and taking up anyones time. I searched the help file for AutoIt and the Forums, but I didn't find anything close to what I am looking for.

If you would like to see an example of what I am talking about, let me get the GUI for the configuration settings finished and then I will post the code.

Thanks again!!


"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor"Mess with the best, die like the rest!!" -Hackers"This above all to thine own self be true." -William Shakespeare"Corruption is only as corrupted as the individual makes it out to be." -Mozart_ONLINECheck out this free 1 GB FTP website at DriveHQ.com. You can control the users and even publish a website for free!![s]Your-Start.com - A online website that you can customize to hold all you links, news information, and other website info.[/s]

Share this post


Link to post
Share on other sites



Hi,

yes that is possible. You can save the value of the key of hotkey in a variable. But some keys need {} around.

Try this for a-z and 0-9

$var = 1
check()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        Sleep(100)
    ToolTip("Hotkey is: " & $var)
Wend

Func check()
    HotKeySet($var)
    $var = InputBox("", "Hotkey : ", 1)
    HotKeySet($var, "test")
EndFunc   ;==>check

Func test()
    MsgBox(0, "Info", "Did it")
    check()
EndFunc   ;==>test

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is my first script for Execute():

$INI_file = @ScriptDir&"\"&"Test.ini"
HotKeySet( "{ESC}" , "function" )
While 1
    Sleep( 1000 )
WEnd

Func function()
    If MsgBox( 4 , "AutoIt Hotkey" , "Change function?"&@Lf&"Click Cancel if you want to execute" ) = 6 Then
        IniWrite( $INI_file , "function" , "lines" , inputbox( "Enter Command" , "only one comand with no variables" , 'ConsoleWrite( "@@ Testing @@"&@LF )' , '' , 200 , 100 ) ) 
    Else
        AutoItString_Run($INI_file)
    EndIf
EndFunc


Func AutoItString_Run( $P_INIFile )
    $L_read = IniRead( $P_INIFile , "function" , "lines" , '-1' )
    If String( $L_read ) == '-1' or String( $L_read ) == '0' Or @error Then
        Return
    Else
        ConsoleWrite( "-- >> Execute= {"&Execute( $L_read )&"} |||  {Error=" & @error & " }" & @LF )
    EndIf
EndFunc
Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

Thanks for the help....but not exactly what I am looking for.

Looking for more like Microsoft Office or like what you can do with an desktop shortcut icon in Microsoft Windows.


"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor"Mess with the best, die like the rest!!" -Hackers"This above all to thine own self be true." -William Shakespeare"Corruption is only as corrupted as the individual makes it out to be." -Mozart_ONLINECheck out this free 1 GB FTP website at DriveHQ.com. You can control the users and even publish a website for free!![s]Your-Start.com - A online website that you can customize to hold all you links, news information, and other website info.[/s]

Share this post


Link to post
Share on other sites

$keyname = InputBox("ladeeda", "what would you like your hotkey to be?")

Hotkeyset($keyname, "main")

While 1
sleep(1000)
WEnd

Func main()
EndFuncoÝ÷ ÚX¤zØZ¶åÊ+p¢é]«Þ¶+×­¡©â&§v)¡¢ºânW¶ØZ¶Ü©ày«­¢+Ù!½Ñ­åÍÐ ÀÌØí­å¹µ°ÅÕ½Ðíµ¥¸ÅÕ½Ðì


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

I think he wants to change the keybindings from word, quake and so on.

Like telling word not to use ctrl+v to paste from clipboard anymore.

So - to my knowledge - Hotkeyset is out.

Share this post


Link to post
Share on other sites

I think he wants to change the keybindings from word, quake and so on.

Like telling word not to use ctrl+v to paste from clipboard anymore.

So - to my knowledge - Hotkeyset is out.

HI,

then check whether the word window is active, get the key with _isPresed() or maybe even Hotkey and then do your key combination.

Not tested! :P

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

No, I am not looking to change the key bindings for any specific program. Just the script that I am running.

With a game or other program that you may run on your system, the HotKeys are usually set by default by the programmer/designer of the software. I was wondering if it is possible to take my script and set default keys (which I already know how to do with:

HotKeySet('{keyname}', '_main')

I was trying to allow the script to be alittle more customizable for each user by allowing them to open a configuration window and telling the window what they would like the new HotKeys to be by either selecting them in a scrollbox or by pressing them on the keyboard. I was wondering if this is possible in autoit or no?

Again, THIS IS FOR MY OWN SCRIPT AND NOT ANOTHER PROGRAM.


"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor"Mess with the best, die like the rest!!" -Hackers"This above all to thine own self be true." -William Shakespeare"Corruption is only as corrupted as the individual makes it out to be." -Mozart_ONLINECheck out this free 1 GB FTP website at DriveHQ.com. You can control the users and even publish a website for free!![s]Your-Start.com - A online website that you can customize to hold all you links, news information, and other website info.[/s]

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