AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using laptop's fn key

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ArchaicFrog



Joined: 12 Dec 2008
Posts: 1

PostPosted: Fri Dec 12, 2008 4:25 pm    Post subject: Using laptop's fn key Reply with quote

I'm sorry if this has been posted about before; I'm new to AHK and "fn" is too small to search for.

I'm looking for a way to use my laptop's function key in a script (namely I want a way to toggle it). Is this possible?
Back to top
View user's profile Send private message
Dra_Gon



Joined: 25 May 2007
Posts: 373

PostPosted: Fri Dec 12, 2008 5:24 pm    Post subject: Reply with quote

I just found this in the Docs. I don't know if it will help get the fn key info, but it might:

Help Docs wrote:
Special Keys
If your keyboard or mouse has a key not listed above, you might still be able to make it a hotkey by using the following steps (requires Windows XP/2000/NT or later):

Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar.
Double-click that script's tray icon to open its main window.
Press one of the "mystery keys" on your keyboard.
Select the menu item "View->Key history"
Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see further below.
If your key is detectible, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).
To define this key as a hotkey, follow this example:
SC159:: ; Replace 159 with your key's value.
MsgBox, %A_ThisHotKey% was pressed.
returnReverse direction: To remap some other key to become a "mystery key", follow this example:

; Replace 159 with the value discovered above. Replace FF (if needed) with the
; key's virtual key, which can be discovered in the first column of the Key History screen.
#c::Send {vkFFsc159}Alternate solutions: If your key or mouse button is not detectible by the Key History screen, one of the following might help:

Reconfigure the software that came with your mouse or keyboard (sometimes accessible in the Control Panel or Start Menu) to have the "mystery key" send some other keystroke. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure a mystery key to send Control+F1, you can then indirectly make that key as a hotkey by using ^F1:: in a script.

Try searching the forum or asking for help there. There may be ways to detect certain keys and buttons using techniques such as DllCall, OnMessage, and RegisterRawInputDevices.

The following is a last resort and generally should be attempted only in desperation. This is because the chance of success is low and it may cause unwanted side-effects that are difficult to undo:
Disable or remove any extra software that came with your keyboard or mouse or change its driver to a more standard one such as the one built into the OS. This assumes there is such a driver for your particular keyboard or mouse and that you can live without the features provided by its custom driver and software.


Ciao,
Dra'Gon
_________________

For a good laugh {hopefully} >> megamatts.50megs.com

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group