Change SaveForWeb save path

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

deshu

Change SaveForWeb save path

Post by deshu »

Hello everybody.

Is there a way, to set the SaveForWeb default save path, without actually saving the file?

All I want my script to do, is to change the save path, and open SaveForWeb GUI, so I can manually change settings, and, when I finally press save, the default path would be the same as current activeDocument.

To me, its extremely irritating, that photoshop always want to save in the last used directory.


If it can't be done directly, is there any workaround? Like saving temporary file in the activeDocument directory, removing it, and opening SaveForWeb GUI?

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

deshu

Change SaveForWeb save path

Post by deshu »

Can someone reply?:)
Paul MR

Change SaveForWeb save path

Post by Paul MR »

I don't think it is possible to set defaults in GUI SFW, but you could always save the file using a script.
deshu

Change SaveForWeb save path

Post by deshu »

Probably you are right. Sad thing is, that my only idea fails.

The only way I know, to set the default (or initial) path in GUI SFW is actualy saving the file in that path.

So i thought i can do script, which saves a temp file in activeDoc directory, deletes it, and opens SFW panel.

I came out with this:
Code: Select all#target photoshop
var doc;

if(app.documents.length > 0){
   
    app.bringToFront();
    doc = app.activeDocument;
   
    var _path = '';
   
    try{
        _path = activeDocument.path;
    }
    catch(e){
        alert('Please save document first');
    }
   
    if(_path.toString().length > 0){
        tempExport();
    }
}

function tempExport(){
    var f = new File(doc.path + '/temp.png');
    doc.exportDocument (f, ExportType.SAVEFORWEB);
    f.remove();
}

It's doing its job, but sadly it don't set the GUI SWF default/initial save path. Oh lord how annoying that software is.