Set current document in Photoshop CS3
Set current document in Photoshop CS3
- Subject: Set current document in Photoshop CS3
- From: "Fleisher, Ken" <email@hidden>
- Date: Mon, 01 Feb 2010 10:00:49 -0500
- Thread-topic: Set current document in Photoshop CS3
Title: Set current document in Photoshop CS3
Hello. I am having trouble with scripting Photoshop. I am using the following code to create a new document and then do actions on it:
tell application "Adobe Photoshop CS3"
set curDoc to current document
tell curDoc
set doc20 to doc duplicate name rootName & "_20-OL.tif"
end tell
set current document to document (name of doc20)
tell doc20
-- code that works on doc20
Unfortunately, after Photoshop duplicates the document (and I know it works because I can see the new document with the new file name), Photoshop does not recognize that the document exists and I cannot make doc20 the current document. I have tried the following:
tell application "Adobe Photoshop CS3"
set curDoc to current document
tell curDoc
set doc20 to doc duplicate name rootName & "_20-OL.tif"
end tell
repeat until (document name of doc20 exists)
end repeat
log (exists document name of doc20)
set current document to document (name of doc20)
tell doc20
-- code that works on doc20
But I just get the following result, even though I know the document exists:
exists document "Adobe Photoshop CS3" of document "A-4630105_20-OL.tif"
false
The script actually works as long as I only have one image open to begin with, but it fails when I have two or more images open to begin with. I’m not sure why that makes a difference, but it does.
Any ideas on what I’m doing wrong or how to work around this? Thanks in advance for any help you can provide!
Ken
--
Ken Fleisher
Photographer
Imaging & Visual Services
National Gallery of Art
Washington, D.C.
Phone: (202) 712-7471
email@hidden
_______________________________________________
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