Fungible Clouds

Break the cloud services vendor lock-in

Easily Toggle the Function Keys Between Media and Standard Function

| Comments

Tired of having to open system preferences/keyboard to toggle the default behavior of functions keys? Use this AppleScript with Quicksilver or Alfred to easily toggle the function keys between media and standard role.”

(togglefn.applescript) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
tell application "System Preferences"
  set current pane to pane "com.apple.preference.keyboard"
end tell

tell application "System Events"
  if UI elements enabled then
    tell application process "System Preferences"
      get properties
      click radio button "Keyboard" of tab group 1 of window "Keyboard"
      click checkbox "Use all F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
    end tell
  else
    tell application "System Preferences"
      activate
      set current pane to pane "com.apple.preference.universalaccess"
      display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
    end tell
  end if
end tell

tell application "System Preferences"
  quit
end tell

Similarly, use this app-toggler AppleScript to toggle between Chrome and TextMate.

(app-toggler.applescript) download
1
2
3
4
5
6
7
8
9
on GetCurrentApp()
  tell application "System Events" to get short name of first process whose frontmost is true
end GetCurrentApp

if GetCurrentApp() is equal to "TextMate" then
    tell application "Google Chrome" to activate
else
    tell application "TextMate" to activate
end if

Now just assign a hotkey to the script file and the hotkey becomes a toggle button.

Got more tips to increase your productivity? Share via comments below.

Comments