Skip to main content
Known Participant
February 12, 2021
Answered

I want to move the file in active document

  • February 12, 2021
  • 1 reply
  • 2010 views

var path1="E:/FG/";
Folder((fnp = (fle = (aD = activeDocument).name).parent + '/USED IMAGE/')).create(), File(fle).remove()
aD.saveAs(File(fnp + aD.name), new JPEGSaveOptions()),aD.saveAs(File(path1+aD.name), new JPEGSaveOptions()),aD.close(SaveOptions.DONOTSAVECHANGES);

 

I wish in active document of image file move the directory and don't close the file.. Is that possible ??

Thanks in Advance

This topic has been closed for replies.
Correct answer Kukurykus

I mean move the layer to directory and without close..


So not the file, but the layer? Then you can't move it, but export...

1 reply

Kukurykus
Legend
February 12, 2021

Use rename method or others, more complicated: To move files and folders

MXKSAuthor
Known Participant
February 12, 2021

I want to move the active document in directory. And Don't close the file

This script work only Active Document.

Legend
February 12, 2021

It's close the file in Photoshop , I want to move the file without close the image file in photoshop


 

Folder (path1=("E:/FG/")).create();
Folder((fnp = (fle = (aD = activeDocument).fullName).path + '/USED IMAGE/')).create();
File(fle).remove();
aD.saveAs(File(fnp + aD.name), new JPEGSaveOptions());
aD.saveAs(File(path1+"/" + aD.name), new JPEGSaveOptions());

 

I didn't understand the question a little. In the text you write one thing, and in the code - another.

 

You save the file twice: 

- first time to USED IMAGE subdirectory

- second time to directory E: / FG /

Accordingly the file path changes twice

 

If you only need to put the file in a subfolder - remove the last line