6 Replies Latest reply on Jun 11, 2014 6:32 AM by jessemac.design

    How to more fully control the save dialog function.

    jessemac.design Level 1

      Alright, first of all I don't know if what I'm asking is possible. I basically want to trigger a Save As dialog that opens to a specified folder and has custom text in the "Save As:" box, so the user can just review it and commit it. I know it's possible to do all of this through normal saveAs commands but I really need the ability to review and edit the file path and name before committing the save.

       

      I know how to specify a folder for the save dialog to open to and I also found a gimmicky way to get my own text into the "Save As:" box by passing it as a nonexistent folder path, but I cannot get them to both happen at the same time. Any help or workaround would be greatly appreciated.

       

      Thanks!

        • 1. Re: How to more fully control the save dialog function.
          JJMack Most Valuable Participant

          Photoshop ships with scripts that do Save As file types.  For example "Image Processor.jsx" and  "Export Layers To Files.jsx"  I would suggest looking at the code in these. I created as "SaveAs.jsx"  plug-in script for my own use with code stolen from "Export Layers To Files.jsx".

          • 2. Re: How to more fully control the save dialog function.
            jessemac.design Level 1

            Great idea, I'm fairly new to all of this stuff, so it's gonna take me a while to try and figure these out. In the meantime if there is a simple solution to getting custom default text into the saveDlg(); function that would be great.

            • 3. Re: How to more fully control the save dialog function.
              JJMack Most Valuable Participant

              saveDlg(); ???  what is that? Where did you see that? Is that some applescript thing?

              • 4. Re: Re: How to more fully control the save dialog function.
                jessemac.design Level 1

                I'm not sure where I saw it originally, but it's in the ExtendScript Toolkit library. I'm using it like this -

                 

                 

                var dir = Folder('Art');
                var pathName = dir.saveDlg('', '.jpg', false);
                

                 

                That opens up a save dialog box at my Art folder and saves the filepath as pathName which I use later to save the document.

                • 5. Re: How to more fully control the save dialog function.
                  JJMack Most Valuable Participant

                  I hack at JavaScript  don't know javascript and only use ExtendScript Toolkit for its F1 object Model viewer.  Here is what it shows me for "File.saveDlg (prompt: string , filter:any)" Seems to be a Platform file browser...  dialog  not a Photoshop Save As thing.

                   

                  File.saveDlg (prompt: string , filter:any): File

                  Core JavaScript Classes

                  Opens the built-in platform-specific file-browsing dialog, in which the user can select an existing file location to which to save information, and creates a new File object to represent the selected file.

                  Differs from the class method saveDialog() in that it presets the current folder to this File object’s parent folder and the file to this object’s associated file.

                  If the user clicks OK, returns a File object for the selected file.

                  If the user cancels, returns null.

                   

                   

                  prompt: Data Type: string

                  A string containing the prompt text, if the dialog allows a prompt.

                  filter (optional): Data Type: any, Default Value: null

                  In Windows only, a filter that limits the types of files displayed in the dialog.

                  In Windows only, a filter expression such as "Javascript files:*.jsx;All files:*.*". Not used In Mac OS.

                  s only, a filter expression such as "Javascript files:*.jsx;All files:*.*". Not used In Mac OS.

                  • 6. Re: How to more fully control the save dialog function.
                    jessemac.design Level 1

                    Very interesting. Well I will keep searching for possibilities through that route and I will start my search for a good Photoshop specific alternative. Thanks for the help, if anyone knows a better way to trigger a save dialog targeted to a specific folder with a default filename written in that would be extremely helpful.