This content has been marked as final. Show 11 replies
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, 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
* 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:
Hope this is useful.
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 !
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.
// Remove all event listeners
// Remove all menu items created by scripts
Here is the updated link:
Hope this makes some people's lives easier :)
Sorry, just noticed a mistake, I forgot to update a line to use the new localized menu item name. Here is the fixed version:
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 :-)
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!
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.
Hey folks, sorry that I haven't been able to respond earlier, I'm extremely busy right now. Here is a re-upload:
@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 ).
// 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...)
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...