dv8 Posted March 11, 2006 Share Posted March 11, 2006 (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 HotKeysAny 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.comEDIT: 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.au3HotKey.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 April 4, 2006 by dv8 Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 just notice a small spac e difference ElseIf $CMDLINE[1] <> '/restart' Then and Run(@ScriptFullPath& " /restart") before the "/" 8) Link to comment Share on other sites More sharing options...
dv8 Posted March 11, 2006 Author Share Posted March 11, 2006 (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 March 11, 2006 by dv8 Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
Valuater Posted March 11, 2006 Share Posted March 11, 2006 oooopps!! 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2006 Moderators Share Posted March 11, 2006 (edited) Nice work dv8! Edit: Just a quick note... should have had a Thanks to MHz in there for that one! Edited March 11, 2006 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 More sharing options...
slightly_abnormal Posted March 12, 2006 Share Posted March 12, 2006 (edited) Cool, a hotkey program made with autoit.. [edit] this is very handy! I have a ?, is the "tray affect" you did in the help file.. because i could find it.. Edited March 12, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
dv8 Posted March 12, 2006 Author Share Posted March 12, 2006 Cool, a hotkey program made with autoit.. [edit] 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. Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
dv8 Posted March 12, 2006 Author Share Posted March 12, 2006 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. Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
MHz Posted March 12, 2006 Share Posted March 12, 2006 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.au3A 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. Link to comment Share on other sites More sharing options...
dv8 Posted March 12, 2006 Author Share Posted March 12, 2006 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. :"> Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Share Posted March 12, 2006 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 guestscripter 1 Link to comment Share on other sites More sharing options...
dv8 Posted March 13, 2006 Author Share Posted March 13, 2006 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. Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
busysignal Posted March 13, 2006 Share Posted March 13, 2006 Nice idea! So I had to rate it. Cheers.. Link to comment Share on other sites More sharing options...
dv8 Posted March 13, 2006 Author Share Posted March 13, 2006 Nice idea! So I had to rate it.Cheers.. THANK YOU! Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
Apzo Posted March 13, 2006 Share Posted March 13, 2006 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) 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. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 13, 2006 Share Posted March 13, 2006 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. Link to comment Share on other sites More sharing options...
dv8 Posted March 14, 2006 Author Share Posted March 14, 2006 (edited) HotKey.au3 - 14.03.2006 - Fixed an issue with the CASE of the HotKeys definition in the INI file Edited March 14, 2006 by dv8 Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
litlmike Posted April 3, 2006 Share Posted April 3, 2006 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 _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
dv8 Posted April 4, 2006 Author Share Posted April 4, 2006 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! Free Remote Desktop Software For Windows Link to comment Share on other sites More sharing options...
Tukata Posted April 5, 2006 Share Posted April 5, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now