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

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

Community Beginner ,
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

333

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 2 Correct answers

LEGEND , Nov 18, 2021 Nov 18, 2021
/PT02$/.test(activeDocument.name)

Votes

Translate

Translate
Community Expert , Nov 19, 2021 Nov 19, 2021

I would do something like this:

 

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

 

 

Votes

Translate

Translate
Adobe
LEGEND ,
Nov 18, 2021 Nov 18, 2021

Copy link to clipboard

Copied

/PT02$/.test(activeDocument.name)

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

Copy link to clipboard

Copied

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

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
LEGEND ,
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?

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 ,
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("!");
}

 

 

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
LEGEND ,
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.

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

Copy link to clipboard

Copied

Thanks for helping me 🙂

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

Copy link to clipboard

Copied

LATEST

Does it solve your problem?

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 ,
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("!");
}

 

 

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

Copy link to clipboard

Copied

Thanks for adding alert 🙂

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