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

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






On Mon, 5 Jul 1999, Darryl Tang wrote:

> Second, is there a way to control whether or not a file is visible or not?
> I'd like to search my hard drive to see which files are invisible.  I'd
> also like to change a file's visibility status from MacPerl.  I couldn't
> find anything in my Power and Ease book or the MacPerl manual pages.

I'm just a beginer with perl and macperl so take what I offer with a grain 
of salt.  That said, the following seems to do what you want:

#!perl

use Mac::StandardFile;
use Mac::Files;


my ($pointer, $x, $y, $att, $val);


$att = MacPerl::Pick('Mae the file:', ('visible', 'invisible'));
if ($att eq 'visible') {
		$val = 256; #what my test file was set to at start

} else {
		$val = 16384; #icon is invisible in finder
}

$pointer = StandardGetFile(0, -1);
if ($pointer->sfGood()) {
		open (IN, $pointer->sfFile()) || die($!);
		$x = FSpGetCatInfo($pointer->sfFile()) || die($!);
		$y = $x->ioFlFndrInfo();
		$oldval = ($y->fdFlags());
		print "previous flag setting: $oldval \n";
		$y->fdFlags("$val");
		$x->ioFlFndrInfo($y);
		FSpSetCatInfo($pointer->sfFile(), $x) || die($!);
		close (IN);
}



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


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