Skip to main content
Innotex Nico Tanne
Inspiring
October 9, 2024
Answered

Save as in predefined folder with all dialogModes

  • October 9, 2024
  • 2 replies
  • 660 views

 

var saveDialog = new ActionDescriptor();
saveDialog.putBoolean(stringIDToTypeID("saveAs"), true);
saveDialog.putString(stringIDToTypeID("as"), "TIFF");
executeAction(stringIDToTypeID("save"), saveDialog, DialogModes.ALL);

 

I need help, is it possible to open the save as dialog in a predefined folder? i have a variable directoryPath with the path in which save as should open. but i have not found a working solution 😞 can anyone help me 🙏

This topic has been closed for replies.
Correct answer r-bin
quote

Thank you very much! But unfortunately that doesn't work either 😞


By @Innotex Nico Tanne


How so? Both work for me when I change ~/Desktop to say ~/Documents.

 

As @Lumigraphics wrote, this can be done with standard DOM code which is more accessible as you will find more examples and people who know DOM vs AM coding.


quote
quoteHow so? Both work for me when I change ~/Desktop to say ~/Documents.

By @Stephen Marsh

\

In Dialog Modes.ALL neither the script nor the similar Action works for me. I think it can't be fixed, because the bug is 100 years old, at least for Windows

2 replies

Legend
October 9, 2024

Why use AM code for this? What you want can be done with regular ScriptUI.

Innotex Nico Tanne
Inspiring
October 10, 2024

do you have an example for me? I want  to save a tif to a defined Path with all dialogs and not as a copy.

Stephen Marsh
Community Expert
Community Expert
October 9, 2024

I'm not very good with AM code.

 

Here is the raw SL recording:

 

var idsave = stringIDToTypeID( "save" );
    var desc9 = new ActionDescriptor();
    var idas = stringIDToTypeID( "as" );
        var desc10 = new ActionDescriptor();
        var idbyteOrder = stringIDToTypeID( "byteOrder" );
        var idplatform = stringIDToTypeID( "platform" );
        var idIBMPC = stringIDToTypeID( "IBMPC" );
        desc10.putEnumerated( idbyteOrder, idplatform, idIBMPC );
        var idsaveTransparency = stringIDToTypeID( "saveTransparency" );
        desc10.putBoolean( idsaveTransparency, true );
    var idTIFF = stringIDToTypeID( "TIFF" );
    desc9.putObject( idas, idTIFF, desc10 );
    var idin = stringIDToTypeID( "in" );
    desc9.putPath( idin, new File( "~/Documents/myFile.tif" ) );
    var iddocumentID = stringIDToTypeID( "documentID" );
    desc9.putInteger( iddocumentID, 862 );
    var idlowerCase = stringIDToTypeID( "lowerCase" );
    desc9.putBoolean( idlowerCase, true );
    var idsaveStage = stringIDToTypeID( "saveStage" );
    var idsaveStageType = stringIDToTypeID( "saveStageType" );
    var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
    desc9.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction(idsave, desc9, DialogModes.NO);

 

I started hacking at it:

 

var desc9 = new ActionDescriptor();
var idas = stringIDToTypeID("as");
desc9.putPath(stringIDToTypeID("in"), new File("~/Documents/"));
var idlowerCase = stringIDToTypeID("lowerCase");
desc9.putBoolean(idlowerCase, true);
executeAction(stringIDToTypeID("save"), desc9, DialogModes.ALL);

 

Hope this helps!

Innotex Nico Tanne
Inspiring
October 9, 2024

Thank you very much! But unfortunately that doesn't work either 😞

Stephen Marsh
Community Expert
Community Expert
October 9, 2024
quote

Thank you very much! But unfortunately that doesn't work either 😞


By @Innotex Nico Tanne


How so? Both work for me when I change ~/Desktop to say ~/Documents.

 

As @Lumigraphics wrote, this can be done with standard DOM code which is more accessible as you will find more examples and people who know DOM vs AM coding.