[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Dialog Director



I mentioned before that Dialog Director works with Mac::Glue now.  Here is
an example password script.  I forgot to include it in Mac::Glue 0.58 with
all the other examples; I will include it in the next version.

#!perl -w
# requires Dialog Director OSAX
# http://www.hylight.demon.co.uk/DialogDirector/DialogDirector.html

use Mac::Glue ':all';
$f = new Mac::Glue 'Finder';

my $dialog = {
    size => [260, 95],
    contents => [
        {
            class   => 'push button',
            bounds  => [190, 65, 250, 85],
            name    => 'OK',
            enabled => 3
        }, {
            class   => 'push button',
            bounds  => [110, 65, 170, 85],
            name    => 'Cancel'
        }, {
            class   => 'password field',
            bounds  => [10, 36, 250, 36 + 16],
            name_bounds => [10, 10, 250, 26],
            name    => 'Enter Password:',
            value   => '',
        }
    ],
    timeout_after => 60,
};

$f->activate;
my @results = $f->dd_auto_dialog($dialog, grayscale => 1);
die $^E if $^E;

# password field is field number 2, OK button is number 0
print $results[0] ? $results[2] : 'canceled';

__END__

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org