Skip to main content
AG_Ps_100
Inspiring
February 18, 2019
Answered

open tif file

  • February 18, 2019
  • 1 reply
  • 937 views

Hello everyone,

I have this script that saves a tif file. It adds "NEWFILE" at the end of the filename in the same path.

whenever I run the script in Photoshop it  works and saves the document in the folder and now i have 2 files in my folder, the original one and another one that is with NEW in the end, the file that is in Photoshop isn't the one I've just saved.

I want to open the file I've just saved in Photoshop, how do I open it?

#target photoshop  

    main();  

     

     

    function main(){  

    if(!documents.length) return;  

    var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');  

  

    try{ var savePath = activeDocument.path; } 

    catch(e){  

    savePath = Folder.selectDialog("select folder");

    alert("You must save this document first!\nTo establish a save path..."); 

    return 

        }  

    var fileList= savePath.getFiles(Name +"*.tif").sort().reverse();  

   

   

   var saveName = File(savePath + "/" + Name + "NEWFILE") 

  SaveTIFF(saveName);    

    }

   

   

    ////////////////////////////////////////////////////////////////////////////////////////////////// 

    function zeroPad(n, s) {   

       n = n.toString();   

       while (n.length < s)  n = '0' + n;   

       return n;   

    };      

    function SavePSD(saveFile){   

    psdSaveOptions = new PhotoshopSaveOptions();   

    psdSaveOptions.embedColorProfile = true;   

    psdSaveOptions.alphaChannels = true;    

    psdSaveOptions.layers = true;    

    activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);   

    };  

   

    function SaveTIFF(saveFile){ 

tiffSaveOptions = new TiffSaveOptions();  

tiffSaveOptions.embedColorProfile = true;  

tiffSaveOptions.alphaChannels = true;  

tiffSaveOptions.layers = true; 

tiffSaveOptions.imageCompression = TIFFEncoding.NONE; 

//tiffSaveOptions.jpegQuality=10; 

activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);  

Correct answer AG_Ps_100

Found solution:

var myNewFile = File(saveName + ".tif");        //saveName contains the path and the file name (file extension not included so i added it)

open(myNewFile);

1 reply

AG_Ps_100
AG_Ps_100AuthorCorrect answer
Inspiring
February 19, 2019

Found solution:

var myNewFile = File(saveName + ".tif");        //saveName contains the path and the file name (file extension not included so i added it)

open(myNewFile);