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

Re: [MacPerl] FindFolder puzzler




first off you have a simple syntax error.  You need to seperate the items
of your array with commas.  Second, you don't want to quote them.

try settig up your array like this.

@StdFolders= (kAppleMenuFolderType(), #load the standard folders into an
array
kShutdownFolderType(),
kControlPanelFolderType(),
kStartupFolderType(),
kDesktopFolderType(),
kSystemFolderType(),
kExtensionFolderType(),
kTemporaryFolderType(),
kFontsFolderType(),
kTrashFolderType(),
kPreferencesFolderType(),
);

**********************************
David Ackerman
Audio Preservation Engineer
Archive World Music
Harvard University
Cambridge, MA 02138

Telephone: 617-495-2794
Fax: 617-496-4636
e-mail: dackerm@fas.harvard.edu

**********************************

On Wed, 23 Feb 2000 robinmcf@altern.org wrote:

> The script below is an attempt at writing a generic handler script for
> getting the paths to standard folders. Though logic says by passing the
> name of the folder to FindFolder() it should yield the path to the folder,
> yet I get
> 
> # Use of uninitialized value.
> File 'Untitled'; Line 37 # (#1)
> 
> What gives?
> 
> #! perl -w
> 
> use diagnostics-verbose;
> use strict;
> 
> 
> #-=-=-=-=-=Declare Includes-=-=-=-=-=-=-=-=-=-=-=
> use Mac::Files;
> use File::Find;
> #-=-=-=-=-=Declare Variables-=-=-=-=-=-=-=-=-=-=
> 
> my ($path,$folder,$file,@StdFolders,);
> 
> #-=-=-=-=-=Script Body-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> $path = FindFolder(kOnSystemDisk(),kDesktopFolderType()); #typing the
> folder name like this
> 
> #  works
> print "path to desktop folder is> $path\n";
> 
> @StdFolders= q(kAppleMenuFolderType() #load the standard folders into an array
> kShutdownFolderType()
> kControlPanelFolderType()
> kStartupFolderType()
> kDesktopFolderType()
> kSystemFolderType()
> kExtensionFolderType()
> kTemporaryFolderType()
> kFontsFolderType()
> kTrashFolderType()
> kPreferencesFolderType()
> );
> 
> 
> foreach $file (@StdFolders) {
>     $path=(FindFolder(kOnSystemDisk(),$file));
>     print "$path\n";
>     print "$file\n";
> 
> 	 }
> _END_
> 
> # ===== Want to unsubscribe from this list?
> # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
> 


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