Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save as in predefined folder with all dialogModes

Contributor ,
Oct 09, 2024 Oct 09, 2024

 

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 🙏

TOPICS
Actions and scripting
571
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Oct 09, 2024 Oct 09, 2024
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
Translate
Adobe
Community Expert ,
Oct 09, 2024 Oct 09, 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 09, 2024 Oct 09, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2024 Oct 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 09, 2024 Oct 09, 2024
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 09, 2024 Oct 09, 2024

Thank you so much! I

changed the code to save Tiff and now all works fine 👍🙏

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 10, 2024 Oct 10, 2024
LATEST

I originally tested the code I posted on a Mac, which works correctly. I just tested in Windows and it doesn't work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 09, 2024 Oct 09, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 09, 2024 Oct 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines