Created
April 25, 2012 10:42
-
-
Save pjrobertson/2488900 to your computer and use it in GitHub Desktop.
Show Character Palette script for OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property querylist : {"CharacterPalette"} | |
property app_is_up : missing value | |
set app_is_up to false | |
set frontapp to getFrontApplication() | |
repeat with i in querylist | |
set the_ps to paragraphs of (do shell script "/bin/ps -acx") | |
tid("/") | |
repeat with _line in the_ps | |
if _line is "" then | |
else | |
if _line contains i then | |
set app_is_up to true | |
set _pid to first word of _line | |
end if | |
end if | |
end repeat | |
tid("") | |
end repeat | |
if app_is_up then | |
tell application "/System/Library/Input Methods/CharacterPalette.app" to quit | |
else | |
tell application "/System/Library/Input Methods/CharacterPalette.app" to activate | |
end if | |
tell application frontapp to activate | |
on tid(s) | |
set my text item delimiters to s | |
end tid | |
on getFrontApplication() | |
(path to frontmost application) as text | |
end getFrontApplication |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment