Re: Mac OS alias from Perl

[email protected] (Chris Nandor)
Newsgroups perl.macosx
Organization Pudge.Net
Message-ID <[email protected]>
In article <p06230900c3817c1e511f@[203.8.112.3]>,
 [email protected] (Peter N Lewis) wrote:

> At 19:01 -0500 8/12/07, Dan Neville wrote:
> >Does anyone know how to make a Mac OS alias in Perl?  So, I wish to 
> >have Perl create aliases in multiple directories rather than copy 
> >the original file.
> 
> There actually is no API call to create an alias file.
> 
> You can do it in Perl as described at
> 
> <http://use.perl.org/~pudge/journal/10437>
> 
> Alternatively, you can make a new alias via AppleScripting the Finder as:
> 
> set thaAlias to "Harddisk:Users:peter:thefile.cpp" as alias
> 
> tell application "Finder"
> 	set f to make new alias file at desktop to thaAlias
> end tell
> f
> 
> Which will return the alias file created.

Also, you can do:

   use Mac::Glue ':all';
   my $finder = new Mac::Glue 'Finder';
   print $finder->make(
      new => 'alias',
      at  => $finder->prop('desktop'),
      to  => $finder->obj(file => "/Users/peter/thefile.cpp")
    # or:
    # to  => $finder->obj(alias => "Harddisk:Users:peter:thefile.cpp")
   );


-- 
Chris Nandor                      [email protected]    http://pudge.net/
Open Source Technology Group       [email protected]     http://ostg.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.