11 Replies Latest reply on Oct 9, 2008 1:16 PM by Harbs.

    Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)

    Level 1
      any one know what script can make it ???

      ike this...

      http://img402.imageshack.us/img402/905/20080517085017hb3.jpg
        • 1. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
          Loic.Aigon Adobe Community Professional
          Hi,

          http://dl.free.fr/bsa9zlPGX/breakcolumns.jsx

          It's quite probable someone already thought about this and wrote a much more powerful script. Anyway, i wrote this little piece of javascript code.
          You can improve it, the possibilities are endless (analysis of the text frame [drop shadows, gaps...]but now i's up to you.
          Hope it helps.

          Loic
          • 2. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
            Level 1
            Loic, great job, that's a very useful script!

            I found myself using it a lot, so I created an enhanced version, borrowing a few lines from yours, I hope that's ok with you. My script fixes most of the problems, and it installs itself in InDesign's menu system, so it is virtually indistinguishable from a built-in command. Once you run it, you can reach it via "Object > Break Into Columns". If you set the script to load when InDesign starts, you don't even have to use the scripts panel at all.

            Fixes/Enhancements over Loic's version/previous versions (hope I get that formatting right):

            * The code no longer uses script labels. Existing script labels are no longer lost and the command can be run more than once per document without manually clearing out all script labels first.

            * The script now installs itself into InDesign's "Object" menu. The menu item is disabled automatically if the command cannot be run (for example if no text frame is selected).

            * Frames with only one column are handled correctly

            * Z order is preserved

            * Text Frame attributes such as Fill, Stroke etc. are preserved

            * Locked frames are handled correctly (i.e. the command is grayed out)

            * Text threads are preserved

            * Assigned InCopy frames are dealt with correctly. They used to lose the link to the original story file and end up as "Unassigned InCopy Content"

            * Assigned InCopy frames no longer need to be checked out for the script to work

            * The new frames end up on the same layer as the original one

            * The new frames end up on the same page/spread as the original one, rather than being placed on the first page of the document

            Know Issues:

            * Choosing "Edit > Undo" will undo the script in steps. I don't know if there is a way for scripts to act as transactions in the scripting interface, but using the C++ API just for that is probably not worth it.

            * Transforms such as rotated frames are not handled correctly

            * Only InDesign 5.0 (CS3) and above is supported

            Here is the download link:
            http://www.sendspace.com/file/s9fcae

            Hope this is useful.
            Peter
            • 3. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
              Loic.Aigon Adobe Community Professional
              It sounds amazing what you did. Congratulations.
              Just a point, I got a error using it because I am on a french interface. So it doesn't find Object menu (in fr it's objet). Maybe we should think about either a localization either non-locale enumeration.
              Other think, as I felt like nothing happen, i clicked and clicked again to launch the script, so I have now three "break columns" items. Is it possible to place a control condition for checking is the script has placed yet the command ?
              Amazing really. You put the art of scripting to a level I wasn't even closed to !
              Loic
              • 4. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                Level 1
                Wow, thanks for your kind words! This is my first real working InDesign script ever, so I was terrified I might be doing something the wrong way without noticing it.

                Building in a check if our menu item already exists is pretty simple. I added it to the updated version.

                To reload the script during development, I do this: I created a little script that removes all scripting event handlers and menu items. So whenever I wanted to reload the script, I would run the clean script first. Here is what it looks like. I think this technique is mentioned somewhere in InDesign's scripting guide.

                //
                // ClearEventListeners.jsx
                //

                #target "InDesign"
                #targetengine "session"

                // Remove all event listeners
                app.eventListeners.everyItem().remove()

                // Remove all menu items created by scripts
                app.scriptMenuActions.everyItem().remove();

                Now for the localization problem: I edited the code so that my getTopLevelMenu() function now uses app.translateKeyString to convert the name of the object menu into the current InDesign language. I also implemented a primitive localization system and added (probably very bad) translations for French, Italian, and German of both the menu item name and the error messages. If the current language is not supported, English is used. It's easily extensible and could theoretically be used for other scripts as well. However, I can only test this on an English version of InDesign right now, so there might be some bugs I wasn't able to find. Moreover, I'm not very familiar with JavaScript, so the way I chose may not be the most efficient way to do it, but hey, it works.

                Here is the updated link:
                http://www.sendspace.com/file/tca5wr

                Hope this makes some people's lives easier :)
                Peter
                • 5. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                  Level 1
                  Sorry, just noticed a mistake, I forgot to update a line to use the new localized menu item name. Here is the fixed version:

                  http://www.sendspace.com/file/1idgzv

                  Peter
                  • 6. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                    Loic.Aigon Adobe Community Professional
                    Hi Peter,
                    That's really efficient now.
                    You should adress your script to the IndesignSecrets.com site. They may spread the utility of the script to a wider audience.
                    Good job. Maybe we will work again on some stuff one day :-)
                    Regards Loic
                    • 7. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                      Level 1
                      Peter,

                      This script sounds great, but your Sendspace links appear to no longer work. If you (or someone else) can repost the file it'd make my day. Thanks!

                      Sylvan
                      • 8. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                        Stephan Moebius Level 1
                        Hello Peter,

                        please re-Upload your script once more. I could use it. If you like, i can put it on a more permanent place and paste the link.
                        regards,
                        Stephan
                        • 9. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                          Level 1
                          Hey folks, sorry that I haven't been able to respond earlier, I'm extremely busy right now. Here is a re-upload:

                          http://www.speedshare.org/download.php?id=1619BF2813

                          @Stephan: That would be great, I don't think those free-hosters are much good. I had been thinking about uploading it to Adobe Exchange, however, there are a few minor issues that should be resolved before releasing it to the general public, but as I mentioned, I'm extremely busy right now.

                          Maybe the following is of interest to some of you: There is an alternative script by Steve Wareham available from InDesign secrets ( see http://indesignsecrets.com/convert-multicolumn-text-frames-to-individual-frames-script.ph p ).

                          Regards
                          Peter
                          • 10. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                            Stephan Moebius Level 1
                            Hi,
                            i have put your script on my server.

                            Download here: breakcolumns.jsx

                            Cheers,
                            Stephan
                            • 11. Re: Script Indesign CS3 - Split multicolumn TextFrame to separated TextFrames (For PC)
                              Harbs. Level 6
                              Nice script.

                              Just FYI...

                              // KNOWN ISSUES/FIXMES:
                              //
                              // - Undo undoes in steps. I don't know if InDesign exposes
                              // a transaction-based undo framework to scripts, but I guess not.
                              // But using the C++ API is most likely not worth the extra effort.
                              Starting with CS4 you can. (using doScript)

                              // - Transforms are not yet handled correctly
                              // - There is some weird problems when loading this as a startup script.
                              // This is probably related to us using the session engine.
                              Yes. You should take a look at the startup scripts which come with InDesign to see how it's done.
                              // - If identifiers like locLocalize() are used in any other script running
                              // in the session engine, the later ones overwrite stuff from the earlier
                              // ones, which can lead to an earlier script calling the wrong version.
                              // I think I heard we can define our own engines with persistence support
                              // by specifying #targetengine "somethingArbitrary", but we'd have to
                              // check on this.
                              Yes you (can and) should definitely use some arbitrary engine name!!! You can also wrap the whole thing in a function, and it will not be affected by functions of the same name on the more global level. (It's good practice anyway...)

                              // Invoke main (JavaScript sucks...)
                              main();
                              You can use unnamed self invoking functions in JS. The truth of the matter is that the "main" function is not strictly necessary. Especially, if you wrap everything in an outer function...