Copy link to clipboard
Copied
Copy link to clipboard
Copied
Play with putCustomOptions(), getCustomOptions() and eraseCustomOptions().
Copy link to clipboard
Copied
Thank you for providing the functions. Can the getCustomOptions() get the name of an action Set and action from the Actions Pallet?
Copy link to clipboard
Copied
Look at the scripts that come with Photoshop. Getting list of actions is well written in the image processor.jsx
Copy link to clipboard
Copied
Thank you for the suggestion. I looked at the imageprocessor.jsx and had a difficult time making sense of the long script. Are there any simple examples of how to display the action set and actions in a dialog UI window?
Copy link to clipboard
Copied
No it can't. But it can remember last user value entered (optionally when Photoshop is relaunched).
Copy link to clipboard
Copied
This will remain even if you restart InDesign.
//save
app.insertLabel("foo", myString);
//load
var myString = app.extractLabel("foo");
Copy link to clipboard
Copied
Thank you will try in Photoshop.
Copy link to clipboard
Copied
I'm very sorry, I mistaken for InDesign because I had multiple windows open.
I don't think there is any other function that can hold the value even after restarting the application. It may be necessary to read / write to a text file with invisible attributes.
By the way, to get the action set and the action name surely, the description by the action descriptor obtained by ScriptListener should be indispensable.
Copy link to clipboard
Copied
Yes, there is such function that holds data after relaunching Ps. It's that I mentioned in this thread.
Copy link to clipboard
Copied
That's the same that customOptions does in Photoshop.
Copy link to clipboard
Copied
Hello Kukurykus,
I have a similar question. I'm entering a value manually in the Median filter with DisplayAllDialog True: lets say 12. Then I accept this value. The second time around i want to repeat this action with the same value entered by the user but this time with DisplayNoDialog. How would one query the last entered value with descriptors? I'm doing this in Python but a js equivalent would help me figure this out.
def apply_median(median_value, open_dialog=False):
action_name = apply_median.__name__
action_manager = ActionManager(action_name)
with action_manager as am:
s2t = am.convert_id
app = Dispatch("Photoshop.Application")
desc_13 = am.gen('descriptor', 'desc_13')
dialog = None
if open_dialog:
dialog = am.dialog_mode_all
else:
dialog = am.dialog_mode
desc_13.PutUnitDouble(s2t('radius'), s2t('pixelUnit'), median_value)
app.ExecuteAction(s2t('median'), desc_13, dialog)
print(f'{action_name=} executed')
Copy link to clipboard
Copied
executeAction(stringIDToTypeID('median'))
Copy link to clipboard
Copied
//input variables
var settingsNameUniqueString = 'your script name',
text1 = 'sample text 1',
text2 = 'sample text 2',
text3 = 'sample text 3'
//saving settings
var d = new ActionDescriptor
d.putString (s2t('t1'), text1)
d.putString (s2t('t2'), text2)
d.putString (s2t('t3'), text3)
app.putCustomOptions (settingsNameUniqueString, d)
//reading settings
var d = app.getCustomOptions (settingsNameUniqueString)
alert (d.getString (s2t('t1')))
alert (d.getString (s2t('t2')))
alert (d.getString (s2t('t3')))
function s2t(s) { return app.stringIDToTypeID(s) }
Copy link to clipboard
Copied
Hello, I'm not sure if the file info part of Photoshop is a JSX found somewhere, but they implemented the same function recently.
Copy link to clipboard
Copied
I do this by saving an XML file with settings, that way I can store whatever I want. Defaults are hard-coded.