• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Add even in event manager

Engaged ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

I need an event before save. In other words triggreed by save but run before photoshop saves.

TOPICS
Actions and scripting

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Event handlers are triggered after the Photoshop event completes. There is no before or at start of event option available for any event handler. And I know of no way to intercept Photoshop Save and Save as command which is what you seem to be wanting to do. What would trigger or automate your pre-save event you want to add.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

So I'm tagging a file with metadata when the user saves the file. However I have to save the document a second time because obviously if i change the file it needs saved again. Unfortunately this makes it just a little bit slower and is inefficient. But if the user pressed save it changed the metadata and then saved it would save a step and be more efficient. This type of functionality exists with event listeners in InDesign and i was hoping for a similar functionality.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

If the user is doing the save manually Setup an Action for them to use instead of using menu File>Save or File>Save As record an action. That the first step is menu File>Scripts>YourMetaDataScript and the second step is an Interactive save step.  You could use insert menu item and choose menu File>Save or Save As.   That will be an interactive save the same as if they used the menu themselves.   You could assign an Fkey shortcut to that sction. Additionally you could change their Shortcuts  for Ctrl+S and Shift+Ctrl+S  to run a script The would be the same as your metadada script with the adition of and interactive save at the end.  The shortcuts are Photoshop Save and Save As shortcuts.  To Automate the Process for them you have to change their Photoshop environment. If you want to avoid the double save I do not think you can do the by adding a script event. How would you automate triggering the event befor a save.  You avoid the double save you have to make your script process the first part of Save.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

So there are actually two scripts. This one runs on start up.

  if (BridgeTalk.appName == "photoshop"){

"Macintosh"==File.fs?a="/Library/Application Support/Adobe/Photoshop_Resource/User_Date.jsx":a="Photoshop_Resource\\User_Date1.0.jsx";

            app.notifiersEnabled = true;

           var eventFileOpn = new File(a);

   

   try{

                app.notifiers.add("save", eventFileOpn);

            }catch(e){}

        }

Then it runs the other script that adds the metadata and saves the file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Is there any document that describes the different kinds of events that can occur?

"eventstringThe class id of the event, four characters or a unique string."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

LATEST

I remember reading something about adding your own event to the Script Event managers list of supported events.  It involved using Adobe event ID that are listed in the appendix of one of the scripting manuals. So you can set up a Script Event manager event for the Photoshop events that are not  supported in the Script Event managers default list of events.  The thing is they are Photoshop events and I do not know of a Photoshop event that would be a starting to save event.  An event you could setup would be a Open Document event.  When an existing document is opened you handler could look at the document existing metadata and if your metadata is not present you could add that data.  If the use then saves the document with save or save as the document saved will have your metadata. Using Save for web may well strip your metadata.  All image files do not have metadata it can easily be stripped off.  That Is Adobe default mode of operation for save for web to reduce file size a little more.  There is also a Script I believe in the Photoshop Javasctipting manual used to retrieve Photoshop event IDs.

Capture.jpg

To get around Adobe CC 2015.5 and CC 2017 Scripting designer bug I add garbage to document metadata if its not there.  Your User ID Photoshop Preferences Script Event Manager xml file is updated in your preferences is updated when you add  event handlers.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines