There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer audio black screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware network networking nvidia outlook outlook 2003 outlook express partition printer problem router slow software sound trojan usb video virus vista windows windows xp wireless
Tech Tips & Tricks
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > General Technology > Tech Tips & Tricks >
Playing with HotKeys and keyboard shortcuts using AutoKey. 10 step guide.


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
firestormer's Avatar
Computer Specs
Senior Member with 1,353 posts.
 
Join Date: Sep 2005
Location: UK
Experience: Skilled: Know all i know and little else
27-Apr-2007, 03:49 PM #1
Playing with HotKeys and keyboard shortcuts using AutoKey. 10 step guide.
I have a Dell Laptop. It has an annoying little hotkey button that i wanted to re-asign to Media Center and not to use 'Dell Quick Set'. I also didn't want to download a full program to do this.

But i can across a program called AutoHotKey. This is an autoit based program that helps you to write your own scripts and compile them to programs to manage hotkeys.

Bellow is a simple step by step guide to creating a script using AutoHotKey for a special keyboard button which is currently unassigned.

1. Download and install AutoHotKey from http://www.autohotkey.com/download/

2. Open notepad and enter the following
Code:
#InstallKeybdHook


Save the file as KeyHook.ahk and close notepad
This will help you grap the keys id code for use latter.

[DURING STEPS 3 -7 DO NOT ENTER ANY PASSWORDS INTO YOUR COMPUTER AS THE SCIPT IS DESIGNED TO RECORD YOUR KEYSTROKES SO THAT YOU CAN IDENTIFY YOUR HOTKEY]


3. Run the new file you just created by double clicking its icon
You will notice a green icon with a H appears in your system tray, double click it.

4. A window will appear, in the window click View> Key History and Script Info

5. The window will change and it will show a list of the keys pressed since you started the script.
Press your hot key now
Press F5

6. The window will have refreshed and at the bottom you will see somwthing like this:
Code:
54  014	 	d	4.77	T     
54  014	 	u	0.09	T              	
74  03F	 	d	0.75	F5             	
Press [F5] to refresh.


In this case I pressed T as an example. But in your case it will show your hotkey. (Note: In the key column it may show a letter, ignore this)
Make a note of the value in the second column as i have shown in red for my case.

7. Go File>Exit

8. Open notepad and paste in the following:
Code:
#NoTrayIcon
SC112::
Run %SystemRoot%\ehome\ehshell.exe
return

Replace the number in red with your own from earlier and the text in blue with the path of the programm you want to run.
(Note: If it is not a special key replace the whole SC112 with the appropriote key found here: http://www.autohotkey.com/docs/KeyList.htm)

9. Save the script as whatever you want but with an .ahk file extension. eg HotKey.ahk

10. Use 'Convert .ahk to .exe' found in Start > All Programs > AutoHotKeys and compile it to an appropriate location. If you want you can then add it to startup by placing it in Start> Programs > Startup


By placing it in the startup folder the script will run when you logon allowing you to use the hotkey to open your specified program. There is no visible evidence that the program is running while it runs. To exit the program once launched you will need to open Task Manager (Ctrl + Alt + Dlt) go to proccesses locate the program by the name you saved it as , right click on it and click 'End Proccess'
__________________
You say deviant like its a bad thing...

TSG has made me snow blind.
stantley's Avatar
Computer Specs
Distinguished Member with 3,955 posts.
 
Join Date: May 2005
Location: Steeler Country
Experience: ,The Jimi Hendrix
28-Apr-2007, 11:16 AM #2
Handy little tip. You ran across one of my favorite programs, AutoHotkey. I think you'll find all sorts of uses for it.

I've been using it for about 3 years now and I keep finding different ways to use it. It's great for almost any kind of repetitive task. There's a little bit of a learning curve but it's very intuitive.

The other good thing is the user forum, whenever I've been stuck on a script I've posted the question and had the answer very quickly. They also have a lot of interesting scripts out there.
ferrija1's Avatar
Computer Specs
Distinguished Member with 9,695 posts.
 
Join Date: Apr 2006
Location: Pittsburgh, PA
Experience: Mac Addict
28-Apr-2007, 12:53 PM #3
Quote:
Originally Posted by stantley
Handy little tip. You ran across one of my favorite programs, AutoHotkey. I think you'll find all sorts of uses for it.

I've been using it for about 3 years now and I keep finding different ways to use it. It's great for almost any kind of repetitive task. There's a little bit of a learning curve but it's very intuitive.

The other good thing is the user forum, whenever I've been stuck on a script I've posted the question and had the answer very quickly. They also have a lot of interesting scripts out there.
I remember when you posted a while ago, I got it then and it's great.
stantley's Avatar
Computer Specs
Distinguished Member with 3,955 posts.
 
Join Date: May 2005
Location: Steeler Country
Experience: ,The Jimi Hendrix
28-Apr-2007, 01:12 PM #4
Cool
Archaen's Avatar
Junior Member with 19 posts.
 
Join Date: Sep 2007
20-Sep-2007, 11:36 AM #5
wow, thanks alot, but now it opens media centre and media direct
firestormer's Avatar
Computer Specs
Senior Member with 1,353 posts.
 
Join Date: Sep 2005
Location: UK
Experience: Skilled: Know all i know and little else
20-Sep-2007, 11:45 AM #6
This is probably because you've still got Dell Quick Set running. All the program youve created does is watch for you to press the MD button as does Dell Quick Set.

I sugest you disable/remove Dell Quick Set form Startup or uninstall it completely.
Archaen's Avatar
Junior Member with 19 posts.
 
Join Date: Sep 2007
20-Sep-2007, 12:52 PM #7
Quote:
Originally Posted by firestormer
This is probably because you've still got Dell Quick Set running. All the program youve created does is watch for you to press the MD button as does Dell Quick Set.

I sugest you disable/remove Dell Quick Set form Startup or uninstall it completely.
thanks very much
firestormer's Avatar
Computer Specs
Senior Member with 1,353 posts.
 
Join Date: Sep 2005
Location: UK
Experience: Skilled: Know all i know and little else
28-Oct-2007, 07:06 PM #8
No problem (he says 2 months later)
dickiedum's Avatar
Computer Specs
Junior Member with 8 posts.
 
Join Date: Sep 2006
Location: DEVON UK
Experience: Intermediate
20-Nov-2007, 06:33 PM #9
AutoHotKey
Thanks for the tip. I have had loads of problems with Dells media button. It now refuses to even recognise the cd. After using your guide my media button now works and runs windows media centre. Result. Cheers very very much.
firestormer's Avatar
Computer Specs
Senior Member with 1,353 posts.
 
Join Date: Sep 2005
Location: UK
Experience: Skilled: Know all i know and little else
22-Nov-2007, 03:59 AM #10
Always glad to help
Xichael's Avatar
Junior Member with 2 posts.
 
Join Date: Feb 2008
Experience: Aspirational
22-Feb-2008, 06:01 AM #11
Thanks for the tutorial. I've been eager to get that MediaDirect button to do something. I got it working with AutoHotkey, but I'd really prefer working with AutoIt. I see from this thread that you've experimented with AutoIt. Have you tried the above recipe in AutoIt?

So far I've figured out how to launch a program by hotkey:

Code:
#NoTrayIcon

HotKeySet ("YourHotKeyGoesHere", "AnyFuncNameGoesHere")

While 1
	Sleep(50)
WEnd
  
Func AnyFuncNameGoesHere()
    Run("C:\Program Files\YourProgram.exe")
EndFunc
The only problem is with getting AutoIt to read the the SC112 keystroke. Did you abandon AutoIt for this reason? Does it just not work with weird keys like SC112?

Any insight is appreciated...
firestormer's Avatar
Computer Specs
Senior Member with 1,353 posts.
 
Join Date: Sep 2005
Location: UK
Experience: Skilled: Know all i know and little else
22-Feb-2008, 09:22 AM #12
Autohotkey is base on autoit, just modified slightly for keyboard input
Xichael's Avatar
Junior Member with 2 posts.
 
Join Date: Feb 2008
Experience: Aspirational
26-Feb-2008, 03:14 AM #13
So I finally figured out how to do this in AutoIt... The MediaDirect button is FF with an _IsPressed, and would be 255 with a HotKeySet (or Chr(255) in use) if I could get it to work. Here's an example script (just replace the program path/file):
Code:
#NoTrayIcon

#include <misc.au3>

While 1
    If _IsPressed("FF") Then
        YourFuncNameHere()
    EndIf
    Sleep(50)
WEnd

Func YourFuncNameHere()
    Run ("C:\Program Files\YourProgramHere.exe")
EndFunc
axeman61's Avatar
Senior Member with 257 posts.
 
Join Date: Mar 2003
28-Feb-2008, 01:13 AM #14
If autohotkey is derived from autoit, then is one better than the other?
stantley's Avatar
Computer Specs
Distinguished Member with 3,955 posts.
 
Join Date: May 2005
Location: Steeler Country
Experience: ,The Jimi Hendrix
28-Feb-2008, 01:47 AM #15
Quote:
Originally Posted by axeman61 View Post
If autohotkey is derived from autoit, then is one better than the other?
That's the subject of a heated debate http://www.autohotkey.com/forum/topic4363.html

I think Chris Mallett, the author of AutoHotkey, summed it up best:
Quote:
I think both languages are similar in terms of syntax capabilities. Which one to use is largely a matter of personal preference, and also which one you learned first.
For me, I think AutoHotkey is a little easier to learn and the AHK forum has been very helpful with any questions I've had.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:04 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.