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


Click here to return to the 'Keyboard Viewer and Character Palette via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Keyboard Viewer and Character Palette via AppleScript
Authored by: lsloan on Aug 08, '14 12:40:05PM

I use the following, which I set up as a service so I could assign a keyboard shortcut to it:


on isRunning(applicationName)
	tell application "System Events"
		set appNameIsRunning to exists ¬
			(processes where name is applicationName)
	end tell
	
	return appNameIsRunning
end isRunning

on run {input, parameters}
	if isRunning("CharacterPalette") then
		tell application "CharacterPalette" to quit
	else
		-- tell application "CharacterPalette" to activate
		tell application "Finder" to open item "System:Library:Input Methods:CharacterPalette.app" of the startup disk
	end if
	
	return input
end run

That works very well to make the palette show or hide. However, if I double click a character in the palette, it doesn't insert that character into my text. On the other hand, if I use the "Show Character Viewer" command from the Input menu, double clicking a character there will insert it into my text. Somehow, the way the viewer is invoked from the menu makes it work. I can't figure out what's different, though. The process list doesn't give me any clues.

Anybody know why the character palette/viewer would behave differently depending upon how it was started?

---
Lance E Sloan


[ Reply to This | # ]