Subject: Re: [Butler Talk] let Butler (and my dedicated shortcut-keys) show Lion's KeyboardViewer

From: ravenlee <[email-masked]>
Date: Sun, 08 Jan 2012 09:52:16 -0600

yeah the script works, but to toggle it - lose the last else. Other than Rob's suggestion, u will have to use GUI scripting for the Sys Prefs window - hope this helps.  I can help u with GUI if the toggle don't work - Lion is here - we're done.  -  Lee
On Jan 8, 2012, at 9:46 AM, Rob Griffiths wrote:

On Jan 7, 2012, at 7:30 AM, Sibe Jan wrote:

> There's applescript for it (http://hints.macworld.com/article.php?
> story=20051022020253863), but it doesn't work correctly for me since
> it sometimes showes, and after that not anymore...

If you read the comment thread to that hint, the problem is that Apple changed what happens when you close the Keyboard Viewer: the process keeps running. In 10.6, even killing that process isn't enough to make the viewer re-appear, which is why someone created Unix binary to do some voodoo to bring it back.

In 10.7, though, it _appears_ Apple may have simplified this somewhat. I was able to make the viewer appear reliably by simply adding a delay between killing the task and relaunching it. (This only works in 10.7 in my testing; 10.6 has deeper issues, it seems.) So, if you're in 10.7, this should work in Butler as an AppleScript item:

tell application "System Events"
 if exists (process "Keyboard Viewer") then
   tell application "KeyboardViewer" to quit
   delay 2
   tell application "KeyboardViewer" to activate
 else
   tell application "KeyboardViewer" to activate
 end if
end tell

This worked in 10.7 in my testing, assigned to a keyboard shortcut in Butler. Because there's a delay required, it won't appear instantly, but it still seems better than the menu bar item.

regards,
-rob.

-- 
You received this message because you are subscribed to the Butler Talk group. To post to this group, send email to [email-masked]. To unsubscribe from this group, send email to [email-masked].

For more options, visit the Butler Talk web page at <http://groups.google.com/group/butler-talk>

---

From: Rob Griffiths <[email-masked]>
Date: Sun, 8 Jan 2012 07:46:44 -0800

regards,
-rob.

---

From: Sibe Jan <[email-masked]>
Date: Sat, 7 Jan 2012 07:30:59 -0800 (PST)

As the 'betreff' already states, i'd like Butler to show Lion's Built
in KeyboardViewer. Now it's annoyingly hidden in a checkbox called
'Show Input menu in menubar" in SystemPreferences/Language&Text/
ImputSources. And then it's a menu-ling.
There's applescript for it (http://hints.macworld.com/article.php?
story=20051022020253863), but it doesn't work correctly for me since
it sometimes showes, and after that not anymore...

Could Butler perhaps be of service?