Following the 'Changes to Photoshop CS5 and Applescript' thread. I'd like to emphasis that AppleScript support is way broken in CS5.
We have compiled scripts which fail to execute properly. Once this happens, every AppleScript command then fails including trying to compile new commands using the script editor.
This breaks our application which was working great for years on CS3 and CS4.
What can be done?
The script makes direct reference to CS5 --> tell application "Adobe Photoshop CS5"
The script executes a few commands and at one point it fails to fetch the height of a document.
I'm getting the following error:
get height of document "Master.tif"
--> error number -1728 from height of document "Master.tif"
Once this happens, every subsequent AppleScript command fails :
get current document
--> error number -1728 from current document
I must restart for Photoshop to get back to the first point.
To reproduce the issue :
1. Place an "image.tif" on your desktop
2. Open another image in Photoshop
3. Run the following script
tell application "Adobe Photoshop CS5"
set masterDocument to current document
open file ((path to home folder as string) & "Desktop:image.tif")
height of masterDocument
Well no, the masterDocument variable is pointing to the document currently opened before running the script (see step 2 above).
I'm asking for the height of this first document (not the one the script opens). This is working fine in CS3 (and CS4 I think).
Anyway this is just a sample code which triggers the bug. After that, even asking for the 'current document' returns an error.
With that I hope you can reproduce and debug the issue.
I totally second that, Applescript is completely broken.
Launching script editor before you launch any script and getting the Photoshop CS5 dictionary works, but launch any script, it will fail and then try to get the applescript dictionary again and it won't show anything specific to photoshop (just the item any cocoa app has).
It's a terrible bug, I have to revert to PS4 and stop CS5 deployment !