• 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: list of aliases
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list of aliases


  • Subject: Re: list of aliases
  • From: kai <email@hidden>
  • Date: Wed, 27 Apr 2005 19:12:19 +0100


On Tue, 26 Apr 2005 19:05:07 -0500, Jim Brandt wrote:

Can someone tell me why this line of code:

set theList to (every item of alias hold_folder whose kind is not "folder") as alias list

works if there are two or more files (non-folders) in hold_folder but fails if there is a single file in hold_folder.
The error is:


"Can't make alias \"HD1:InfoMac: Hold:asv2n0124.txt\" into a « class alst»."

Is there a work-around for a single file situation?

The curious thing about this bug is that, according to Script Editor's event log, the initial coercion of a single item list appears to be successful. For some reason, the result is apparently never returned, resulting in an error number -1700 (bad parameter data or unable to coerce the data supplied). So no value is assigned to a variable, and the statement in the error handler is then executed:


----- script:

set f to (path to "desk" as Unicode text) & "test folder"

tell application "Finder" to try
	set l to folder f's files as alias list (* coercion 1 *)
on error number -1700
	set l to folder f's files as alias as list (* coercion 2 *)
end try

----- event log:

tell current application
	path to "desk" as Unicode text
		"Macintosh HD:Users:kai:Desktop:"
end tell
tell application "Finder"
	get every file of folder "Macintosh HD:Users:kai:Desktop:test folder"
		{alias "Macintosh HD:Users:kai:Desktop:test folder:test file"}
		(* coercion 1 *)
	get every file of folder "Macintosh HD:Users:kai:Desktop:test folder"
		{alias "Macintosh HD:Users:kai:Desktop:test folder:test file"}
		(* coercion 2 *)
end tell

-----

Note that an empty list is not an issue in this type of situation, so it's not strictly necessary to trap such an eventuality. For this reason, the above form (as previously suggested by Paul to Adam) still seems to be the most effective workaround.

---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Settings in Microsoft entourage
  • Next by Date: General questions from a non-Applescript coder.
  • Previous by thread: Re: list of aliases
  • Next by thread: Re: list of aliases
  • Index(es):
    • Date
    • Thread