There’s a few times I would’ve like to prominently display a phone number or some other piece of information from a script or FileMaker. Apple’s Address Book application makes good use of this. If you right-click on a phone number you get this:
There’s a nice utility by the name of BigHonkingText that comes pretty close to this, but you must execute it via the command line, and has a few small differences from Address Book in its implementation
Since I was hoping for an all AppleScript solution and was trying to get as close a match as possible, I’ve cooked up an app of my own for this.
Called Gooey Gadgets, it is a faceless “helper” applcation that has the following commands:
dismiss window v : close given window
dismiss window integer : the window number to close
→ boolean : returns true if the window was found
display message window v : Create a translucent window with one line message
display message window text : a brief message to display
[giving up after integer]: number of seconds to wait before dismissing window
[screen point]: X,Y coordinates for any point within screen to be used to display the window
[transparency integer]: the window’s background transparency (alpha) as a percentage
→ integer : the window id
- The screen coordinates are an optional value that you can use to make sure the message displays on the same screen as your other script or Filemaker windows. However they are in the coordinate system that Cocoa uses, which has the inverse Y-axis from what Filemaker uses for Get (WindowTop).
- The giving up after parameter works the same way as Applescript’s Display Dialog command, allowing you to set a maximum time for the window to display (the user may click on the window to dismiss it before then).
- The transparency parameter is not yet implemented, so its value is ignored.
An example of its usage looks like this:
tell application id “com.sibr.gooeygadgets” — could’ve also used app name instead
set x to display message window “big message”
delay 4
dismiss window x — Gooey Gadgets will now quit if this is the last open window
end tell
I have also included command line support, and the options look like this:
Gooey Gadgets.app/Contents/MacOS/Gooey Gadgets -cmd messagewindow [-giveup seconds] [-screenx num] [-screeny num] message
The path used is an artifact of the fact that the command line must execute the actual application binary, not the application’s package folder. So if the application is at /_Projects, a command line example would be:
/_Projects/Gooey\ Gadgets/build/Release/Gooey\ Gadgets.app/Contents/MacOS/Gooey\ Gadgets -cmd messagewindow -giveup 2 "(510) 835-4483"
Download the most recent version at:
Gooey Gadgets.app.zip
After downloading, move it out of your Downloads folder. The first time you run it, you may need to OK the application as safe to run.
PS: Excuse the formatting messiness above. The blog software wasn’t kind to my cut-and-pasting.