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

Re: [MacPerl] choose folder



On: Mon, 27 Nov 2000 21:09:36 -0900  nellA hciR <g3pb@alaska.net> wrote:

>what is the MacPerl equivalent to the following without using AppleScript?

>$f = MacPerl::DoAppleScript("(choose folder) as string");
>print "$f\n";   # print folder path as string

This may help:

#! perl -w
use strict;
require "StandardFile.pl";
my $dir = &StandardFile'GetFolder('Select a folder', "::");
print $dir;

This was an interesting example and learning tool from the archives - can't remember who set it up? 

#! perl -w

use strict;

#-=-=-=-=-=Declare Includes-=-=-=-=-=-=-=-=-=-=-=

use Mac::Files;
use File::Find;

#-=-=-=-=-=Declare Variables-=-=-=-=-=-=-=-=-=-=

my ($path,$folder,$file,@StdFolders,);

#-=-=-=-=-=Script Body-=-=-=-=-=-=-=-=-=-=-=-=-=

#typing the folder name like this:

$path = FindFolder(kOnSystemDisk(),kDesktopFolderType());

#  works

print "path to desktop folder is> $path\n";

#load the standard folders into an array:

@StdFolders= (

kAppleMenuFolderType(),
kShutdownFolderType(),
kControlPanelFolderType(),
kStartupFolderType(),
kDesktopFolderType(),
kSystemFolderType(),
kExtensionFolderType(),
kTemporaryFolderType(),
kFontsFolderType(),
kTrashFolderType(),
kPreferencesFolderType(),

);

foreach $file (@StdFolders) {
    $path=(FindFolder(kOnSystemDisk(),$file));
    print "$path\n";
    print "$file\n";

 	 }
	__END__

HTH
David on the Maine Coast - USA



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