Followers 0

# Set HOT KEYS for up to 64 of your most frequently used programs and files.

## 26 posts in this topic

#1 ·  Posted (edited)

I hope this will be as useful to somebody as it is to me.

The attached small script allows you to define (up to 64) Hot Keys for any file in your system in a simple INI file.

EDIT: The following combinations are not allowed:

<CTRL>+<ALT>+X - reserved for exiting the program

<CTRL>+<ALT>+H - reserved for printing out the current set HotKeys

Any criticism and suggestions are welcome

Here is an example INI fie:

; + = SHIFT
; ! = ALT
; The first key of the combination is always CTRL,
; the rest you can define here.
; The combination can be 2 keys (without the CTRL key) max.

[HOTKEYS]
;the following combination is <CTRL>+<SHIFT>+<C>
+c="C:\Program Files\ConTEXT\ConTEXT.exe"
+f="C:\Program Files\Mozilla Firefox\firefox.exe"
+a=C:\Program Files\AutoIt3\beta\AutoIt3.chm
+p=mspaint
;the following combination is <CTRL>+<ALT>+<E>
!e=iexplore
;the following combination will override the default action
;of [b]CTRL+c[/b] and will start the calculator instead
c=calc
+g=www.google.com

EDIT: Forgot to mention, that you need the beta...

EDIT: BIG THANKS TO MHz & SmOke N!

HotKey.au3

HotKey.au3 - 14.03.2006 - Fixed an issue with the CASE of the HotKeys definition in the INI file

HotKey.au3 - 04.04.2006 - Fixed an issue with the empty section in the INI file (this issue was a result of the previous fix)

EDIT: Here is an icon if you like it HotKey.ico

Edited by dv8

##### Share on other sites

just notice a small spac e difference

ElseIf $CMDLINE[1] <> '/restart' Then and Run(@ScriptFullPath& " /restart") before the "/" 8) #### Share this post ##### Link to post ##### Share on other sites #3 · Posted (edited) just notice a small spac e difference ElseIf$CMDLINE[1] <> '/restart' Then

and

Run(@ScriptFullPath& " /restart")

before the "/"

8)

That's because there should be a space between the EXEcutable and the parameter when you run it. Edited by dv8

oooopps!!

8)

##### Share on other sites

#5 ·  Posted (edited)

Nice work dv8!

Edit:

Just a quick note... should have had a Thanks to MHz in there for that one!

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

##### Share on other sites

#6 ·  Posted (edited)

Cool, a hotkey program made with autoit..  this is very handy!

I have a ?, is the "tray affect" you did in the help file.. because i could find it..

Edited by slightly_abnormal

##### Share on other sites

Cool, a hotkey program made with autoit..  this is very handy!

10x

I have a ?, is the "tray affect" you did in the help file.. because i could find it..

What do you mean by "tray affect"? I can't understand the question.

##### Share on other sites

I made a fiew changes to the script.

Now it's a bit more commented and has the ability to print out the current set HotKeys (useing <CTRL>+<ALT>+H) in a MsgBox.

And some other small things.

The old attachment is replaced with the new one.

##### Share on other sites

EDIT: Forgot to mention, that you need the beta...

EDIT: BIG THANKS TO MHz & SmOke N!

A new vesion, Awesome.

Glad that you appreciate the help that members offer. Ofcourse a bigger thanks to you for creating a great program to share with the AutoIt community.

Nice code. I have noticed that since this is a Beta script, then perhaps it would be better to use /AutoIt3ExecuteScript as I posted here. That allows for compiled or uncompiled execution which would save that MsgBox showing when executing from uncompiled.

Time to go and play with this new version.

##### Share on other sites

A new vesion, Awesome.

Glad that you appreciate the help that members offer. Ofcourse a bigger thanks to you for creating a great program to share with the AutoIt community.

Thank you for the nice words.

Nice code. I have noticed that since this is a Beta script, then perhaps it would be better to use /AutoIt3ExecuteScript as I posted here. That allows for compiled or uncompiled execution which would save that MsgBox showing when executing from uncompiled.

Time to go and play with this new version.

I planned this to work as a compiled program, and that's why i skipped the code offered by you. The MsgBox was added just to inform the people who run the script and wonder why the "Restart" doesn't work as it should.

:">

##### Share on other sites

10x

What do you mean by "tray affect"? I can't understand the question.

well.. i'll say this..

this was a pain in the ass! it works, but causes problems

#Include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)  ; Default tray menu items (Script Paused/Exit) will not be shown.

$prefsitem = TrayCreateItem("Preferences") TrayCreateItem("")$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit") TraySetState() While 1$msg = TrayGetMsg()
Select
Case $msg = 0 ContinueLoop Case$msg = $prefsitem Msgbox(64,"Preferences:","OS:" & @OSVersion) Case$msg = $aboutitem Msgbox(64,"About:","AutoIt3-Tray-sample") Case$msg = $exititem ExitLoop EndSelect WEnd Exit while this worked perfectly for me, no problems. #notrayicon Opt("TrayMenuMode",1) Opt("TrayOnEventMode",1)$Preferences_tray = TrayCreateItem("Preferences")
TrayItemSetOnEvent($Preferences_tray,"_Preferences")$About_tray = TrayCreateItem("About")
TrayItemSetOnEvent($About_tray,"_About")$exit_tray = TrayCreateItem("Exit")
TrayItemSetOnEvent($exit_tray,"_Exit") TraySetState() While 1 ;Script sleep (100) WEnd Func _About() Msgbox(64,"About:","AutoIt3-Tray-sample") EndFunc Func _Preferences() Msgbox(64,"Preferences:","OS:" & @OSVersion) EndFunc Func _Exit() exit EndFunc #### Share this post ##### Link to post ##### Share on other sites well.. i'll say this.. this was a pain in the ass! it works, but causes problems ... Sorry slightly_abnormal, is my script causing these problems? If it is, please be more specific: What kind of problems? When the problems appear? What is your OS and Autoit version? Tell me what you do to provoke these problems so I can test it. while this worked perfectly for me, no problems. ... That's how I've done it, so there shouldn't be problems with my script. At least I don't have any. #### Share this post ##### Link to post ##### Share on other sites Nice idea! So I had to rate it. Cheers.. #### Share this post ##### Link to post ##### Share on other sites Nice idea! So I had to rate it. Cheers.. THANK YOU! #### Share this post ##### Link to post ##### Share on other sites I hope this will be as useful to somebody as it is to me. The attached small script allows you to define (up to 64) Hot Keys for any file in your system in a simple INI file. EDIT: The following combinations are not allowed: <CTRL>+<ALT>+X - reserved for exiting the program <CTRL>+<ALT>+H - reserved for printing out the current set HotKeys Any criticism and suggestions are welcome Here is an example INI fie: ; + = SHIFT ; ! = ALT ; The first key of the combination is always CTRL, ; the rest you can define here. ; The combination can be 2 keys (without the CTRL key) max. [HOTKEYS] ;the following combination is [b]CTRL+SHIFT+c[/b] +c="C:\Program Files\ConTEXT\ConTEXT.exe" +f="C:\Program Files\Mozilla Firefox\firefox.exe" +a=C:\Program Files\AutoIt3\beta\AutoIt3.chm +p=mspaint ;the following combination is [b]CTRL+ALT+e[/b] !e=iexplore ;the following combination will override the default action ;of [b]CTRL+c[/b] and will start the calculator instead c=calc EDIT: Forgot to mention, that you need the beta... EDIT: BIG THANKS TO MHz & SmOke N! EDIT: Below is the latest version of the script. Before the change, it was downloaded 11 times (just for the reccord) Excellent The 1st run raises an error because of the ini file, you should create an empty ini file if not present Apzo. #### Share this post ##### Link to post ##### Share on other sites hey, dv8.. your script is fine! I mean I implented the tray menu (The one in help file) in my script and things didn't go over to well, so i tried the way you did tray menu and it worked perfectly. #### Share this post ##### Link to post ##### Share on other sites #17 · Posted (edited) HotKey.au3 - 14.03.2006 - Fixed an issue with the CASE of the HotKeys definition in the INI file Edited by dv8 #### Share this post ##### Link to post ##### Share on other sites HotKey.au3 - 14.03.2006 - Fixed an issue with the CASE of the HotKeys definition in the INI file It looks like a great script but when I try to compile I get this error. I am sure I must be doing something wrong. Btw, I am using BETA. C:\Documents and Settings\[secret]\My Documents\Personal\AutoIt\HotKey Setter\HotKey.au3 (63) : ==> Subscript used with non-Array variable.: For$i=1 To $var[0][0] For$i=1 To \$var^ ERROR

>AutoIT3.exe ended.

>Exit code: 0 Time: 1.333

##### Share on other sites

It looks like a great script but when I try to compile I get this error. I am sure I must be doing something wrong. Btw, I am using BETA.

Hi litlmike,

10x for the feedback!

The error appears to be triggered by an empty [HOTKEYS] section in the INI file. (When the section name exists and there are no hotkeys defined in it)

I made some changes in the script. (See the last attachment in my first post here.)

Please let me know if you have any more problems.

Have a nice day!

##### Share on other sites

Please someone, why I get error when I run "HotKey.au3" and if I compile (Beta) and run I get "Unable to open script file" message.

This makes me crazy, the same error repeats in all scripts I download.

Thank you

Tuk