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

RE: [MacPerl] several dumb questions



At 9:22 11/1/96, Steve.Henrichs@hbo.com wrote:
>       The following code fragment will return the name of your machine:
>
>       @thevols = MacPerl::Volumes();
>       $mymachine = $thevols[0];
>       $mymachine =~ s/^.*://;
>       print "$mymachine\n";

No, that won't do.  That is the name of the system volume, not the machine
name.  The machine name is the name of the machine as written in the
Sharing Setup control panel (although, admittedly, they are often the exact
same thing, but there is no reason why they have to be the same thing).
And in order to get that, I believe you need the Perl/AppleScript code I
posted a couple days ago:

$macName = &MacPerl::DoAppleScript('get machine name of (sharing information)');
#'Sharing Information' dictionary required in Scripting Additions folder.

Now, if you are sure that the system volume will always (for the purposes
of the script) be the same as the machine name, then your code will do
fine.

#================================================================
perl -e 'srand();if(rand>.5){$i=0;foreach(@ARGV){@$i=split(//);$z
[$i]=0;foreach(@$i){$s[$i][$z[$i]]=$_;$z[$i]++;}$i++;}foreach(@s)
{foreach(@$_) {print}print" ";$_++}}else{print(join(" ", @ARGV))}
print"\n"' McClellan Clan Motto: Think On

Chris Nandor                                       pudge@pcix.com
PGP Key 0xB76E72AD                    http://pudge.petersons.com/