When building complex scripts with lot of options that user can choose, it’s always great to allow user to also save selected settings and reuse them on next launch. We already discussed about this topic in earlier post [Saving script data within document] but I recently found better way for serializing and storing data.
In first post, I used simple “*” to separate multiple values, and at load time used split(*) to separate values back to Array. That’s not bad, and it’s working fine, but there is another much more elegant solution!
I created short sample to demonstrate usage and shortly explain how it works. Of course, you can extend it as you wish! So, let’s get started! 😀
Counting words and also paragraphs, stories, characters is something pretty easy to achieve, but very often done in wrong way. Most of the time, people are looping through stories, text frames, paragraphs and adding word count. That is OK, for short documents, with short stories, but as document length increases, script needs more and more time to loop through all stories, and get all words. People are forgetting about awesome method called everyItem! Method remained undocumented until InDesign CS3, but scripting experts such as Dave Saunders had already pointed out its forcefulness and already knew how to exploit it. It allows us to get all elements within collection. For more info about everyItem method be sure to check two awesome articles by Marc Autret: On ‘everyItem()’ – Part 1 and On ‘everyItem()’ – Part 2. So, let’s take a look how everyItem method can help us count stuff. 🙂
Hey people! How are you?! 😀
As you probably noticed, I’m not posting that much on blog last month or two. One of the reasons is that I’m preparing to take Adobe Certified Expert (ACE) exam, so I’m studying hard! First thing I asked myself is how to prepare for exam, what I have to know? Well, if I want to have that last letter E (expert) than I have to know all about InDesign, to have it in my little finger 😀