Create New Script for Photoshop CS2

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

compupix

Create New Script for Photoshop CS2

Post by compupix »

I am trying to create a script for Adobe Photoshop CS2 that selects a window workspace. I would like the script to run when Photoshop launches.

(The workspace is not saved from session to session because of the way my 2 monitor system is setup. I wish it would just open up the way I left it! It seems to have a problem with the main window being on the secondary monitor and the palettes being on the primary monitor.)

I have an action created that selects the desired workspace. The action works, but Photoshop asks if I want to save the existing workspace. (I haven’t figured out how to avoid that question.) But, the action works.

I am trying to execute this action when Photoshop opens.
Should I be using the event "Open Photoshop" or "Start Application?"
I’ve tried both. Neither works.
When I use "Start Application" I get an error:
"Error 25: Expected: ).
Line: 3
-> doAction("d Drew’s Standard Workspace", "Drew's Actions");"
When I use "Open Photoshop" nothing happens when Photoshop opens.

These are the steps I used to assign the action to either "Open Photoshop" or "Start Application":

Launch Photoshop CS2
File > Scripts > Scripts Events Manager
Check Enable Events to Run Scripts/Actions:
Photoshop Event: {this is where I tried each: "Start Application" and "Open Photoshop"}
Dot next to Action
Select: Drew's Actions
Select: d Drew's Standard Workspace
Click: Add

When there is already an event in the list and I try to add a new one, it clobbers the existing event and creates TWO new events:
Start Application: d Drew’s Standard Workspace Action
And
Open Photoshop: d Drew’s Standard Workspace Action

And it clobbered the existing “fit on screen” event!

When I remove all events and re-assign the "fit on screen" event, the "fit on screen" event works.

How do I go about adding an event to use my Standard Workspace action?

Thank you very much.
xbytor

Create New Script for Photoshop CS2

Post by xbytor »

Code: Select all"Error 25: Expected: ).
Line: 3
-> doAction("d Drew’s Standard Workspace", "Drew's Actions");"

Post up the rest of this script. Let's get that problem taken care of first.
compupix

Create New Script for Photoshop CS2

Post by compupix »

Shouldn't we first establish which Photoshop Event is the right one to use?
To run an action when Photoshop first opens, which event is appropriate? Start Application or Open Photoshop?
xbytor

Create New Script for Photoshop CS2

Post by xbytor »

You have a syntax error in your javascript. Until you get that fixed, you can't tell whether and event is working or not.
compupix

Create New Script for Photoshop CS2

Post by compupix »

I don't have any Java Script. Any code that has been created has been by Photoshop.
xbytor

Create New Script for Photoshop CS2

Post by xbytor »

I tracked down the problem. The error message was slightly misleading. The actual code that CS2 generates is something like:
Code: Select all// 8eabd3c5-dcb2-4967-8f4d-f40e2f20476a, Start Application, XToolkit, jsh
try {
     doAction( 'jsh', 'XToolkit' );
}
catch( e ) { }


Notice the ' characters. Because of the way that CS2 generates this bit of code, you can't have ' characters in the name of your Action or your ActionSet. I consider it a bug. The simplest fix is to remove the ' characters from your names.

-X
compupix

Create New Script for Photoshop CS2

Post by compupix »

Thanks.
I got rid of the apostrophes and that got rid of the error message.
The script does NOT yet run when Photoshop starts up.
I have it assigned to Photoshop Event: "Open Photoshop."
Andrew

Create New Script for Photoshop CS2

Post by Andrew »

I just tested this using Start Application as my event and loading a workspace and it worked fine.

One thing it won't do is run an action containing a step that runs a script but you're not doing that.

Andrew
Andrew

Create New Script for Photoshop CS2

Post by Andrew »

Maybe I missed the point of the earlier post about multiple events. Can you explain more what you are doing. If both actions (fit on screen and load workspace) are for the same event why not combine the actions.

Andrew
compupix

Create New Script for Photoshop CS2

Post by compupix »

"Start Application" worked!
(Too bad they don't offer hints as to the difference between "Open Photoshop" and "Start Application.")

How do I turn off the warning message: "Do you want to save changes in the current shortcut file before resetting the shortcuts?"