Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script in photoshop to notify specific file names with icon or warning text in document

New Here ,
Nov 18, 2021 Nov 18, 2021

Copy link to clipboard

Copied

How to create a warning text or icon for a particular name via Ps Script.

Eg: 2218146180.B08145Z6KV.PT11, 2218145977.B08145Z6KV.PT01, 2218102275.B09HX5L6YC.PT02

 

In the above names i need warning text or icon only for the images ending with .PT02.

 

Any Help would be a great solution for my problem 🙂

TOPICS
Actions and scripting, Windows

Views

92

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
Adobe Community Professional ,
Nov 18, 2021 Nov 18, 2021

Copy link to clipboard

Copied

/PT02$/.test(activeDocument.name)

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
Adobe Community Professional ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

I can spot the regex, but I couldn't get this to work?

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
Adobe Community Professional ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

It gives 'true' for image name ending with characters put to regexp, so what do you mean?

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
Adobe Community Professional ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

I mean that the code does nothing, is this just a snippet? If so, what further code should be added?

 

EDIT: OK, I have not used  .test  before, so a little bit of a read and play gave me this:

 

if (/\.PT02$/i.test(activeDocument.name) === true) {
app.beep();
alert("!");
}

 

 

 

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
Adobe Community Professional ,
Nov 20, 2021 Nov 20, 2021

Copy link to clipboard

Copied

This is solution for user problem. How that is going to be used is up to him, so I don't provide beeps, alerts or anything else. He's going to use it his way. The point is to filter specific names.

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
New Here ,
Nov 26, 2021 Nov 26, 2021

Copy link to clipboard

Copied

Thanks for helping me 🙂

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
Adobe Community Professional ,
Nov 26, 2021 Nov 26, 2021

Copy link to clipboard

Copied

LATEST

Does it solve your problem?

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
Adobe Community Professional ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

I would do something like this:

 

if (app.activeDocument.name.match(/\.PT02$/i)) {
app.beep();
alert("!");
}

 

 

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
New Here ,
Nov 26, 2021 Nov 26, 2021

Copy link to clipboard

Copied

Thanks for adding alert 🙂

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