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

Re: [MacPerl] Some Ridiculous Newbie Questions re Mac::Files, e



>1.) How can I get a MacOS 8.5+ (?) style dialog like one that will allow
>the user to select a directory (in this case, their MacMAME base
>directory), so the contents of a directory relative to that directory can
>be opened and read?

This:

    if ($#ARGV < 0) {
        $file = StandardGetFile('', 'TEXT');
        if ($file->sfGood()) {
            push(@ARGV, $file->sfFile());
        } else {
          exit(1);
    }

puts up a dialog that allows you to pick a single file.  However, "$file" 
is loaded with the complete PATH to the file, so if you want the folder, 
rather than a file within it, you should be able to truncate the path to 
the last delimiter ":".  Note that the above assumes that you save the 
Perl script as a droplet and the STANDARD method of use is to drag and 
drop the required folder on it.

>2.) For the above, as well as the dialog in which they select their "MAME
>Game List," is there an easy way to print a simple message in the dialog
>box (e.g., "Select your MacMAME Directory:" and "Select your MAME Game
>List File:")?

You could use Mac::Dialogs to create a custom dialog, or GUSI allows you 
to "Choose" directories and files (also an alternative to the above). 
Most of this *IS* in MPPE.

>3. After the work is done, is there an easy way to set the file's
>type/creator codes to "TEXT/ttxt" rather than the default MPW document?

Since you're already using Mac::Files:

sub change_creator {
    my $has = FSpGetFInfo($file);
    $has->fdCreator("ttxt");
    $has->fdType("TEXT");
    FSpSetFInfo($file, $has);
}


# Brian McNett                                      Fungal Parataxonomy
# Webmaster, Staff Writer               Mycology Information (Mycoinfo)
#                              **The World's First Mycology E-Journal**   
# <mailto:webmaster@mycoinfo.com>            <http://www.mycoinfo.com/>
# First they ignore you. Then they laugh at you. Then they fight you.
# Then you win.                                     --Mohandas Gandhi


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