Re: POSIX Puzzle
Re: POSIX Puzzle
- Subject: Re: POSIX Puzzle
- From: "koenig.yvan" <email@hidden>
- Date: Wed, 11 Jul 2012 21:12:21 +0200
Le 11/07/2012 à 20:45, R. Nelson Byrne a écrit : Please, a little help here. I'm confused. I made this little script which illustrates my concern
------------------------------------------ "/private/var/folders/23/vx0c8c0r8xj82n0059b65rpr0000gn/T/AppleScript Editor.BESFhVT9/logfile.txt" returning logfile
(POSIX file logfile) as alias returning thething tell application "TextEdit" to open the thething log ("It works")
tell application "TextEdit" to open ((POSIX file logfile) as alias) ------------------------------------------
When I run it I see this in the Events/Replies window:
------------------------------------------ tell application "TextEdit" open alias "Lion:private:var:folders:23:vx0c8c0r8xj82n0059b65rpr0000gn:T:AppleScript Editor.BESFhVT9:logfile.txt" --> document "logfile.txt" end tell (*It works*) tell application "TextEdit" get POSIX file "/private/var/folders/23/vx0c8c0r8xj82n0059b65rpr0000gn/T/AppleScript Editor.BESFhVT9/logfile.txt" --> error number -1728 from POSIX file "/private/var/folders/23/vx0c8c0r8xj82n0059b65rpr0000gn/T/AppleScript Editor.BESFhVT9/logfile.txt" open alias "Lion:private:var:folders:23:vx0c8c0r8xj82n0059b65rpr0000gn:T:AppleScript Editor.BESFhVT9:logfile.txt" --> document "logfile.txt" end tell Result: document "logfile.txt" of application "TextEdit"
------------------------------------------
OK, it does indeed work, in spite of the error message. TextEdit opens "logfile.txt".
But still, why the error????????
Here is the clean code which I would use to achieve your goal :
path to desktop as text POSIX path of result & "liste des applications.txt"
tell application "System Events" to path of disk item result
tell application "TextEdit" to open (result as alias)
or :
path to desktop as text POSIX path of result & "liste des applications.txt"
POSIX file result
tell application "TextEdit" to open result
or :
path to desktop as text POSIX path of result & "liste des applications.txt"
tell application "TextEdit" to open result
My guess is that your error is that you are triggering a Standard Additions function in a tell application block. Doing that generate an error.
Yvan KOENIG (VALLAURIS, France) mercredi 11 juillet 2012 21:02:25
|
_______________________________________________
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: | |
| >POSIX Puzzle (From: "R. Nelson Byrne" <email@hidden>) |