Copy link to clipboard
Copied
Hello! How to recover "open" only the last closed document.
It's possible?
Thanks.
You could try....
#target photoshop;
app.bringToFront();
var f = File(recentFilePaths()[0]);
if(f.exists) open(f); else alert("Sorry " + f.fsName + " does not now exit");
function recentFilePaths(){
var names = [];
var ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("recentFiles") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList(stringIDToTypeID("recentFiles"));
for(va
...
Copy link to clipboard
Copied
You would most likely have to write a script to keep track of what was last closed. So you would run the script to close the file, then it would write the file's info to a csv file, which could then be accessed to open it with a different script.
Copy link to clipboard
Copied
This is a topic never addressed, never seen in any community.
Interesting your idea Chuck Uebele, but I would never be able to do it alone, I know the least about scripting, it would be a great impolite of me to abuse your kindness to achieve this!
A good alternative would be:
If I open a file and then close it, it has been registered in the menu list "Open Recent". I would only need the first item on that list.
I entered this modified script: It didn't work for me: Window 10 Photoshop 21.0.0
#target photoshop
app.bringToFront();
var maxFiles = 1;
var recentItems = [];
var len = recentFiles.length;
for (var i = 0; i < len; i++)
{
recentFile = recentFiles;
if (recentFile.exists)
{
recentItems.push(recentFile);
if (recentItems.length == maxFiles+1)
{
break;
}
app.open (File(recentItems));
}
}
Source:
https://community.adobe.com/t5/photoshop/script-for-quot-open-recent-quot/td-p/7378756?page=1
Copy link to clipboard
Copied
The first item on this list is not the last closed file.
Copy link to clipboard
Copied
Hi r-bin, regardless of whether it is the last file or not, It would be nice to open only the first item on the list. Would you have any ideas? Please share
Copy link to clipboard
Copied
if (recentFiles.length) app.open(recentFiles[0]);
UPD.
if (recentFiles.length && recentFiles[0].exists) app.open(recentFiles[0]);
Copy link to clipboard
Copied
You could try....
#target photoshop;
app.bringToFront();
var f = File(recentFilePaths()[0]);
if(f.exists) open(f); else alert("Sorry " + f.fsName + " does not now exit");
function recentFilePaths(){
var names = [];
var ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("recentFiles") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList(stringIDToTypeID("recentFiles"));
for(var a = 0;a<desc.count;a++){
names.push(desc.getPath(a));
}
return names;
};
Copy link to clipboard
Copied
Man, that's all I need! SuperMerlin you were phenomenal. How nice to know that you still go to and share your knowledge with this modified community. Eternally grateful.