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

Re: [MacPerl] Controlling File Visibility and Dialog for Getting a Folder Path




Chris Nandor wrote:

> At 18.12 -0400 1999.07.05, Darryl Tang wrote:
> >I'm writing some MacPerl scripts that need a folder path as a variable so
> >that I can manipulate the items within the folder.  I'd like to create a
> >dialog similar to:
> >
> >	 $gfile = StandardGetFile(0,0);
> >
> >that will allow the user to select a folder instead of a file.  Does anyone
> >know how to put a dialog box that will allow the selection of a folder?
> 
>   require 'GUSI.ph';
>   print MacPerl::Choose(&GUSI::AF_FILE(), 0, "Which folder?",
>     "", &GUSI::CHOOSE_DIR);

I remember having seen that in one of the installation scripts from
the MPP&E CD and thinking that I could have used that on a previous
project.  In looking over the MacPerlFAQ.html  I see that this
little snippet of usefulness is not mentioned there so here is 
a patch suggestion:

--- MacPerlFAQ.html.orig	Wed Jul  7 14:50:56 1999
+++ MacPerlFAQ.html	Wed Jul  7 15:12:53 1999
@@ -203,6 +203,7 @@
 	    <LI><A HREF="#_filesystem">2.3) MacOS file system issues</A>
 	    <UL>
 	      <LI>2.3.1) How do I request an input or output file under MacPerl?
+	      <LI>2.3.1.5) How do I request a folder under MacPerl?
 	      <LI>2.3.2) Why can't I detect aliases in my script?
 	      <LI>2.3.3) How do I pass environment variables to my script?
 	      <LI>2.3.4) How do I perform <CODE>glob</CODE>bing in MacPerl?
@@ -828,6 +829,17 @@
 	The file, <CODE>StandardFile.pl</CODE>. is supplied in the <CODE>lib</CODE>
 	folder. It presents a convenient front-end to the more primitive routine,
 	<CODE>MacPerl::Choose</CODE>, which is discussed in <CODE>pod:macperl.html</CODE>.
+	
+        <H4>2.3.1.5) How do I request a folder under MacPerl?</H4>
+	
+	<PRE>require 'GUSI.ph';
+	
+	$chosen_folder = MacPerl::Choose(&GUSI::AF_FILE(), 0, "Which folder?", "", &GUSI::CHOOSE_DIR);
+ 
+	</PRE> 
+	
+	The file, <CODE>GUSI.ph</CODE>. is supplied in the <CODE>lib</CODE>
+	folder.
 
 	<H4>2.3.2) Why can't I detect aliases in my script?</H4>
 	
End of Patch.

BTW why does the answer to 2.3.1 not mention Mac::StandardFile, that is the
StandardFile.pm in the :lib:Mac: folder?  The example on page 124 of MPP&E
mentions:

           if ($#ARGV < 0) {
               use Mac::StandardFile;
               $file = StandardGetFile('', 'TEXT');
               if ($file->sfGood()) {
                   push(@ARGV, $file->sfFile());
               } else {
                   exit(1);
               }
           }
           print("you picked: $ARGV[0]\n"); 

I noted too that the doc at:

   http://www.macperl.com/depts/fom.html

mentions:

"The current FAQ (version 2.6), is the result of a quick edit on Version 2.5."

whereas the patched document proclaims itself to be version 2.7.  Is this 
a faq-omatic bot issue?

Thanks.

Peter Prymmer


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