6 Replies Latest reply on Oct 28, 2011 7:54 PM by John Hawkinson

    [Mac][JS] Where does InDesign store last "Save As" folder path?

    absqua Level 4

      Is this location accessible to scripting? I've looked around the preferences objects as well as the "Class" properties of the File and Folder objects without finding anything.

       

      Coming up empty-handed there, I looked through the filesystem for .plist files it might be using. It must be stored in some such place, because the location persists across sessions and survives a trashing of the InDesign Defaults file at ~/Library/Preferences/Adobe InDesign/Version 7.0/en_US/InDesign Defaults. It also seems to write the location to wherever it lives immediately upon a Save As rather than at application close. I've tried discovering the location with lsof but either can't catch it in the act or am missing which of the hundreds of files InDesign has open is the culprit.

       

      It does not appear to be in com.adobe.InDesign.plist or com.adobe.mediabrowser.plist. There is a path property (NSNavLastRootDirectory) stored in the former file but it's not the one.

       

      I hope I'm making this more complicated than it is and that it can be accessed in a DOM property somewhere. Does anyone know?

       

      Jeff

        • 1. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
          Harbs. Level 6

          Why do you need to know?

           

          Harbs

          • 2. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
            absqua Level 4

            I want to prevent the end user from saving in certain locations. (Specifically, any folder that contains a "Document fonts" folder. This is part of a lengthy preflight script, and my goal is to help everyone—I'm writing for an internal user base here—comply with company font management practices.) Without knowing ahead of time what location is going to pop up in the dialog, the only way I can rule out these locations is to wait for the File.saveDialog() to return and do something then—after the file is saved. If I knew ahead of time which folder InDesign was going to start with, I could start somewhere else and then gray out the "bad" folders with a filter function.

            • 3. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
              sstanleyau Level 4

              It's probably in ~/Library/Preferences/com.adobe.InDesign.plist

              • 4. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
                John Hawkinson Level 5

                So you're asking the wrong question. You dont' care "where does InDesign store it," you care "where can I get it?" The two may not be the same.

                 

                Have you tried ~/Library/Caches/Adobe InDesign/Version 7.0/en_US? Especially the InDesign SavedData?

                1 person found this helpful
                • 5. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
                  absqua Level 4

                  So you're asking the wrong question. You dont' care "where does InDesign store it," you care "where can I get it?"

                   

                  Actually I'd like to set it as well as get it. I would like to integrate with InDesign's expected behavior as much as possible; it would be ideal if, the next time a user did a Save As, it defaulted to the location they had chosen when they ran my script. Little inconsistencies like that drive me batty. It's a small issue and quite likely not worth the time I'm spending on it, but at this point I'm so confused by how InDesign is maintaining these paths that I would like to understand for understanding's sake.

                   

                  The InDesign Saved Data cache file you pointed out does indeed contain a lot of paths, and these kinds of save, import and export locations appear to be among them. They jump around in the file a lot, though. If you have any experience parsing this file and can help me look for whatever markers it uses I would be grateful.

                   

                  While in my earlier tests I never saw any path property in com.adobe.InDesign.plist but NSNavLastRootDirectory, I have since sometimes seen NSNavLastCurrentDirectory:GetFile:0 and NSNavLastCurrentDirectory:PutFile:0, and these do hold what you would expect. However, all installed versions of InDesign read and write to this file without affecting each other's behavior in this regard. And I haven't been able to figure out yet when InDesign writes or reads the path to its cache file and when it uses the .plist file.

                   

                  Complicating things further, it looks to me like calling File.saveDialog() in CS5 brings up the folder in NSNavLastRootDirectory, regardless of what was last chosen during a Save As in the UI, while CS4 respected the last Save As. Using the value in NSNavLastRootDirectory via

                   

                  var startFolder = Folder(app.doScript("return (do shell script \"defaults read \" & \"com.adobe.InDesign\" & \" NSNavLastRootDirectory\")",ScriptLanguage.APPLESCRIPT_LANGUAGE))
                  

                   

                  will at least allow me to prevent the user from landing in a restricted folder in CS5.

                  • 6. Re: [Mac][JS] Where does InDesign store last "Save As" folder path?
                    John Hawkinson Level 5

                    Jeff:

                    The InDesign Saved Data cache file you pointed out does indeed contain a lot of paths, and these kinds of save, import and export locations appear to be among them. They jump around in the file a lot, though. If you have any experience parsing this file and can help me look for whatever markers it uses I would be grateful.

                    It appears to be a standard InDesign binary format file, so I think you have to follow a chain of 10 or 15 pointers to find any particular string, and it's just not really practical or a good idea. So..."No, sorry," I guess. You might be able to extra what you want with "strings" and searching for known path components, but that wouldn't be terribly robust. I certainly wouldn't attempt tp write to it.

                     

                    Sorry.