Highlighted

Artboard name

Explorer ,
Jul 08, 2020

Copy link to clipboard

Copied

Hello,

Do you have script for renaming artboard?

 

1. Rename artboard for Front side and Back side:

Artboard 1: Front

Artboard 2: Back

and placed it to the TOP LEFT

elinochinjr_1-1594270650832.png

 

 

2. This is only 6 artboard for example, do you have shortcut for this?

I'm doing this by renaming artboard 1 by 1

then typing it in artboard 1 by 1.

 

S1F = Sheet 1 Front

S1B = Sheet 1 Back

 

elinochinjr_2-1594270671285.png

 

thank you

 

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

The error that you getting S is undefined because S should be used inside the quotes "" like "S"

 

And for you latest requirement please try following snippet

 

function main() {
	var doc = app.activeDocument;
	artBoards = doc.artboards;
	var count = 1;
	for (var i = 1; i <= artBoards.length; i++) {
		var a = artBoards[i - 1];
		if (i % 2 == 0) { // even number
			a.name = "S" + (count) + "B";
			count++;
		}
		else { // odd number
			a.name = "S" + (count) + "F";
		}

		// Adding textframes
		artBoards.setActiveArtboardIndex(i - 1);
		var _textFrame = doc.textFrames.add();
		_textFrame.contents = a.name;
		_textFrame.top = a.artboardRect[1] - 10;
		_textFrame.left = a.artboardRect[0] + 10;
	}
}

main();

 

 

Let us know if it resolves your problem.

EDIT : Edit script to incorporate to show textframes for printing purpose with name of the artboard.

TOPICS
How to, Scripting, Tools

Views

197

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

Artboard name

Explorer ,
Jul 08, 2020

Copy link to clipboard

Copied

Hello,

Do you have script for renaming artboard?

 

1. Rename artboard for Front side and Back side:

Artboard 1: Front

Artboard 2: Back

and placed it to the TOP LEFT

elinochinjr_1-1594270650832.png

 

 

2. This is only 6 artboard for example, do you have shortcut for this?

I'm doing this by renaming artboard 1 by 1

then typing it in artboard 1 by 1.

 

S1F = Sheet 1 Front

S1B = Sheet 1 Back

 

elinochinjr_2-1594270671285.png

 

thank you

 

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi,

The error that you getting S is undefined because S should be used inside the quotes "" like "S"

 

And for you latest requirement please try following snippet

 

function main() {
	var doc = app.activeDocument;
	artBoards = doc.artboards;
	var count = 1;
	for (var i = 1; i <= artBoards.length; i++) {
		var a = artBoards[i - 1];
		if (i % 2 == 0) { // even number
			a.name = "S" + (count) + "B";
			count++;
		}
		else { // odd number
			a.name = "S" + (count) + "F";
		}

		// Adding textframes
		artBoards.setActiveArtboardIndex(i - 1);
		var _textFrame = doc.textFrames.add();
		_textFrame.contents = a.name;
		_textFrame.top = a.artboardRect[1] - 10;
		_textFrame.left = a.artboardRect[0] + 10;
	}
}

main();

 

 

Let us know if it resolves your problem.

EDIT : Edit script to incorporate to show textframes for printing purpose with name of the artboard.

TOPICS
How to, Scripting, Tools

Views

198

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
Jul 08, 2020 0
Adobe Community Professional ,
Jul 08, 2020

Copy link to clipboard

Copied

Hi, for your first part try following snippet

function main() {
	var doc = app.activeDocument;
	doc.artboards[0].name = "FRONT";
	doc.artboards[1].name = "BACK";
}

main();

 

For your second part, try this one

function main() {
	var doc = app.activeDocument;
	artBoards = doc.artboards;
	var count = 1;
	for (var i = 1; i <= artBoards.length; i++) {
		var a = artBoards[i - 1];
		a.name = "S" + (count) + "F";
		if (i % 2 == 0)
			count++;
	}
}

main();

 

I would suggest to make a generalized version of the script to rename the artboards that will run for your workflow. For this you may need to think over the workflow of your work. But above version script will work for teh question of have asked.

 

Let us know if this help you.

 

Best regards

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
Reply
Loading...
Jul 08, 2020 1
Explorer ,
Jul 08, 2020

Copy link to clipboard

Copied

Thanks for your help,

 

You can disregard the first part. 

for the second part:

elinochinjr_2-1594275347754.png

 

Can you make the 'odd number' of artboard (1,3,5,7,9 ~)

Artobard1: S1F

Artobard3: S2F

Artobard5: S3F

 

and 'even number' of artboard (2,4,6,8,10 ~)

Artobard2: S1B

Artobard4: S2B

Artobard6: S3B

 

Thank you

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
Reply
Loading...
Jul 08, 2020 0
Adobe Community Professional ,
Jul 08, 2020

Copy link to clipboard

Copied

Hi,

The error that you getting S is undefined because S should be used inside the quotes "" like "S"

 

And for you latest requirement please try following snippet

 

function main() {
	var doc = app.activeDocument;
	artBoards = doc.artboards;
	var count = 1;
	for (var i = 1; i <= artBoards.length; i++) {
		var a = artBoards[i - 1];
		if (i % 2 == 0) { // even number
			a.name = "S" + (count) + "B";
			count++;
		}
		else { // odd number
			a.name = "S" + (count) + "F";
		}

		// Adding textframes
		artBoards.setActiveArtboardIndex(i - 1);
		var _textFrame = doc.textFrames.add();
		_textFrame.contents = a.name;
		_textFrame.top = a.artboardRect[1] - 10;
		_textFrame.left = a.artboardRect[0] + 10;
	}
}

main();

 

 

Let us know if it resolves your problem.

EDIT : Edit script to incorporate to show textframes for printing purpose with name of the artboard.

Best regards

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
Reply
Loading...
Jul 08, 2020 2
Explorer ,
Jul 09, 2020

Copy link to clipboard

Copied

wow! Thank you, that works great.

 

but one last thing.

can you add the artboard name in the artboard itself like a small label? I need this for printing

please see attached

elinochinjr_0-1594278195948.png

 

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
Reply
Loading...
Jul 09, 2020 0
Adobe Community Professional ,
Jul 09, 2020

Copy link to clipboard

Copied

Hi,

I have updated the script with changes to have artboard names over the artboard for printing purpose above. You can use updated version of the script.

 

Let us know if it works for you.

Best regards

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
Reply
Loading...
Jul 09, 2020 1
Explorer ,
Jul 09, 2020

Copy link to clipboard

Copied

its PERFECT!

thank you very much !!! 

 

I have so many idea but I don't know how to code and if it's possible.

but this script will simplify my work (a bit hehe)

 

THANK YOU

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
Reply
Loading...
Jul 09, 2020 0
Adobe Community Professional ,
Jul 09, 2020

Copy link to clipboard

Copied

You're welcome 🙂 .

Glad it is helpful for you.

Best regards

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
Reply
Loading...
Jul 09, 2020 1
Explorer ,
Jul 09, 2020

Copy link to clipboard

Copied

Hello,

 

can I ask another favor?

can you make the label in another layer and locked?

elinochinjr_0-1594347109161.png

 

thanks for your help..

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
Reply
Loading...
Jul 09, 2020 0
Most Valuable Participant ,
Jul 09, 2020

Copy link to clipboard

Copied

« Give a man a fish and he will be full. Teach him how to fish and he will never go hungry again. »

  attributed to Confucius

 

Try to learn the basics.

create a new layer

 

 

var doc = app.activeDocument;
var lay = doc.layers.add();

 

 

 

This layer is now the active layer.

add your text frame, create contents and lock the item

 

 

var tf = lay.textFrames.add();
tf.contents = "new contents";
tf.locked = true;

 

 

 

Try combining these lines of code with the script written by @Charu Rajput and ask later if you need further assistance.

 

Have fun

😉

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
Reply
Loading...
Jul 09, 2020 3
Resources