• 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
Fwd: problem with POSIX path of …
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: problem with POSIX path of …


  • Subject: Fwd: problem with POSIX path of …
  • From: Yvan KOENIG <email@hidden>
  • Date: Tue, 13 Sep 2016 22:21:10 +0200


Oops, I posted this answer to Mitchell L Model

Le 13 sept. 2016 à 19:44, Mitchell L Model <email@hidden> a écrit :

I don't understand why the behavior at Point 5 is different rom the behavior at Point 1. (That is, why at Point 5 your message says it is not surprising to get an error on accessing the POSIX path.)

On Sep 13, 2016, at 10:33 AM, Yvan KOENIG <email@hidden> wrote:

POSIX path of (o's tempFolder) --> "/Users/yvankoenig/Desktop/transfert_trefsnart/"

tell application "TextEdit"
try
log "Point 1"
POSIX path of (o's tempFolder)
on error errMsg number errNbr
log "error #" & errNbr & ", " & errMsg
log "Point 2"
end try
try
log "Point 3"
tell me to get (POSIX path of (o's tempFolder))
on error errMsg number errNbr
log "error #" & errNbr & ", " & errMsg
log "Point 4"
end try
end tell

tell application "System Events"
try
log "Point 5"
POSIX path of (o's tempFolder)
on error errMsg number errNbr
log "As I am in a tell application block I'm not really surprised to get :" & linefeed & "error #" & errNbr & ", " & errMsg
log "Point 6"
end try
try
log "Point 7"
tell me to get (POSIX path of (o's tempFolder))
on error errMsg number errNbr
log "But here, as I use the « tell me » tip, I'm REALLY bored to get :" & linefeed & "error #" & errNbr & ", " & errMsg
log "point 8"
end try
end tell




Calling a function belonging to an OSAX in a tell application block is more or less forbidden.

At first I faced the problem while working with a tell application "System Events" block.
Knowing the rule, I started with
tell me to get (POSIX path of (o's tempFolder)
which matches the syntax described by Apple to get rid of the system requirements.
I faced an error so I encapsulated the instruction in a try … on error … end try block with the comment saying that I'm REALLY bored to get this error.
As I am curious, I inserted the block Point 5 … Point 6 to see if the instruction without the tell me to intro failed too. With AppleScript we may have surprises.
I was not surprised when I got the expected error.

Being really curious, I decided to make tests with more than 10 other applications.

The block Point 1 … Point 4 is just a sample of what I got with these numerous apps.
No need to be surprised by the block Point 3 … Point 4 which match Apple requirements.
I was a bit surprised by the fact that the block Point 1 … Point 2 doesn't issue the expected error, but as I wrote above , with AppleScript we may have surprises.

My true problem is the behavior of the block Point 7 … Point 8. Why is it issuing an error although the Apple's rule is matched ?

I hope that this time it's clear.
But maybe you weren't aware of the rule about call to OSAX's functions in a tell application block.


Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mardi 13 septembre 2016 21:53:24




 _______________________________________________
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

  • Prev by Date: Re: problem with POSIX path of …
  • Next by Date: Re: problem with POSIX path of …
  • Previous by thread: Re: problem with POSIX path of Š
  • Next by thread: Need to remove Dock icon
  • Index(es):
    • Date
    • Thread