• 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: tell app, name in string var
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tell app, name in string var


  • Subject: Re: tell app, name in string var
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 28 May 2011 05:25:32 -0500

On May 27, 2011, at 18:39, Shane Stanley wrote:
The AppleScript team has frowned on using "alias someHFSPath" in a try block, but it's solid and quick. The shell command test might be another alternative.
______________________________________________________________________

Hey Folks,

Let them frown.  We've been using it for well over a decade.  As Shane says "it's solid and quick".  It takes about 0.001 seconds to run, although it's a trifle slower in a Finder Tell block.  It's versatile.

set theFile to "Thor:Users:chris:test_directory:file.txt.falseExtension"

try
theFile as alias
on error errMsg number errNum
set e to "Error: " & errMsg & return & "Error Number: " & errNum
end try

set theFile to "/Users/chris/test_directory/file.txt.falseExtension"

try
alias POSIX file theFile
on error errMsg number errNum
set e to "Error: " & errMsg & return & "Error Number: " & errNum
end try

tell application "Finder"
try
POSIX file theFile as alias
on error errMsg number errNum
set e to "Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell

--
Best Regards,
Chris

 _______________________________________________
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

References: 
 >Re: tell app, name in string var (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: tell app, name in string var
  • Next by Date: Re: Load Script
  • Previous by thread: Re: tell app, name in string var
  • Next by thread: Re: tell app, name in string var
  • Index(es):
    • Date
    • Thread