• 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
Error on make new alias on afp mounted volume
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error on make new alias on afp mounted volume


  • Subject: Error on make new alias on afp mounted volume
  • From: Jim Skibbie <email@hidden>
  • Date: Sat, 21 Jun 2008 13:17:40 -0500
  • Thread-topic: Error on make new alias on afp mounted volume

Title: Error on make new alias on afp mounted volume
I’m trying to make a Finder alias (not an Applescript alias) to a folder on an afp mounted volume and then label the desktop alias red (label index = 2). The weird thing is that sometimes this script works and sometimes I get an error when trying to set the label index value.

In all instances, the alias on the desktop is created, but sometimes the folder is turned to red and sometimes the script errors at that point.

Here’s the script:

set x to alias "Client Volume:Job Folders:12345 Client:12345 Master:Supplied Files:Item 987654321:"
tell
application "Finder"
   set NewAliasFolder to make new alias at ((folder "Desktop" of home) as alias) to (x) with properties {name:"new alias folder"}
   set label index of NewAliasFolder to 2
end
tell


When the script is successful at turning the alias label color to red, the value NewAliasFolder is a reference object (alias file):
alias file "new alias folder" of folder "Desktop" of folder "jim" of folder "Users" of startup disk

When the script fails, the value NewAliasFolder is a reference object (document file):
document file "new alias folder" of folder "Desktop" of folder "jim" of folder "Users" of startup disk

In Script Debugger, when it is a document file, all of the objects like bounds, class, comment, etc. including label index all have values that say “Get failed: no such object (e.g. Specifier asked for the 3rd, but there are only 2) (errAENoSuchObject:-1728).

The only way I can get this to work reliably is to add another line before the set label index to force the Finder to ‘re-establish’ the variable as an alias file.

tell application "Finder"
   set NewAliasFolder to make new alias at ((folder "Desktop" of home) as alias) to (x) with properties {name:"new alias folder"}

  fixed by inserting this -->   
set NewAliasFolder to item (((folder "Desktop" of home) as string) & "new alias folder")

    
set label index of NewAliasFolder to 2
end
tell

Do I have some syntax wrong? I don’t understand how it can work some of the time and other times fail.

Thanks.
Jim
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Error on make new alias on afp mounted volume
      • From: Ed Stockly <email@hidden>
  • Prev by Date: Re: Applescript, RSync and Tutorials
  • Next by Date: Re:Display Dialog
  • Previous by thread: Re: Applescript, RSync and Tutorials
  • Next by thread: Re: Error on make new alias on afp mounted volume
  • Index(es):
    • Date
    • Thread