Copy link to clipboard
Copied
Hello everyone,
I have this file in E:/test/DSC_1912.NEF
when I open it on Photoshop, the Camera Raw dialog pop ups, now I have the option to Open as Image or Open as Object.
I want Open as Object, but when I open the file, the name changes and adds "-1" in the end and more importantly the new path of the file (location) isn't as the original file. and I need the original one for my scripts.
I want to save the file as TIF file in the same directory with the same name: E:/test/DSC_1912.TIF
Please help what can I do?
Copy link to clipboard
Copied
From the error message it seems like some script was running??? What script are you using? I do not see any on my machine with line 21 "alert(app.activeDocument.path);" Your document is new and has not been saved yet so there is no backing file. Like the message states. It looks like the Document opened name is what you write but the smart object layer name is the same as your RAW files name. What Script do you have installed that is using ACR creating Phoroshop docyments. So far the only things recorded in histort is open as Smart Object. And a snapshop DSC_1912. Why would a script want to alert you to the Backing file path? A new document open from a RAW file does not have a backing file Photoshop can not save Camera RAW files. So you new document does not have a backing file. Like the error message state. There is no activeDocument.path it has not been saved anywhere yet.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Before and after save document properties
Copy link to clipboard
Copied
See if this help you out some:
var rawFile = File.openDialog("Select RAW file" , "Select:*.nef;*.cr2;*.crw;*.dcs;*.raf;*.arw;*.orf;*.dng");
if (rawFile != undefined ) {
var fileName = decodeURI(rawFile).replace(/\.[^\.]+$/, ''); // strip the extension off
var rawPath = fileName.substr(0, fileName.lastIndexOf("/") + 1 ) ;
fileName = fileName.substr(fileName.lastIndexOf("/") + 1 ,);
app.load(rawFile);
saveTiff = rawPath + fileName + ".tif";
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFZIP;
activeDocument.saveAs(File(saveTiff), tiffSaveOptions, true, Extension.LOWERCASE);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.load(File(saveTiff));
}
else alert('no raw file selected');
Copy link to clipboard
Copied
If you had CS6, you could try Re: File path of an unsaved document
But on the CC for RAW files this will not work.
Copy link to clipboard
Copied
you both right, I ultimately would probably use choose a folder (or single file as JJMack said) and open the file and get its path by
1. opening it once as image and not as object and i will get the path that way, close the file, then opening it again as object
2. use list of files from folder, and then opening the file as object and doing something like that
for(var a = 0 ;a < fileList.length; a++)
{
open(fileList, OpenDocumentType.CAMERARAW, true);
myPath = fileList.path;
that way i will not need activeDocument.path, because I have it on the array.
> can you please help me to get a function that gets list of all the files in a folder? - no need for SubFolders (i think i saw 'getFiles' once)
> also if I get a list of all the files and folders using getfiles(), if i have a folder that has multiple subfolders in it and each folder's name is a number, how can i find the biggest number?