Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Toggle Character Palette and Keyboard Viewer on/off' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle Character Palette and Keyboard Viewer on/off
Authored by: llee on Jan 28, '10 11:46:45AM
Thanks to etatoby and N. Riley for including a Snow Leopard solution for Keyboard Viewer. Here's a replacement for the Character Palette toggle script that works for Snow Leopard.
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

Edited on Jan 28, '10 11:59:56AM by llee


[ Reply to This | # ]
Toggle Character Palette and Keyboard Viewer on/off
Authored by: llee on Jan 29, '10 09:07:57AM
Well, Rob G. politely enlightened me to the fact that I'm apparently not enough of a desktop publisher to realize that there is a benefit to be derived from making the distinction between dragging those characters in there and clicking the button in Character viewer. I hadn't previously linked the failure of the button to the viewer launching method. I just thought it was a palette scope thing with the app I was using. I actually believe I remember at some point considering whether to submit a bug report that the button in Character viewer doesn't always work. Thanks to Rob for revealing the embarrassing truth.

However, now I'm quite intrigued by the possibility of modifying Nicholas Riley's source for his keyboardViewer executable to make one that provides the same functionality for the Character viewer.

github.com/nriley/keyboardViewer

Maybe Nicholas can be persuaded to release a remedy himself.

[ Reply to This | # ]