Re: [MacPerl-Toolbox] Help, I want to create folders...
[email protected] (Thomas Wegner) Fri, 30 Aug 2002 12:56:36 +0200
| Newsgroups | perl.macperl.toolbox |
|---|---|
| Message-ID | <p04320401b994fc5ce677@[149.225.16.249]> |
At 21:44 Uhr +0200 29.08.2002, Thomas De Groote wrote:
>Hey,
>
>I have this small project I promissed to finish this evening, cause I
>thought I knew enough Perl and Shuck would help me...
>
>Problem is I never used the toolbox before and now I can't find the dialog
>calls to make a 'select destination folder' dialog and get its results. I
>can do get files (StandardGetFile) and when a user clicks cancel in that,
>it does return the last folder, but that is not a real nice way to work,
>is it ?
>
>Could anyone please tell me how to do a 'select folder' thingy ? I would
>be very happy and could finally get asleep :)
>
>Thomas
Good morning :-).
In MacPerl 5.2.0.r4 you can use the GetFolder function,
# Syntax
# $foldername = &GetFolder($prompt [, $default]);
which can be found in the old library file "StandardFile.pl". In
MacPerl 5.6.1r1 there is currently no possibility to use StandardFile
to select a folder. However, this will be changed in MacPerl 5.6.1r2.
In both MacPerl versions you can use the new Navigation Services,
which is a bit more complicated. Recently, I have posted this little
script to the MacPerl list:
#! perl -w
use Mac::Navigation;
$options = NavGetDefaultDialogOptions();
$options->message("What's up, Doc?");
$reply = NavChooseObject("", $options, undef, sub {1}) or die $^E;
for ($i = 0; $i++<$reply->count; ) {
print $reply->file($i), "\n";
}
__END__
(copied from the ChooseObjects.t test/example script)
It should do what you want.
HTH,
Thomas.