Create action to define a pattern using current file name - PS 2026
Hi, I'm trying to create an action that defines a pattern, but when recording, the action will use the name of the document I used to record the action, not the document I'm currently using the action with. For example, if I record the action with a floral pattern named "flowers.psd", and then try to perform the action on a geo pattern named "geo.psd", the action will load the geo pattern into the pattern presets but will name it "flowers.psd".
I found some previous answers with javascript templates to use, but they are all quite old and when I try to use them Photoshop tells me there are errors in the script. I'm familiar with implementing jsx files, but I'm not experienced in writing or editing, so I don't know how to troubleshoot the actual code. Would love some help here as this would save me soooo much time if I could make it work. Thanks!
I am using Adobe Photoshop 2026 on Sequoia 15.6
This is the old thread I was referencing, neither of the codes here work for me:

