Current position:  Home > Default > Variables in an action to use in script

Variables in an action to use in script

Time:October 11
Advertisement
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?
Advertisement
Code to duplicate document:
var doc = app.activeDocument
var fname = doc.name.split(".")
var fname = fname[0]
var ToneType = 'BW'
var newDoc = doc.duplicate(fname+ToneType,true)
//var newDoc = doc.duplicate(fname,true)
newDoc.flatten();
I have 3 actions that I want to use the script for. One action to make a B&W (BW), one for Sepia (SP), one for Warm B&W (WBW). If I use the above code it will just duplicate the document with the same name, adding the hardcoded ToneType to the end of the document name. I could make three scripts, one for each, but I thought if I could have a variable (ToneType = 'BW') for example, that would pass to the script then I could only use one script that would change depending on the variable name that was in the action.
This code will just duplicate the document without the text  COPY  at the end but I need to make one for each ToneType I have. Maybe that's the easiest way but I like to make a script with multiple uses.
When you suggested that rename the active layer with a specific name, I can rename the background layer to  BW  for example, but at the end I still need to rename the file with the   BW . I can script the part to add the active layer to the document name but can't figure out how to replace the name when the script goes back to Photoshop.  I know something is missing in this code that will replace the active documents name. Just not sure what.
this is the code for that try:
//replace name of current document with document name + active layer name
layerN = activeDocument.activeLayer.name
var doc = app.activeDocument
var fname = doc.name.split(".")
var fname = fname[0]
app.activeDocument.name = (fname+layerN,true)
Thanks for any help!

Use of Essbase substitution variables in filename of a MaxL report script

2015-10-11

Hey guys. Is there a way that I can embed the value of one or more Essbase substitution variables in the filename of a report script in a MaxL command? I'm running a report script that uses sub. vars for entities and accounts and based on which of th

Getting the name of the Action that runs this script

2015-10-11

If I create a action in photoshop to run a script called "test script", How can I determine within the "test script" what action name started running this script?  I'm trying to write a script to scale my images.  The scaling will be d

How to pass values to variables in WAD 7.0 using java script

2015-10-11

Hi., My requirement is based on WAD 7.0. The sales value has to displayed in WAD using graph with various chart types. I have created variables for plant and material group in a query. I have created drop down box for plant with all plants in it, che

Query about User Variables and Advanced Actions

-0001-11-30

Hello, I am creating a clinical-based project using Captivate 5.I have to give you quite a bit of information before I can pose my questions so please bear with me. Users have to select multiple options from a checkbox widget (shown below). Each opti

Folder Action to Launch Perl Script

2015-10-11

Hello. I wrote a perl script which I wanted to execute when a file was dropped into a folder. I added a folder action with a very simple applescript: on adding folder items to this_folder after receiving added_items do shell script ¬ ("perl /Users/Al

Integer value in a variable of assing action is no more integer - OSB

2015-10-11

Hi, I have seen a strange behavior or I wonder am I missing anything in OSB assing action. I am developing a simple proxy service in 11.1.1.6 OSB.Following are the steps involved in my code. In first assign action, the value is assigned as xs:integer

Setting Environment Variable not pulling in certain portion of script

2015-10-11

We have multiple domain controllers and when a user gets locked out constantly it is a bit of a process to login to that domain controller, pull the event logs, and search through that way. I looked at a few ways to automate this process in powershel

Referencing a variable in 'session findbyId' command (SAP GUI Scripting)

2015-10-11

Hi all - I was wondering if anybody knew a way to get the following to work: I would like the script to type in a value in the components grid in SAP but I want ot put it in a loop so I can bump up the line number with each read. For it to work I wou

Access a variable in the Adobe form for Java Scripting

2015-10-11

Hi, I am unable to know how to access the variable in a Adobe form. The variable is field of an internal table. My adobe form structure is as follows MAIN_PAGE->FORMSET->FirstFORM->EXT. in the EXT subform the variable(cust)  exists. The cust is i

OBIEE ActionLink-Action-Invoke a Brower Script ISSUE

2015-10-11

I am having an issue while trying to use the "Invoke a Browser Script" feature in Action Link. The "Select Script Function" screen is blank, meaning I am not able to select any of the functions from the UserScripts.js residing in the b

Add layers from other psd file via action/batch (Or possibly script)

2015-10-11

Hi Brand new to this forum. Quick intro: Eivind from Norway, 32, Photographer, Nikon D300, CS5 I have tried to make a action where i open 2 files, duplicate the layers from file2 to file1 and it works fine. But running the action as a batch i get in

Using variables in a calculation function in Diadem script

2015-10-11

Hey guys, I'm new to working with Diadem Scripts.  I have tried the two different ways below to make the values of a channel equal to the results of a formula containing created variables.  I can do it if the formula contains values in place of the v

How can I use local variable in LabVIEW-Action?

2015-10-11

Hi All! There is local variable (for example "MyVariable") in local scope of project. There is Action-step, created by LabVIEW. One of input terminals step is "Sequence Context". How can I access to MyVariable by Sequence Context? Unbu

Would like to automate open stacks as layers + run action. Possible with script??

2015-10-11

I would like to automate part of my workflow that involves opening stacked images as layers in Ps CS5 and running an PS action that composites the layers and processes the image. Something similar to 'Process Collection' in Bridge CS5 only with my ow

How to set Bind variable on the action of command link

-0001-11-30

I have two tables. One is the list of processes and other one is the details of processes with process name as primary key. I want to first display the first table which has the list of processes on one page. When I click on perticular process name t

Clearing the actions panel and loading an action set using a script.

-0001-11-30

I've been trying to figure out how to do this now for two days straight, I'm still completely stuck and can't manage to do it. Scriptlistener shows nothing for the "Clear actions" and "Load actions" menu items when the function is call

Run script action - ZCM edits my script's content

-0001-11-30

Good day, I am implementing a script in a bundle that allows me to generate files on the fly and execute them. Upon saving my "run script" action, ZENworks takes on himself to parse and edit my script, I am not sure why. A part of my script gene

Using widget variables in advanced actions

-0001-11-30

Hello,    Is it possible to access widget variables from the advanced actions pane? Specifically, I after users click a checkbox and, after this, click on a button, I would like to have something else appear. Is this possible? If so, how can I access

Adding Three Variables using Standard Action?

-0001-11-30

I'm attempting to create an expression using a standard action. However I'm finding that it will only allow me to enter two variables (NOT 3) for the total.  (total 1) + (total 2) = data_targetmonthly (as shown below). I need the expression to be: (t