Re: tell app, name in string var
Re: tell app, name in string var
- Subject: Re: tell app, name in string var
- From: Christopher Stone <email@hidden>
- Date: Thu, 26 May 2011 11:37:42 -0500
On May 26, 2011, at 10:26, Thomas Fischer wrote: I have similar problems with the Finder and variables, which I don't really understand nor know how to circumvent.
______________________________________________________________________
Hey Thomas,
This is not a variable problem. What's happening is that the Finder won't create posix paths; it is more comfortable with Finder references and aliases.
AND
What Yvan said.
set fPosix to "/Users/chris/test_directory/file.txt" set fAlias to alias "Thor:Users:chris:test_directory:file.txt"
set fPosixFile to (POSIX file fPosix) set fPosixFileFlag1 to fPosixFile exists --> true
tell application "Finder" set faFlag to fAlias exists --> true set fpFlag to fPosix exists --> false try set pfFlag to (POSIX file fPosix) on error e set pfFlagError to e --> Finder got an error: Can’t get POSIX file "/Users/chris/test_directory/file.txt". end try set pfFlag to fPosixFile exists --> true end tell
Other parts of the System are more agnostic about alias, posix file, path string, but you have to experiment a bit to discover how much.
You can however do something like this if you need to:
set fPosix to "/Users/chris/test_directory/file.txt"
tell application "Finder" tell AppleScript to set pfFlag to (POSIX file fPosix) end tell
I generally prefer to work with aliases, and the Finder also supports alias lists which can be operated on en mass.
-- 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