Skip to main content
Participant
March 4, 2022
Open for Voting

Remember Export Location

  • March 4, 2022
  • 19 replies
  • 2542 views

It would be wildly useful if when doing an export (to .jpg, etc, not the quick export to PNG) that it would remember where you last save an export from that project. If it hasn't been exported previously, for it to default to where the .psd file (or source file) is located.

 

This should be saved within the .psd file, since it requires you to save after doing the export. The quick export to PNG goes to the same location as the source file and that is great.

 

An alternate option would be have a button on the export screen to go to source location.

19 replies

Stephen Marsh
Community Expert
Community Expert
March 12, 2022

I have made some mostly cosmetic changes to both scripts, when running the 2 of 2 script the title of the new dialog should show "Export Layers To Files - Last Location" instead of the standard "Export Layers To Files" to help identity which script is in use.

 

I can't work out why you are not seeing the same results as I am. You can download the updated code and try again, however, I am doubting that you will have a different result. Remember that unsaved files will be blank for the path, only saved files will pickup the path from the log file. The joy of coding!

Known Participant
March 12, 2022

Stephen

 

Many thanks for your continued effots on this - it's much appreciated. However, sadly, I'm still getting the same result. Running script 1 works perfectly, and a windows file dialog promopts me to set the save path, and the confirmation widown then tells me to run Script 2. On running that though, I simply get the regular save dialog but with no path saved in the field - still defaulting to the User folder 😞

 

I've attached screenshots of the two sequences, but I have no idea why the second one isn't picking up the saved path, as that is definitely updating in the log file if I choose a new folder to save to.

 

Cheers

Phil.

Stephen Marsh
Community Expert
Community Expert
March 12, 2022

@Phil Wolstenholme23 

I have split the script into 2 separate scripts, so rather than holding down shift, the script 1 of 2 will be run to set the path, while script 2 of 2 will bring up the layers to files window with the path pre-set. These scripts will appear in the standard File > Scripts menu.

 

https://github.com/MarshySwamp/Export-Layers-To-Files-Last-Location-2-Part

Stephen Marsh
Community Expert
Community Expert
March 11, 2022

I'll look into it, I was shooting from the hip!

 

EDIT:

 

@Phil Wolstenholme23 – It works as I expected, however, I didn't clearly state the objective. By removing all of the code from before the target statement, the script will no longer appear under the File > Export menu, it will instead appear in the standard File > Scripts menu.

 

I changed the name of the Export menu item and created a new random UUID to avoid any conflict with the default script, which works fine for me in 2021 and 2022 versions on both Mac and Win, so I can't explain why the script works on the first shift run, but the original script is called on the second run without shift.

 

Let's see how this goes with that code chunk removed...

 

Another thing to try would be to backup and remove the standard Adobe script.

Known Participant
March 11, 2022

Sorry, starting from where? Removing everything before # target photoshop causes the script not to load. I'm deep into some work at the moment so apologies if this is rather slow.

Stephen Marsh
Community Expert
Community Expert
March 11, 2022

I can't explain why you are getting a different result than me...

 

Try this, remove all of the code before:

 

#target photoshop

 

And report back...

 

P.S. The script can be modified and split into two separate scripts, the key modifier is just a nice touch but not a requirement.

Known Participant
March 11, 2022

Sorry for the massive delay in replying - been a bit busy on other things. I just checked the log file in the User folder and the folder location I required was saved correctly in there. So I'm a bit baffled by the regular save dialog then appearing when I run the script the second time. I just did the process again on a different set of images - the log file just updated correctly to my new location, I then ran the script again without holding the Shift key down, and up popped the regular Export Layers to Files dialog - and if I hit Run it asked me to specify a folder location. Hitting 'Browse' then just takes me to the User folder! So back to square one.

Stephen Marsh
Community Expert
Community Expert
March 8, 2022

You can always double-check that the save path has been successfully written to the preference file ".Export Layers to Files Last Location.log" which can be found in the user's home folder. For Mac OS, this file is invisible as it has a leading dot character. The script can be edited to remove the leading dot character.

 

This is the path that the script will use if the file has been previously saved. If the save location is not explicitly set via the shift key run, the default location will be the active document path (as per the standard script). Unsaved source files will default to a blank save location (as per the standard script).

 

The path has to be explicitly set via the shift run step to log the save path, I don't know how to make this automatically happen without this manual preliminary step.

Known Participant
March 8, 2022

I'm on Windows. Maybe I should try it with a different folder setup than the source. Sadly I have to leave now and won't have internet until tomorrow evening, so I'll check back then.

 

Thanks for the help so far!

 

Phil.

Stephen Marsh
Community Expert
Community Expert
March 8, 2022

The second time that you run the script, are you running:

 

Export Layers To Files - Last Location.jsx

 

Which is the correct script, or are you running the incorrect script (Export Layers To Files.jsx)?

 

EDIT: I have tested on both Mac and Win v2021 and v2022 and it works as expected...

 

In this screenshot, the original file is on the desktop. When I held down shift, I selected a folder titled output on the desktop. When the script was run without shift, it defaulted to the output folder and not the desktop. Are you on Mac or Windows?