Jump to content

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


dv8
 Share

Recommended Posts

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! :>

EDIT: Below is the latest version of the script. Before the change, it was downloaded 11 times (just for the reccord)

HotKey.au3

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

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 :oHotKey.ico

Edited by dv8
Link to comment
Share on other sites

  • Moderators

Nice work dv8!

Edit:

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

Edited by SmOke_N

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.

Link to comment
Share on other sites

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)

HotKey.au3

A new vesion, Awesome. :o

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. :mellow:

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. :)

Link to comment
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. :mellow:

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.

:">

Link to comment
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
Link to comment
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. :)
Link to comment
Share on other sites

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

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! :o

EDIT: Below is the latest version of the script. Before the change, it was downloaded 11 times (just for the reccord)

HotKey.au3

Excellent :>

The 1st run raises an error because of the ini file, you should create an empty ini file if not present :)

Apzo.

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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!

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...