executing script from action, #targetengine problem

Contributor ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

I want to pass my_path = app.activeDocument.path, to second script

The first script is

 

#targetengine "my_path"
my_path = app.activeDocument.path;

 

The second script is

 

#targetengine "my_path"
alert(my_path);

 

Testing on different documents.

Running the scripts from menu File>Scripts the alert gives the corresponding document path

Running the first script from recorded action the alert gives the first document path

How I can have  the corresponding document path , while running the first script from a recorded action ?

TOPICS
Actions and scripting

Views

54

Likes

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

correct answers 1 Correct answer

LEGEND , Mar 06, 2022 Mar 06, 2022
Without using actions you could try evalFile() method, with, you may try $.setenv / $.getenv methods.

Likes

Translate

Translate
LEGEND ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

Without using actions you could try evalFile() method, with, you may try $.setenv / $.getenv methods.

Likes

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
Contributor ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

LATEST

Using $.setenv / $.getenv methods works fine with actions !
Thank you!

1st script

$.setenv("my_path" ,app.activeDocument.path);

2nd script

var myFolder_doc = $.getenv("my_path")

 

Likes

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