Copy link to clipboard
Copied
Hello community, i'm a french retoucher and new to scirpting in photoshop.
The title says it all :
When i record the execution of a default script like "flatten all masks", i get the right step name "flatten the masks" in french in the panel action, but for a every script of mine it displays "script" and i have to develop the step to see what it is.
I tried several things but nothing works so far.
And i precise that i don't know enough to go trough scripting panels and plugins.
Thanks a lot !
Have learn most of what i know about scritping here.
Open source and add this to the beginning of every script you use. Set the name of the script in the menu and the name of the script in the action as you like.
UUID (type number 868572e6-d71e-4495-8a92-f8968960bb63) for each script it is better to generate your own.
Passing any parameter is needed for the Photoshop script to write them to the panel. I decided to put the name of the script file there.
/*
<javascriptresource>
<name>My script name</name>
<eventid>868572e6-d71e-4495-8a92-f
...
Copy link to clipboard
Copied
No, the label script tells what type of command or step was done. You have to open up the step to see what the actual name of the script is. It would be nice though.
Copy link to clipboard
Copied
Thanks you, ok that's too bad !
Copy link to clipboard
Copied
Open source and add this to the beginning of every script you use. Set the name of the script in the menu and the name of the script in the action as you like.
UUID (type number 868572e6-d71e-4495-8a92-f8968960bb63) for each script it is better to generate your own.
Passing any parameter is needed for the Photoshop script to write them to the panel. I decided to put the name of the script file there.
/*
<javascriptresource>
<name>My script name</name>
<eventid>868572e6-d71e-4495-8a92-f8968960bb63</eventid>
<terminology><![CDATA[<< /Version 1
/Events <<
/868572e6-d71e-4495-8a92-f8968960bb63 [(My script name label)<<
>>]
>>
>> ]]></terminology>
</javascriptresource>
*/
(d = new ActionDescriptor).putString(stringIDToTypeID("null"), decodeURI(new File($.fileName).name));
app.playbackParameters = d;
Copy link to clipboard
Copied
You are awesome, that is exactly what i wanted, it works !
what is the eventid for ? how can i generete it ? i can put anything ?
Copy link to clipboard
Copied
This is a unique text string used to identify the script and passing parameters, both when launched from the Action Pane and when launched from other scripts. It can be anything, the main thing is that there are no repetitions with other scripts. The easiest way is to generate a random value, for example here:
Copy link to clipboard
Copied
understood, it works perfectly ! thanks a lot !
Copy link to clipboard
Copied
Your script works as should, but I wanted to go step further and do something specific.
I create actionSet, where I insert empty action. Then the specific case starts (as opposed to basic destination your script was created for). I start recording the action. From 'File / Scripts' I click my script which begins with your code.
Normally if I didn't use your 'Javascript Resource' at beginning of my script, the content of expandable action item would be writen this way:
File: C:\Users\User\Desktop\script.jsx
When using your code at beginning of my script that content is as follows:
File: C:\Users\User\Desktop\script.jsx
script.jsx
As you see the variable specified in your code was added below the regular full path of script.
Remember I don't create action by inserting menu item, but I first start recording and then I click a script from scripts list. My goal is to display in action item content only specified information, so without the path that's recorded to the item in first instance. I doubt that can be easily done with Javascript Resource, but let's see if you have any idea.
You may ask what it is all for. Actually that is no matter. I'd like only to know some solution for described scenario, but if you're curious, after I start recording, I initiate the script that listen to Photoshop events. Each time the event is captured, the script (with its path) is written to action (beside some other items). All would be okey if I started recording manually, then only my doings would be recorded to action, but the problem is the action is started recorded by script, and that implies the Photoshop sees it as outer, non-human task, so records also events that like I said are displayed by adding 'Scripts' action item with its path content. This extra explanation is not important over here. The only first part of my post is matter 😉
Copy link to clipboard
Copied
As far as I understand, Photoshop works correctly with 'eventid' only if the script is in the presets folder. Have you reassigned this folder to your desktop?
In any case, I could not wtite action item in the format
File: C:\Users\User\Desktop\script.jsx
script.jsx
I always use 'javascriptresource' precisely for the purpose of writing user-modifiable variables to an action. That is, i never insert a menu item, but always record the call to the script.
If you do not need variables in action item, then you can pass any variable not listed in the 'Events' list.
In both cases, the variable will be visible using the ScriptListener.8li, but I haven't found a way to get it in any other way (via notifiers). Is there a secret way?