Applescript execution error

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Applescript execution error

Post by stam » Thu Aug 10, 2023 12:08 pm

RobertC wrote:
Sat Aug 05, 2023 10:51 am
Yet, that must happen during actual execution, because this works in the editor and in KM:

Code: Select all

tell application "Finder"
set A to ":Users:robertcailliau:Doc"
set B to "uments:Alphabetical:C:Chronological:1990s:19"
set C to "98:1998-01-20 Salon:Salon.mov"
	get (creation date of file ((A&B&C) as alias)) as text
end tell
but fails in LC. (OK, too many parentheses, I just wanted to be very explicit).
Excellent example that highlights the issue Robert.

It's definitely something with the way LC does AppleScript - I used your code verbatim, just changing the alias to point to a file in my Documents folder but still split over 3 lines. As you found, it works perfectly in the AppleScript script editor but produces an execution error in LC.

Simply adding Macintosh HD before :Users fixes the issue - so it's not the closing parenthesis that is the issue - I guess LC's version of AppleScript doesn't like relative paths and needs an absolute AppleScript file path - practically it may be easier to use the POSIX paths we're all used to now and use the POSIX file command I mentioned:

Code: Select all

set <appleScriptPath> to POSIX file <posixPath> 
Best regards
Stam

Post Reply

Return to “Mac OS”