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

Re: [MacPerl] StandardFile::GetFolder



At 11.26 1/5/98, Bill Melvin wrote:
>hello all,
>
>I know the use of StandardFile is becoming deprecated but I have not been
>able to get Mac::Files, et. al. to work (finding a copy of AppleScriptLib
>is the problem, I think)
>
>In any case, why does the following ...
>
>>require "StandardFile.pl";
>>StandardFile::GetFolder('hey you');
>
>Give me a "choose file" dialog without an option to select a directory??
>
>MacPerl 5.1.5r4 / Quadra 650 / 7.5.3

Well, with MacPerl 5.1.xr4:

#!perl
use strict;
use Mac::Files;
require 'GUSI.ph';

my $dir = GetFolder('Pick a folder ... ',
  FindFolder(kOnSystemDisk(), kDesktopFolderType())
);
print $dir,"\n";

sub GetFolder {
  my($prompt, $default) = @_;
  MacPerl::Choose(
    GUSI::AF_FILE(),                          # domain
    0,                                        # type
    $prompt,                                  # prompt
    '',                                       # constraint
    GUSI::CHOOSE_DIR() +
      ($default ? &GUSI::CHOOSE_DEFAULT : 0), #flag
    $default
   );
}

__END__

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch