osx

AppleScript dialog - display a number in a dialog

To display a number in a dialog using AppleScript, just treat it like a string and you'll be fine. Here's a direct example:

display dialog 4.79

And here's an example using a variable:

set myNum to 4.88
display dialog myNum

AppleScript clipboard/dialog example - Display clipboard contents in a dialog

AppleScript clipboard FAQ: Can you demonstrate an AppleScript clipboard example, such as displaying the Mac OS X clipboard contents in an AppleScript dialog?

One of the crazy things about AppleScript is how easy it is to get the contents of the clipboard, and then display them in a dialog. Here's an AppleScript clipboard dialog example that does just that:

display dialog (the clipboard)

Yep, that's it, just one line of text. Put this AppleScript code in your own ScriptEditor and run it, and you'll see it display the clipboard contents.

An AppleScript dialog textfield example

AppleScript dialog FAQ: How can I display an AppleScript dialog with a textfield (text field)?

A frequent AppleScript question is "How do I prompt a user to enter some text?" Here's how you display an AppleScript dialog to prompt a user to enter a simple piece of information, in this case their name:

display dialog "What is your name?" default answer ""

Running this AppleScript dialog code results in the following dialog:

Apple events and the AE Monitor

I haven't used it yet, but AE Monitor looks like it might be a good tool to see the Apple Events that are firing on your Mac OS X system. As I get more into Mac-specific programming (using Cocoa, Xcode, and AppleScript) I just wanted to make a note to remember this.

 

Mac Activity Monitor - Mac process and memory usage

The Mac OS X Activity Monitor is a cool utility. As shown in the following figure, the main screen shows all the processes running on your system, the user that owns the process, the percent of CPU it's using, the virtual memory it's using, and more. My most common thing here is to sort by memory or CPU use to get a general idea of what's going on.

Run a picture slideshow from the Finder

One of the cool things I just discovered on my Mac is the slideshow capability of the Finder. This can be a great tool for previewing a collection of images, or just to rotate images on your screen just for fun. Just highlight a few images, right-click, and choose the Slideshow option.

The Mac DigitalColor Meter utility (get Mac RGB values)

The DigitalColor Meter application is a cool little utility that comes free with Mac OS X. It has one simple purpose: to let you determine the color of a pixel of an image. Actually, it's a bit more than that, but that's what I use it for.

Can't remember Force Quit key combination

I haven't had the problem of a frozen application on my Mac OS X laptop in a long time, but when it does I can never remember the keystroke combination to bring up the Force Quit dialog. The key combination is [Option][Command][Esc], which I know at this moment because I'm looking at it in a book.

Since I can't remember that combination I'm hoping this mnemonic will help: "Oh Crap Eddie", where "Oh" stands for "Option", "Crap" == "Command", and "Eddie" == "Esc".

Run Dashboard widgets from your desktop

If you've ever wanted to see your Dashboard widgets outside of the normal Dashboard environment, Amnesty Widgets lets you run your widgets directly on your desktop. It's not free, but if it's something you always wanted, you can download a free trial.

 

Mac Stickies and the Stickies widget

In a previous tip I discussed how to create a Mac sticky note from inside a Cocoa application, but I forgot to mention about how to use stickies as a standalone application.

Fortunately, it's pretty easy. Just open your Applications folder, and click the Stickies application icon. Once the Stickies application is started, just click File, and New Note to create a new sticky note, or press [Command][N].