Copy link to clipboard
Copied
Hi,
I used to be open 100 images daily from different folders to Photoshop but i don't want the files which are named as( .FC50, FC51, FC 60,) to be include in my workflow,
so i want to create a alert or popup to warn me this is a image which you no need to process and continue to next files.
For example my file names like :
12345.CBN014.FC50.jpg
12345.CBN016.FC51.jpg
1452345.CBN015.FC51.jpg
356345.CBN054.FC60.jpg
My basic idea was if i drag and drop the images into Photoshop with index of (.FC50,51,60.) it should show an warning or popup stating you no need to process and also move those files in a separate folder in active document location.
please help me in this ..
Thanks in advance
Copy link to clipboard
Copied
Hi Vfxvenkat98,
<Off topic>
Please do never use additional dots in filenames.
<\Off topic>
You can work with a filter like:
var Nm = [
"12345.CBN014.FC50.jpg",
"12345.CBN016.FC51.jpg",
"1452345.CBN015.FC51.jpg",
"356345.CBN054.FC60.jpg",
"356345.CBN054.FC61.jpg"
];
for (i=0; i<Nm.length; i++) {
if (Nm.match(/\.FC(5[01]|60)/) == null) {
alert ("do anything with Nm["+i+"] " + Nm); // result: do anything with Nm[4] 356345.CBN054.FC61.jpg
}
}
Have fun
Copy link to clipboard
Copied
thanks pixxxel schubser,
But the image which i getting was named like that only so that's the reason for naming like that but in the above script lines you declared a variable with my exact file names but in different cases my file names are in different names what should do on that time ??
and also i need to move those images into seperate folder
Copy link to clipboard
Copied
i am not sure with (indexOf) function does this work or not ?? and dont know how to trigger this script with based on Open document event.
Copy link to clipboard
Copied
To much values for indexOf().
Please explain exactly what do you really want.
E.g. you can store the jpg files in one Folder in the (same Nm- ) array (like I show you before)
var Nm = Folder.selectDialog ().getFiles(/\.jpe?g$/i);
/*var Nm = [
"12345.CBN014.FC50.jpg",
"12345.CBN016.FC51.jpg",
"1452345.CBN015.FC51.jpg",
"356345.CBN054.FC60.jpg",
"356345.CBN054.FC61.jpg"
];*/
for (i=0; i<Nm.length; i++) {
if (Nm.name.match(/\.FC(5[01]|60)/) == null) {
alert ("do anything with Nm["+i+"] " + Nm); // result: do anything with Nm[4] 356345.CBN054.FC61.jpg
}
}
Have fun
Copy link to clipboard
Copied
What i want is.
Step 1.open images into photoshop
Step 2.if the images are named with (.FC) it should throw an alert with this comment.("The image is already Retouched")
Step 3. IF the images are not named with (.FC) no alert would be displayed.
Copy link to clipboard
Copied
Hmmh?
Why do you want open images which are alredy retouched? I given you a filter. This filter helps you to open only the images with (or without) the ".FCnumbernumber" part.
This is a very flexible method.
If you want works with opened files change line#1
var Nm = Folder.selectDialog ().getFiles(/\.jpe?g$/i);
to
var Nm = app.documents;
Have fun
Copy link to clipboard
Copied
I can understand but if it is possible with my idea the i can trigger the script with script events manager with open document events based so that i asked like this.
I hope you understand
Copy link to clipboard
Copied
Save this snippet
//alertIfNamehasPartDotFCnumber.jsx
var Nm = activeDocument;
if (Nm.name.match(/\.FC(5[01]|60)/) == null) {
alert ("do anything with " + Nm.name);
}
and link this alertIfNamehasPartDotFCnumber.jsx with the open event in script events manager.
Close and reopen Photoshop.
This should alert the document name if a document will be open.
But be sure: only if you go this way: menu --> File --> open
There is IMHO no way with the new startscreen and open.
Copy link to clipboard
Copied
the script is not working
Copy link to clipboard
Copied
Don't worry.
It does.
No problem
Copy link to clipboard
Copied
wow its working thanks a lot and just want to if we can add the close document command when clicking ok so that if incase FC images opened in photoshop a alert will popup to addon the close function will close the images in photoshop
Copy link to clipboard
Copied
Vfxvenkat98 schrieb:
wow its working thanks a lot and just want to if we can add the close document command when clicking ok so that if incase FC images opened in photoshop a alert will popup to addon the close function will close the images in photoshop
Where is the problem?
Insert a close command after the alert.
//alertIfNamehasPartDotFCnumber.jsx
var Nm = activeDocument;
if (Nm.name.match(/\.FC(5[01]|60)/) == null) {
alert ("nothing to do with " + Nm.name + "\nThe document will be closed.");
Nm.close();
}
But this is IHMO a little bit senseless. See my previous posting:
Hmmh?
Why do you want open images which are alredy retouched? I given you a filter. This filter helps you to open only the images with (or without) the ".FCnumbernumber" part.
This is a very flexible method.
If you want works with opened files change line#1
- var Nm = Folder.selectDialog ().getFiles(/\.jpe?g$/i);
to
- var Nm = app.documents;
Have fun
Hope, this will help you.
Copy link to clipboard
Copied
Hmmh?
No feedback.
No answer.
Do you still have problems?
Or is your question answered?
Copy link to clipboard
Copied
Thanks pixxel schubser the only problem now i am having is i need to add the close button on the alert box it is useful in future. but i got confused in buttons
Copy link to clipboard
Copied
Now I'm really confused.
An alert always have a OK-Button and the little close "x" in the topright corner.
Furthermore: it is impossible to add a button on the alert box.
Copy link to clipboard
Copied
yeah i understand but we can create an alert box using js like alert panel but confused part is to link with buttons
Copy link to clipboard
Copied
HeyVfxvenkat98, this ScriptUI guide by pkahrel is everything you need to know about UI scripting in ExtendScript.
https://indd.adobe.com/view/a0207571-ff5b-4bbf-a540-07079bd21d75
Also, do a quick search for questions / posts about Photoshop UI on this site or on google, there's plenty of information out there.
The initial question was answered a long time ago by pixxxel schubser.
Copy link to clipboard
Copied
Thanks a lot pixxxel schubser and all I got solution. Thank u very much