Sunday, December 17, 2017
  • Index
  •  » unScripted
  •  » AppleScript Toolbox Secrets: Dialog Alternatives

#1 2003-05-30 10:48:00 am

T.J. Mahaffey
Administrator
From:: Arkansas, USA
Registered: 2002-11-20
Posts: 238
Website

AppleScript Toolbox Secrets: Dialog Alternatives

On the heels of last issue's interview with Jonas Salling, author of Salling Clicker, I'm here to reveal some interesting new and often-overlooked AppleScript goodies which happen to include Clicker, a little nugget by Illume Software called iNotify and Kanzu Utilities' Extra Suites. However, let me first thank our friend Rob Jorgensen from whom I gleaned some of these great tips. In addition, I'd like to note to readers that our first tip, regarding SEC Helper, should be tackled only by moderate-to-advanced users. I don't recommend beginners go mucking around with OS X package contents.

SEC Helper

As you know, Salling Clicker is a very hot ticket these days with its Bluetooth support, robust AppleScript integration and overall cool factor. What you may not know is that a resourceful AppleScripter can put one of Clicker's internal components to use in a variety of non-Bluetooth/cell phone applications. You see, instead of displaying typical dialog boxes, Salling Clicker provides visual feedback to the user by way of a translucent black bar across the screen with a white text message reversed within that. What I'm about to show you is how you, in your capacity as Clicker Hijacker, can use that same feedback concept in any script you like.

This 'screen bar' is generated by a small helper application within Clicker's preference pane bundle called "SEC Helper" (this acronym is, of course, a hold-over from Clicker's original name, Sony Ericsson Clicker). This helper app is actually what handles Clicker's menu bar item and serves as Clicker's AppleScript terminology dictionary. (See screenshot below)

sc_menubar.jpg


As such, we can commandeer it for our own uses. (As long as we promise to use its power for good and not evil, of course.) Here's how to set up SEC Helper to serve as a system-wide AppleScript tool.

1. First, we need to extract SEC Helper from its home within the Clicker package. Navigate to ~/Library/PreferencePanes/. In this location, you'll see "Salling Clicker.prefPane".

sc_helper_prefpanefile.jpg


2. Next, control-click on Salling Clicker.prefPane and choose 'Show Package Contents' from the resulting contextual menu.

sc_helper_showpkg.jpg


Within this, you'll find various cryptic parts, but what we're looking for is SEC Helper.

sc_helper_insidepkg_list.jpg


3. Just copy SEC Helper out to your desktop. Now that you have SEC Helper isolated, just double-click it. The Salling Clicker phone icon will appear in your menubar and indicates that SEC Helper is running.

sc_helper_dt.jpg


Now, check out SEC Helper's AppleScript dictionary and note the 'show screen' command.

sec_helper_dict.jpg


4. In the screenshot above, you'll see the 'show screen' entry in SEC Helper's dictionary. We'll start with a simple 'show screen' script. (See below) Note the required 'message' parameter whose string dictates what our message actually says.

sc_helper_script1.jpg


5. In this next illustration, I'll use the optional 'duration' parameter. This means I can add 'duration 10' to the end of our 'show screen message' command so that Helper is instructed to hold the alert bar for 10 seconds before fading.

sc_helper_script2.jpg


6. Now, if we run this script, we get this nifty alert bar as a result:

sc_helper_script3.jpg


Finally, here's another interesting example of how this SEC Helper screen message might be used: progress. Sure, it's not quite as elegant as a true progress bar (see Extra Suites below for that), but it does seem to respond well to fast message changes as one might use in a repeat loop, say, for processing a list of files? This example is fairly useless, but it should give you some great ideas for real-world scripting applications. Also note that the 'black bar' is non-intrusive and doesn't prevent the user from continuing to work while the bar is displayed. Nice.

sc_helper_script4.jpg


An additional note on using SEC Helper on its own: If you don't actually use Salling Clicker with a cell phone, but would like to employ SEC Helper in other capacities as outlined here, you might want it to be truly faceless. This means using SEC Helper without displaying the menubar icon. You can do this with AppleScript, of course:

sec_helper_faceless_code.jpg


If you prefer, Rob Jorgensen has a ready-made solution for you available at ScriptBuilders called Toggle SEC Helper Menu 1.0.

Once you've extracted SEC Helper, you can uninstall the rest of Salling Clicker's components IF you don't plan to use them. SEC Helper will work fine independently. However, I recommend you go ahead and pay Salling Clicker's shareware fee if you use 'Helper for any extended period of time.

For those of you who might be concerned, rest assured that this little secret exposé was written and published with Jonas' blessing. However, we encourage you to head over to Salling Software and download Salling Clicker whether you're using it in full or to add SEC Helper to your AppleScript arsenal. Either way, the $10 registration fee is a real bargain.

iNotify

This little gem offers a very similar benefit to SEC Helper. However, in iNotify's case, a scripter is given access to an iconic alert element just like that which appears on your Mac's screen when adjusting the system volume. Better yet, iNotify includes a Photoshop template for creating your own alert boxes and includes one prebuilt for email notifications.

inotifyss1.gif


But iNotify doesn't stop there. This often-overlooked AppleScript tool incorporates some interesting widget-creation capabilities which are remarkably similar to the recently-acclaimed Konfabulator. I was a bit peeved that Konfabulator only supported Javascript and not our own beloved OSA language. But with iNotify, I get something which is just as good for my uses. Check out this one for controlling iTunes playback:

inotifyss2.gif


And don't miss these very 'fabulous desktop widgets. All fully customizable, all AppleScript goodness.

inotifyss3.gif


Imagine the possibilities! From the Illume Software website:

iNotify allows you to customize your computer by creating buttons on your desktop or menu bar, and pop-up notifications that appear in response to system or application events.

Buttons have rollover and click states, can be translucent and animated, and execute AppleScripts when clicked. Notifications appear in the foreground and then fade away, just like the speaker image that's displayed when you press the volume keys on the keyboard. See the screenshots ... for some examples of how buttons and notifications can be used.

iNotify is a windowless, background process, so it isn't visible in the Dock. Buttons and notifications are created by sending AppleScript commands to the background process.


Finally, you just can't beat iNotify's price: 5 bucks. The complete versatility and limitless possibilities it represents just plain belies this paltry price.

Extra Suites

If you've ever wanted to use progress bars in your OS X scripts without getting into AppleScript Studio, Extra Suites has your number. In fact, David Lloyd of Kanzu Utilities has created an outstanding background application that kicks up your OS X AppleScript vocabulary to notches unknown to mankind. With system commands like 'play AIFF' and 'multibeep', string commands like 'replace' and 'sort' and input commands allowing you to capture keyboard states, Extra Suites can quickly become indespensible. Even those of you who miss the venerable Akua Sweets, which appears to be forever stuck in OS9 Land, will find particular comfort in it.

Plus, Extra Suites is easy to use. It works like a traditional scripting addition by expanding your AS command base, but functions as a faceless background application. Just double-click to launch it and start scripting. Here's a screenshot of Extra Suites' progress window in action within a script I wrote to export mail messages from MailSmith into FileMaker Pro.

es_prog.jpg


All this and a whole lot more can be had with Extra Suites for the puny sum of $10. Wow.

Looking back and editing the above-written copy, I realize that I sound like a salesman for each of these little shareware outfits. But let me assure you that I'm not. These are just a handful of really useful goodies which can be had despite today's tough economic climate. After all, automation is a money-saver in both the fat times and the lean times, right? You can purchase any of these little honeys via the direct purchase and download links below:

* Salling Clicker (contains SEC Helper) - Purchase Link - Direct download link
* iNotify - Purchase Link - Direct download link
* Extra Suites - Purchase Link - Direct download link

In short, I hope this sampling of tool tips and interesting AppleScript discoveries will help you further integrate AppleScript into your daily OS X life. If you have your own little-known AppleScript tools or tips, please send them my way. Email tj @ macscripter.net and I'll include them in the next AppleScript Toolbox Secrets.


T.J.
tj@tjmahaffey.com

Offline

 
  • Index
  •  » unScripted
  •  » AppleScript Toolbox Secrets: Dialog Alternatives

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)