Known Participant
November 7, 2024
Answered
reveal in explorer js
- November 7, 2024
- 4 replies
- 3783 views
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");
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.