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

Help: Replace Text with Folder Name

Explorer ,
May 25, 2024 May 25, 2024

Copy link to clipboard

Copied

Hello guys. Can i replace "XXX XXX" text with folder name (where i save in test.ai illustrator file).

Is it any jsx for this? I do this all day it will very helpful for me.

 

Ekran görüntüsü 2024-05-25 232403.png

TOPICS
How-to

Views

311

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 , May 25, 2024 May 25, 2024

Under Windows?

 

The document must be saved. The text frame must be selected.
Note: Do NOT use spaces in folder names - use underscores or minus signs as separators


Try this snippet as JSX:

// select your XXX XXX textframe, then run this script snippet
// Hint: Do NOT use spaces in folder names - use underscores or minus as separator

var aDoc = app.activeDocument;
var nme = aDoc.path.toString().split("/").reverse();

var aSel = aDoc.selection;
if (aSel[0].typename == "TextFrame") {
    aSel[0].c
...

Votes

Translate

Translate
Adobe
Community Expert ,
May 25, 2024 May 25, 2024

Copy link to clipboard

Copied

Under Windows?

 

The document must be saved. The text frame must be selected.
Note: Do NOT use spaces in folder names - use underscores or minus signs as separators


Try this snippet as JSX:

// select your XXX XXX textframe, then run this script snippet
// Hint: Do NOT use spaces in folder names - use underscores or minus as separator

var aDoc = app.activeDocument;
var nme = aDoc.path.toString().split("/").reverse();

var aSel = aDoc.selection;
if (aSel[0].typename == "TextFrame") {
    aSel[0].contents = nme[0];
    }

 

Untested. Sent from phone

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
Explorer ,
May 26, 2024 May 26, 2024

Copy link to clipboard

Copied

Thank you. It works.

But  i need two more detail.

1. I need to write " " (space) for my project. It writes "%20" for spaces. Can i fix that.

2. I need to select text object for that. Is it possible i dont need to to select. Because i have 4 of them for one product. And all of name is XXX XXX XXX XXX.

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 26, 2024 May 26, 2024

Copy link to clipboard

Copied

LATEST

Haha.
I was pretty sure the description was completely inadequate.

🙂

 

The best way: You complete this answered topic by marking the correct answer.

 

Then open a new topic:

  • Please describe exactly what is in your file and how.
  • Are you allowed to correct the folder names (without spaces in the name) - or is that not possible?

 

  • Can the ‘XXX’ text frames be clearly identified (are they clearly named or are they on a separate layer)?
  • How are the text frames distributed in the document?
  • Are there more text frames ?
  • Do exactly four text frames always have to be changed or is the number variable?
  • Are they always visible and enabled?
  • Are the groups and layers above the text frames always visible and unlocked?

 

There are other questions that need to be clarified, so a sample file would be very helpful (without confidential data, saved as a PDF with Illustrator editing and attach in the new topic).

You can replace all confidential texts with dummy text and all images with placeholders. The cutting die can also be changed - only the exact same layer structure with similar objects is important!

 

See you in the new topic.

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