CocoaDialog

From HaFrWiki42
Revision as of 16:59, 24 January 2015 by Hjmf (talk | contribs) (→‎Alternatives)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A nice addition to the Apple OSX environment is the option to send message notifications yo the user. The aim of cocoaDialog [1] is just that.

Overview

The application cocoaDialog is an OS X application that allows the use of common GUI controls such as file selectors, text input, progress bars, yes/no confirmations and more with a command-line application. It requires no knowledge of Cocoa, and is ideal for use in shell and Perl scripts (or Ruby, or Python, or... etc).

Download

Download the script [2] and save it into the /usr/bin directory with the name cocoaDialog:

#!/usr/bin/perl
use strict;
use warnings;

my $path = "/Applications";
my $cd = "$path/cocoaDialog.app/Contents/MacOS/cocoaDialog";

system($cd, @ARGV);

Please note:

  1. Change the $path entry into the location where you saved the cocoaDialog.app directory.
  2. You need sudo-rights to save the script with the name cocoaDialog in the /usr/bin directory.
  3. You need to chmod the execution right to ag+x
    sudo chmod ag+x /usr/bin/cocoaDialog

Documentation

The documentation contains also examples of the different dialogs. Please read the example carefully because there are some nasty dialog requirements which may cause a dialog to hang into your system.

Alternatives

A simplier alternative is terminal-notifier, but has less options than cocoaDialog. Information can be found on this wiki at OSX_Terminal_Notifier.

See also

top

Reference

top

  1. ↑ CocoaDialog, Home page on GitHuh of the CocoaDialog. The Application is create by Mark A. Stratman.
  2. ↑ Download, Download the Application and Install it into the Applications directory.