Skip navigation
Currently Being Moderated

Variables in an action to use in script

Aug 4, 2012 7:34 PM

I want to duplicate an image, then change the duplicated image name to the original image name with some extra text at the end to make it slightly different.

 

Example.

 

Original..    Image123

Duplicate...  Image123BW. Or Image123BG. etc.

 

So as not to have to have a separate script for each different text addition I wondered if I can have a variable in the action that can be passed to the script to add to the new document name?

 
Replies
  • Currently Being Moderated
    Aug 5, 2012 2:26 AM   in reply to ocphotog

    One crude approach might be to have the Action create a Layer of a specific name and have the Script evaluate the activeLayer’s name.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2012 11:02 PM   in reply to ocphotog

    Please post your current code.

     

    In any case to get the active layer’s name

    app.activeDocument.activeLayer.name

    should work.

     
    |
    Mark as:
  • JJMack
    6,052 posts
    Jan 9, 2006
    Currently Being Moderated
    Aug 6, 2012 5:50 AM   in reply to ocphotog

    You can write a Plug-in script that will duplicate the cuuent document with a suffix other then the default "Copy".  When you record an action and use the plug-in script to create the duplicate document with some sufix added to the name you will need to enter the suffix to be used in the script's dialog.  The script coded as a Plug-in will record that setting  into the action step being recorded . When the action is played the script will not display its dialog it will use the setting recorded into the action's step.  In other words the Action steps when played Passes the suffix to be use for each duplicat with sufix step recorded into an action.  During an action you can make many duplicate with different suffixes. Just remember to save and close the dupe created in the action to return the original document before creating the next dup with suffix in the action.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points