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

Re: [MacPerl] OpenPanel



simsong@vineyard.net (Simson L. Garfinkel) wrote:

> Please forgive this question if it's dumb, but I can't find the answer
> anywhere.

It's in MacPerl.pod (e.g., "Macintosh specific features" in the Go menu
of Shuck) - but to the author of the manual on PGP, almost anything is
forgiven :-)

> How do I create a file open panel with MacPerl?

        require 'StandardFile.pl';

To find an existing file:

        $path = StandardFile::GetFile;

If you want to display only files of some types, put in an empty string
as first argument, followed by the list of four-letter file types, e.g.:

        $path = StandardFile::GetFile('', 'TEXT', 'RTF ');

The first argument is essentially useless; an empty string is as good as
any other. Just avoid a length of 4.

To create a path for a new file:

        $path = StandardFile::PutFile('Output?', 'MyFile.txt');

Here, the first argument *is* actually a prompt, and the second is the
default file name. Both are optional.

-- 
Johannes
#!/usr/local/bin/perl -w
$ego = '#!/usr/local/bin/perl -w
$ego = %c%s%c; printf $ego, 39, $ego, 39;'; printf $ego, 39, $ego, 39;