• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: do shell script modifies alias path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script modifies alias path


  • Subject: Re: do shell script modifies alias path
  • From: steve harley <email@hidden>
  • Date: Mon, 15 Mar 2004 11:02:29 -0700

on 3 Mar 2004, at 9:57 PM, Malcolm Fitzgerald wrote:
Would someone explain this to me please.

set f to (choose file)
--> alias "Hogg:Users:malcolm:Documents:ASA:web:logs:error:2004:03-Mar: error_log.2.gz"
set pf to POSIX path of f
get f
--> alias "Hogg:Users:malcolm:Documents:ASA:web:logs:error:2004:03-Mar: error_log.2.gz"
do shell script ("gunzip " & pf)
get f
--> alias "/Users/malcolm/Documents/ASA/web/logs/error/2004/03-Mar/ error_log.2.gz"

why does the do shell script step alter the variable f?

first, it's not the "value" of f that is displayed.. f is an alias object, but the string displayed is just an aspect of f that is convenient and printable -- the path.. as i understand it, internally, alias objects may also contain the file id, which is how a file can be found if it is moved.. to display the string, i suspect AppleScript tries to resolve the alias

i don't know if alias resolution tries the path first or the id first.. in Finder, the behavior was always id-first until Panther, and now it's path-first.. i suspect that AppleScript alias objects use the id-first behavior, and that the last result above is because the id could not be resolved, so Alias Manager fell back on the path.. a side effect is a difference in the string that is displayed.. the alias object might (or might not) also be altered as a result of alias resolution -- this is an option described in Apple's documentation of Alias Manager, but i don't know whether AppleScript specifies it (or whether in this case it's handled at a level below AppleScript):

<http://developer.apple.com/documentation/Carbon/Reference/ Alias_Manager/index.html>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >do shell script modifies alias path (From: Malcolm Fitzgerald <email@hidden>)

  • Prev by Date: Re: How to detect a file has resource fork, or not?
  • Next by Date: Re: How to detect a file has resource fork, or not?
  • Previous by thread: Re: do shell script modifies alias path
  • Next by thread: reading Unicode text files before AS 1.9.1
  • Index(es):
    • Date
    • Thread