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

scripting help

Community Beginner ,
Apr 23, 2018 Apr 23, 2018

Copy link to clipboard

Copied

Screen shot 2018-04-23 at 11.15.30 PM.png

This is my script when we run it opens a message like this in photoshop

i have problem in updating the information  in scripts always..

what i need is if i update in notepad or word or any file it should show the information in photoshop

how to add path in this script?

for example:

/xxx WORKING FOLDER/01 WORKING/03 SCRIPTS/PLUGIN SCRIPTS/update.rtf');

need a code to run this help me please

i will save info on the update .rtf when i run the script the info in the update.rtf need to be run on photoshop

TOPICS
Actions and scripting

Views

1.2K

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

Community Expert , Apr 24, 2018 Apr 24, 2018

It seems, your path to your file is wrong.

Please put the file for testing on your desktop ( like I wrote before! ) and replace this part of code

var txt = File ('~/Desktop/test.txt');

txt.open("r");

var contentStr = txt.read();

txt.close();

var str = contentStr.split ("\n");

with these lines before you run the script again

var txt = File ('~/Desktop/test.txt');

if (txt.exists == true) {

txt.open("r");

var contentStr = txt.read();

txt.close();

var str = contentStr.split ("\n");

} else { alert ("no text file f

...

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 23, 2018 Apr 23, 2018

Copy link to clipboard

Copied

Not sure what you mean by adding a path to the script. Are you talking about being able to select a file via the UI, and or having the path show in the UI?

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 Beginner ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

var dlgMain = new Window('dialog', 'CURRENT UPDATES');

          dlgMain.marginLeft = 15;

          dlgMain.center();

          dlgMain.alertBtnsPnl = dlgMain.add('panel',undefined, '');

          dlgMain.alertBtnsPnl.alignment='left';

          dlgMain.alertBtnsPnl.preferredSize = [200,200];

          dlgMain.alertBtnsPnl.cmb= dlgMain.alertBtnsPnl.add("group");

          dlgMain.alertBtnsPnl.cmb.orientation = 'column';

          dlgMain.alertBtnsPnl.cmb.alignChildren = 'fill';

          dlgMain.alertBtnsPnl.cmb.alignment = 'left';

          dlgMain.alertBtnsPnl.alignChildren = "left";

          dlgMain.alertBtnsPnl.mh= dlgMain.alertBtnsPnl.add("group");

          dlgMain.alertBtnsPnl.mh.orientation = 'column';

          dlgMain.alertBtnsPnl.mh.alignChildren = 'fill';

          dlgMain.alertBtnsPnl.mh.alignment = 'left';

        with (dlgMain.alertBtnsPnl) {

            cmb.txt = cmb.add('statictext', undefined, '');

            cmb.txt.preferredSize = [1,1];

            mh.add('statictext', undefined, 'UPDATES: ');

            mh.add('statictext',undefined, '1. If received ins. "Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible".');

            mh.add('statictext',undefined, ' Need to do Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible.');

                }

dlgMain.show();

this is the code im using when i run the code it shows the result which i have posted below screenshot.

what i need is simple thing,

if i want to update the info i needed to open the code again and i have to add points in the code

instead of that if i add information in excel or word document that should automatically should run when the script runs

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
Contributor ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

Thanks for the text!

Helas I'm not very good - in English and script

I leave room for others ......

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 Beginner ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

var dlgMain = new Window('dialog', 'CURRENT UPDATES');

          dlgMain.marginLeft = 15;

          dlgMain.center();

          dlgMain.alertBtnsPnl = dlgMain.add('panel',undefined, '');

          dlgMain.alertBtnsPnl.alignment='left';

          dlgMain.alertBtnsPnl.preferredSize = [200,200];

          dlgMain.alertBtnsPnl.cmb= dlgMain.alertBtnsPnl.add("group");

          dlgMain.alertBtnsPnl.cmb.orientation = 'column';

          dlgMain.alertBtnsPnl.cmb.alignChildren = 'fill';

          dlgMain.alertBtnsPnl.cmb.alignment = 'left';

          dlgMain.alertBtnsPnl.alignChildren = "left";

          dlgMain.alertBtnsPnl.mh= dlgMain.alertBtnsPnl.add("group");

          dlgMain.alertBtnsPnl.mh.orientation = 'column';

          dlgMain.alertBtnsPnl.mh.alignChildren = 'fill';

          dlgMain.alertBtnsPnl.mh.alignment = 'left';

        with (dlgMain.alertBtnsPnl) {

            cmb.txt = cmb.add('statictext', undefined, '');

            cmb.txt.preferredSize = [1,1];

            mh.add('statictext', undefined, 'UPDATES: ');

            mh.add('statictext',undefined, '1. If received ins. "Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible".');

            mh.add('statictext',undefined, ' Need to do Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible.');

                }

dlgMain.show();

this is the code im using when i run the code it shows the result which i have posted below screenshot.

what i need is simple thing,

if i want to update the info i needed to open the code again and i have to add points in the code

instead of that if i add information in excel or word document that should automatically should run when the script runs

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 ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

Hi hardy11111​,

I'm not sure if I understand you correctly.

But perhaps this helps you a little:

// regards pixxxelschubser

/*//*********************************************************************************************************************************************

    REQUIRED !!!

At first create a text file (plain text) on your desktop manually;

name -->

test.txt

contents -->

1. If received ins. "Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible".

Need to do Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible.

*///*********************************************************************************************************************************************

var txt = File ('~/Desktop/test.txt');

txt.open("r");

var contentStr = txt.read();

txt.close();

var str = contentStr.split ("\n");

var dlgMain = new Window('dialog', 'CURRENT UPDATES');

dlgMain.marginLeft = 15;

dlgMain.center();

dlgMain.alertBtnsPnl = dlgMain.add('panel',undefined, '');

dlgMain.alertBtnsPnl.alignment='left';

dlgMain.alertBtnsPnl.preferredSize = [200,200];

dlgMain.alertBtnsPnl.cmb= dlgMain.alertBtnsPnl.add("group");

dlgMain.alertBtnsPnl.cmb.orientation = 'column';

dlgMain.alertBtnsPnl.cmb.alignChildren = 'fill';

dlgMain.alertBtnsPnl.cmb.alignment = 'left';

dlgMain.alertBtnsPnl.alignChildren = "left";

dlgMain.alertBtnsPnl.mh= dlgMain.alertBtnsPnl.add("group");

dlgMain.alertBtnsPnl.mh.orientation = 'column';

dlgMain.alertBtnsPnl.mh.alignChildren = 'fill';

dlgMain.alertBtnsPnl.mh.alignment = 'left';

with (dlgMain.alertBtnsPnl) {

    cmb.txt = cmb.add('statictext', undefined, '');

    cmb.txt.preferredSize = [1,1];

    mh.add('statictext', undefined, 'UPDATES: ');

    //mh.add('statictext',undefined, '1. If received ins. "Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible".');

    mh.add('statictext',undefined, str[0]);

    //mh.add('statictext',undefined, ' Need to do Convert to CMYK. Background to be 5M 5Y. Profile is ISONewspaper26v4. keep as much hair detail as possible.');

    mh.add('statictext',undefined, str[1]);

}

dlgMain.show();

If so

have fun

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 Beginner ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

almost correct but when i run i can see anything content in it i getting blank

Screen shot 2018-04-25 at 12.21.38 AM.png

As im using mac and for txt i used rtf

the content inside the txt or rtf or word would display in the box when i run the script

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 Beginner ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

When i run ur code using txt as you mentioned still empty box is showing while running

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 ,
Apr 24, 2018 Apr 24, 2018

Copy link to clipboard

Copied

It seems, your path to your file is wrong.

Please put the file for testing on your desktop ( like I wrote before! ) and replace this part of code

var txt = File ('~/Desktop/test.txt');

txt.open("r");

var contentStr = txt.read();

txt.close();

var str = contentStr.split ("\n");

with these lines before you run the script again

var txt = File ('~/Desktop/test.txt');

if (txt.exists == true) {

txt.open("r");

var contentStr = txt.read();

txt.close();

var str = contentStr.split ("\n");

} else { alert ("no text file found") };

The result should be (if the file on your desktop was found):

PS_Script_Hardy111_txt.png

-------------------------------------------------------------------------------

A rtf file is never a good idea. You really need plain text - and not a text with any kind of formatting!!!

Otherwise you get this wrong result:

PS_Script_Hardy111_rtf.png

Good luck

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 Beginner ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

Hi sir,

In Windows it is working but in MAC we dont have txt file format we have only rtf file format so can you please help on tha

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 Beginner ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

Txt file format is fine when i add another line in the txt file it doesnt work when i run i added

mh.add('statictext',undefined, str[1]);

extra line but it wont show when i run

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
Guide ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

You could format your script like this...

#target photoshop;

var content = """

UPDATES:

1. If received ins. Convert to CMYK.

Background to be 5M 5Y.

Profile is ISONewspaper26v4.

keep as much hair detail as possible.

Need to do Convert to CMYK.

Background to be 5M 5Y.

Profile is ISONewspaper26v4.

keep as much hair detail as possible.

""";

var dlgMain = new Window('dialog', 'CURRENT UPDATES',undefined,{closeButton: true});  

dlgMain.alertBtnsPnl = dlgMain.add('panel',undefined, '');

dlgMain.alertBtnsPnl.alignment='left'; 

dlgMain.alertBtnsPnl.preferredSize = [200,200]; 

dlgMain.alertBtnsPnl.add('statictext',undefined, content,{multiline: true});

dlgMain.show();

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 ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

LATEST

Hi SuperMerlin​,

it seems hardy wants these lines not in the jsx. He wants an extra txt file for that.

hardy11111​,

you already have two lines in your txt?

A new line (after these two lines) will be str[2]

A new line (after these three lines) will be str[3]

and so on …

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
Contributor ,
Apr 23, 2018 Apr 23, 2018

Copy link to clipboard

Copied

Bonjour

It would be better to show text rather than an image to make it easier for those who want to help ?

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