7 Replies Latest reply on Sep 1, 2016 5:54 AM by DBLjan

    Starup-Script: If File is locked (while open elsewhere), open As Copy

    DBLjan Level 3

      Hi Scripting Aces.

       

      im looking for a (startup-)script or something similar, which deals with the following problem, bugging me and my collegues in InD for years:

       

      While browsing with the Finder on your server, or having a look on a folder youre working in, you want to open a InD-doc by double-clicking there.
      Or, to place my assets from a predefined folder I use a script, and I dont have the "Open As Copy"-option there by throwing a app.place(pathToPredefinedFolder.openDlg ('Get some files', '*.*', true)).

       

      So, you come to that file you want to open, and then you find out: Someone has opened it (its locked) - you have to cancel your open-procedure, and take again the browsing route with the native InD dialog, to have that option.

       

      What if…(Ancient Aliens style:)

       

      -a startup-script handler monitors "trys to open", if that fails because of locking, then opens that file As Copy.

      -neat would be a snazzy dialog "File locked. Open as Copy?"

      -super-neat would be: Files that get OpenedAsCopy become UNNAMED-1, but since I know the filename, the script could change the docname to the filename i tried to open (with  _COPY added to the name).

       

       

       

      I wonder, because i imagine this to be coded quite easy, why noone else did bother by now. Althought it could be a little feature added into next InD versions that doesnt hurt.

        • 1. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
          [Jongware] Most Valuable Participant

          I'm not too sure it's a good idea.

           

          In theory, a startup script can save the filename to be opened and afterwards checked if it was successful. Behavior on different file systems seems to be erratic, but if I remember correctly, attempting to open an in-use file should fail with an error message. If so, the script could immediately re-try with opening as a copy (see InDesign ExtendScript API (10.0) ), and if that succeeds, Save As with 'copy' appended to the name.

           

          The danger, however, lies in that you are opening a copy for all the wrong reasons! Suppose a colleague is working on a document, and its client calls to submit Just One More Thing to change. Since you happen to pick up the telephone, you open the file (magically getting a copy), make the suggested changes, then save it. Then you have two versions of the same document floating around!

          • 2. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
            DBLjan Level 3

            Oops…our LotusNotes-Client managed somehow to post my ImOnHoliday-repley here as I got one day off yesterday, sorry for that :-)

             

            But to your concern:

            Maybe youre right, the doc.name thingy is not ideal, since I maybe dont want to save the file and cause confusion. I thought it would be better to house the name of the document somewhere to backtack whats open. I can imagine writing it to a meta-tag, but thats not ideal too. I would rather be warned instead "The file <NAME>.indd youre trying to open is locked. Open as copy?" {"Abort","Yes please"}

             

            But for the function/idea in general:

            If I do browser there and want to open a file, its always intended that i want to use the file. So an option to better get a copy rather than just failing and do the opening process again would be a nice to have.

            Our workflow is to copy assets from old InD-files all the time, because our CMS is not up to par…better: non existent. And its quicker to just copy final texts and assets. So we dont get the problem messing up other documents.

             

            I would like to script this myself, but i really cant get a handle on javascript (since sadly im just a programmer 10% of my time because its not my job). And I had problems with start-up scripts in AppleScript, which i managed to get a better handle on.

            • 3. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
              Jump_Over Level 5

              Hi,

               

              1st idea:

              Script could check if    ~thisDoc~*.IDLK    file exists while opening and continue if NOT or openAsCopy if YES.

               

              2nd idea:

              If target files are sources of content to copy ==> did you consider to use library files (INDL) which actually could be opened by many at once?

               

               

              Jarek

              • 4. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
                DBLjan Level 3

                1.) I have a file: Oktober 3 2016 DE

                What i get as IDLK: ~oktober 3 2016 de~io_a6$.idlk

                I dont know what tempname InD generates, so aa) the string comparison must be fuzzy, or bb) has to ignore whats between ~ and .idlk. And i have to underline: Im poor with JS.

                 

                2.) Most of these logos/pictures links are broken, so the libary imports are all grey, thats a proble. CS55 which is not long ago in our company had the problem of mixing up stylesheets transported via libary, so the use of this feature requires a overhaul of our workflow, which i cant force.

                • 5. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
                  Loic.Aigon Adobe Community Professional

                  You may also turn those old indesign files into templates so opening them is never an issue. Or consider a copy to a local folder prior to open the instance.

                   

                  I would not trust much on idlk files. From time to time I saw remaining idlks files while the file were close indeed. IMHO, I would just avoid the situation of trying to open a possibly already open document. And that would be by copying teh source document and opening the instance or using indt files preferably.

                   

                  FWIW

                   

                  Loic

                  • 6. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
                    Laubender Adobe Community Professional & MVP

                    Hi Jan,

                     

                    just a comment on library assets from *.indl files and placing snippets:


                    If you place an asset and the style is already in the document, the document rules.

                    If the style is not there a new style will be added.

                     

                    So if you place many assets from different sources in one document you could create quite a mess with styles and colors.

                     

                    This did not change with InDesign CC 2015. Using CC Libraries would be an alternate option, but one has to test very thoroughly what rules are applied, if you drag out assets on the page.

                     

                    Regards,
                    Uwe

                    • 7. Re: Starup-Script: If File is locked (while open elsewhere), open As Copy
                      DBLjan Level 3

                      Becuase of this restrictions and my collegues altering the default style on every object/text, everything gets messy after import. So thats not an option. To copy the file if locked isnt ideal too, because our files get blown up to ~150mb+ and resident on a file server, making a copy on the fly take some seconds.

                       

                      If I could make eventhandlers work in AplleScript, it would work somehow like this:

                       

                      afterOpen

                      set count documents to temp_count

                      try open myFile

                      if count documents = tempcount then

                      set myResult to display dialog "Open <myFile> As Copy?"

                      if button pressed of myResult = "Yes" open myFile as copy