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

Scripting: Prompt a Dialog Box to add text to part of my existing Script.

New Here ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

     I'm new with scripting and haven't had a lot to do with it, so i'm looking for a little help. I need to add to my companies existing Script Pallet, we have a script that creates our art into dies for us. So that they can be used for Debossing/Hotstamping items. But, we need the "Die" to have the Name of the job on it, so i'm trying to get a box to prompt up to add that text to the top of my die...I have got the box to come up but i can't get it to put the text on the art. Am I missing a link somewhere?

var newDieName = prompt ('Enter Job Number for New Die', " ","Creating Die");

var newDieName = newDieName.name;

            var die_num = thisDoc.textFrames.add();

            die_num.contents = "DJ" +(newDieName)+ ".01" + "-" + " " +magThick;

            die_num.moveToBeginning(rec_group1);

       

    var myParagraph = die_num.paragraphs[0];

            myParagraph.characterAttributes.size = 12;

            myParagraph.characterAttributes.textFont=app.textFonts.getByName("MyriadPro-Regular");

            myParagraph.characterAttributes.fillColor = orange;

       

//  Determines where the die number should be placed.

     die_num.top = -170;

     die_num.left = -54;

     die_num.filled = true;

     die_num.rotate(180);

     die_num.overprintFill = false;

//  End of die number creation

;

Please let me know if you need any other information; i will see want i can do to.

TOPICS
Scripting

Views

2.3K

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
Adobe
Valorous Hero ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

In your code, what does rec_group1 ​reference to?

Out of curiosity, can you tell us what kind of "Scripting Palette" you guys are using?

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
New Here ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

i believe it refers to the first group of die's to the die name. The script reads 4 different die's out of 2 different groups, depending on the size of the art.

die.JPG

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 ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

It seems you have trouble with your syntax. And I miss necessary parts in your code. Furthermore: the version of your Illustartor is absolutely required for the correct position of your die_num

If I understand you right, you need something like this

var thisDoc = activeDocument;

var rec_group1 = thisDoc.layers.getByName("rec_group1");

var magThick = "0,250";

var newDieName = prompt ('Enter Job Number for New Die', " ","Creating Die");

if (newDieName) {

var die_num = rec_group1.textFrames.add();

die_num.contents = "DJ" + newDieName + ".01" + "-" + " " + magThick;

die_num.moveToBeginning(rec_group1);

die_num.textRange.characterAttributes.size = 12;

die_num.textRange.characterAttributes.textFont=app.textFonts.getByName("MyriadPro-Regular");

die_num.textRange.characterAttributes.fillColor = thisDoc.swatches[4].color;

//  Determines where the die number should be placed.

die_num.top = -170;

die_num.left = -54;

die_num.filled = true;

die_num.overprintFill = false;

die_num.rotate(180);

//  End of die number creation

};

One question (if allowed) Where do you come from?

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 Expert ,
Dec 30, 2016 Dec 30, 2016

Copy link to clipboard

Copied

LATEST

One issue I can see right off the bat.. these first 2 lines:

var newDieName = prompt ('Enter Job Number for New Die', " ","Creating Die");

var newDieName = newDieName.name;

The first line sets the variable newDieName equal to the result of the prompt window

Since the prompt returns a string, the second line doesn't work. there is no "name" property of a string.

You can get rid of that second line all together since the first one already does what you want.

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