Copy link to clipboard
Copied
Maybe I understood what you want
var the_name = activeDocument.name;
var files = activeDocument.path.getFiles();
files.sort(sort_func);
function sort_func(a, b)
{
// Sorting will be alphabetical.
// It may differ from the one set in the explorer, especially for names with numbers.
// For exact matching of sorting, you need to write another sorting function.
// Google will help you. )
if (a > b) return 1;
else if (a < b) return -1;
else return 0;
}
// h
...
Copy link to clipboard
Copied
Set a variable to the Folder object, and then you can use .execute() to open the folder in either Windows Explorer or the Finder on the Mac.
var theFolder = Folder(app.activeDocument.path);
theFolder.execute();
Or just skip the variable:
Folder(app.activeDocument.path).execute();
I don't know how to have the file selected in Explorer, that would probably take some extra scripting to call on local operating system commands.
It is possible when calling Adobe Bridge:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
for windows
var cmd = "explorer /select," + activeDocument.fullName.fsName;
system(cmd);
May not work with non-English names.
Copy link to clipboard
Copied
Thank you. This is a very great answer. Exactly what I need, thank you again. Wish you a good day
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I want to use the ''reveal in explorer'' function so I can open the next image
Copy link to clipboard
Copied
I want to use the ''reveal in explorer'' function so I can open the next image
Can you help me with a code so I can open the image to the right of the currently selected image (ie Apple TV+-10 image) thank you
By @trường_1768
That's very literal of how a human would manually do it and not how one would generally do things via scripting.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Maybe I understood what you want
var the_name = activeDocument.name;
var files = activeDocument.path.getFiles();
files.sort(sort_func);
function sort_func(a, b)
{
// Sorting will be alphabetical.
// It may differ from the one set in the explorer, especially for names with numbers.
// For exact matching of sorting, you need to write another sorting function.
// Google will help you. )
if (a > b) return 1;
else if (a < b) return -1;
else return 0;
}
// here you can close activeDocument
// activeDocument.close(SaveOptions.DONOTSAVECHANGES);
for (var i = 0; i < files.length; i++)
{
if (files[i].name.toLowerCase() == the_name.toLowerCase())
{
if (i != files.length-1)
{
open(files[i+1]);
break;
}
}
}
if (i == files.length) alert("it was the last file");
Copy link to clipboard
Copied
thank you. that's all i wanted. thank you for that, it will help my work a lot. have a nice day
Copy link to clipboard
Copied
I'll mark r-bin's reply as the correct answer for you.
Copy link to clipboard
Copied
Rather than telling us what steps you think you would like to do, perhaps just describe the process, the actual task. There may be a different way to the same result.
Such as:
"From a single folder, I would like to batch automate combining two alphabetically sorting files into a layered PSD file".
Copy link to clipboard
Copied
yes. thank you. maybe because of the language barrier so my explanation is a bit confusing. but everything is resolved, maybe it will help the work for the company I am working for. thank you again
Copy link to clipboard
Copied
OK, please mark the replies that helped as a correct answer.
If you need further help, perhaps post in your native language and we can use translation software.