Mac Aluminum Keyboard Scripted to work in windows 7

started 4 months ago | 1 posts | 415 views | topic rss | latest reply
  1. Hi, I Created this AHK file after aggregating several other sources to make a script that worked well for me. It has every one of the printed keys on the slim aluminum keyboard (with keypad) working more or less as it should on a mac. (the only difference is the F5 key which summons the task manager in windows :D) another thing of note is that for this to work just swimmingly, you need to install two stand alone programs called Volumouse and switcher. Volumouse is designed to make the scroll wheel on your mouse a volume wheel, but in options I just set a rule so that some combo I’ll never accidentally use has control over the brightness and script AHK to do that for F1 and F2. And switcher is a nice way to create the exposé effect on a windows machine. Some guides online can help you set it up so it looks JUST like OS X’s exposé feature, but either way it’ll get the job done. Another thing I should mention is the Eject key WILL NOT WORK WITHOUT DRIVERS! So I instead ignored it and went the apple pro keyboard route and put the eject on the far right hand F-key (F19). Since I also have a second optical drive, when you hold ctrl and press F19 it opens and closes the secondary drive! If your drives don’t follow the naming conventions I have, its ok just change the drive letter in the code itself to match yours! And lastly to make my knock-off mighty mouse activate exposé I set it to activate switcher’s hotkey when both mouse buttons are pressed, again that is up to you to change.

    Of special note, the sites and ideas that I compiled to make this AHK script are all noted in the code itself in a comment. If you’d like to change what I’ve done to make it (better, faster, stronger, whatever ) please feel free to change and redistribute, but give credit to the authors that I took from and remember keep it free and open

    ;
    ; AutoHotkey Version: 1.x
    ; Language:       English
    ; Platform:       Win 7
    ; Author:         Madison 
    ;
    ; Script Function:
    ;	get the friggin aluminum mac keyboard working in windows 7
    ;
    
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    
    F1::Send {ALTDOWN}{WheelDown}{ALTUP}
    F2::Send {ALTDOWN}{WheelUp}{ALTUP}
    
    F3::Send, {LWinDOWN}{q}{LWinUP}
    F4::Send, {SHIFTDOWN}{CTRLDOWN}{ESC}{SHIFTUP}{CTRLUP}
    
    F7::
    DetectHiddenWindows , On
    IfWinExist , iTunes ahk_class iTunes
    	ControlSend , ahk_parent, ^{left}, iTunes ahk_class iTunes
    else
    	Send {p}{Media_Prev}
    DetectHiddenWindows , Off
    return
    
    F8::
    DetectHiddenWindows , On
    IfWinExist , iTunes ahk_class iTunes
    	ControlSend , ahk_parent, {space}, iTunes ahk_class iTunes
    else
    	send {Space}{Media_Play_Pause}
    DetectHiddenWindows , Off
    return
    
    F9::
    DetectHiddenWindows , On
    IfWinExist , iTunes ahk_class iTunes
    ControlSend , ahk_parent, ^{right}, iTunes ahk_class iTunes
    else
    	Send {n}{Media_Next}
    DetectHiddenWindows , Off
    return
    
    F10::Send {Volume_Mute}
    F11::Send {Volume_Down 5}
    F12::Send {Volume_Up 5}
    
    F13::Send {PrintScreen}
    
    F16::Send {NumLock}
    
    F19::
    Drive, Eject, D:
    ; If the command completed quickly, the tray was probably already ejected.
    ; In that case, retract it:
    if A_TimeSinceThisHotkey < 100  ; Adjust this time if needed.
        Drive, Eject,, 1
    return
    
    ^F19::
    Drive, Eject, E:
    if A_TimeSinceThisHotkey < 100
        Drive, Eject,E:,1
    return
    
    ~ LButton & RButton::Send, {LWinDOWN}{q}{LWinUP}
    
    ;special thanks to:
    	;Autohotkey and their wonderful Documentation section
    		;http://www.autohotkey.com/docs/
    	;Eric F. Savage and his mac keyboard blog post which started me off on this
    		;http://www.efsavage.com/blog/posts/enable_buttons_on_apple_keyboard_in_windows/
    	;the author of "Controlling iTunes with AutoHotKey" for getting me exactly the commands i needed
    		;http://www.switchonthecode.com/tutorials/controlling-itunes-with-autohotkey
    	;and Raymond for his article on brightness controls.
    		;http://www.raymond.cc/blog/archives/2008/08/13/how-to-dim-or-increase-the-brightness-of-laptop-or-notebook-lcd-screen/

    #
    angryliberalpanda
    Reputation:3
    Posted 4 months ago

You must log in to post.

Daily Email Updates

Just want the best posts in your inbox for free? Enter your name and email below:

Name:
Email

About This Topic

Our Network
About Productive Geek