<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>macgrunt</title>
	<atom:link href="http://macgrunt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://macgrunt.com</link>
	<description>mac automation and other stuff</description>
	<lastBuildDate>Wed, 22 May 2013 08:59:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='macgrunt.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/a2180460d5293ea5863de75d89767ded?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>macgrunt</title>
		<link>http://macgrunt.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://macgrunt.com/osd.xml" title="macgrunt" />
	<atom:link rel='hub' href='http://macgrunt.com/?pushpress=hub'/>
		<item>
		<title>InDesign tip : #30</title>
		<link>http://macgrunt.com/2013/05/20/indesign-tip-30/</link>
		<comments>http://macgrunt.com/2013/05/20/indesign-tip-30/#comments</comments>
		<pubDate>Mon, 20 May 2013 02:00:02 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[indesign]]></category>
		<category><![CDATA[indesign tip]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[last page number]]></category>
		<category><![CDATA[page numbering]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[total pages]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3389</guid>
		<description><![CDATA[adding automatic page numbering to your InDesign document is easy. just create a text frame on your master page and then hit cmnd-opt-shift-N or choose this from your Type menu : you can style the page number the same way &#8230; <a href="http://macgrunt.com/2013/05/20/indesign-tip-30/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3389&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>adding automatic page numbering to your InDesign document is easy. just create a text frame on your master page and then hit cmnd-opt-shift-N or choose this from your <em>Type</em> menu :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum00.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum00.png?w=584&#038;h=163" alt="screen grab of insert special character flyout menu" width="584" height="163" class="alignnone size-full wp-image-3391" /></a><br />
you can style the page number the same way as you would any other text. if you type in &#8220;page &#8221; before the page number, your master page will look like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum02.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum02.png?w=584&#038;h=160" alt="screen grab of master page with basic page numbering" width="584" height="160" class="alignnone size-full wp-image-3393" /></a><br />
and your document page looks like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum03.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum03.png?w=584&#038;h=270" alt="screen grab of document page with basic page numbering" width="584" height="270" class="alignnone size-full wp-image-3394" /></a><br />
<strong><em>but you probably already knew that.</em></strong></p>
<p>you&#8217;ll notice that in the <em>insert special character</em> flyout menu there are a few other markers including one called &#8216;section marker&#8217; which we&#8217;ll talk about in a moment. but there&#8217;s no marker for &#8216;total pages&#8217; — so how do we get automatic numbering in this format? :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum05.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum05.png?w=584&#038;h=270" alt="screen grab of extended page numbering on document page" width="584" height="270" class="alignnone size-full wp-image-3396" /></a></p>
<p>well, it&#8217;s a bit of a mystery why adobe decided to put that particular functionality in a different place. but here&#8217;s where you&#8217;ll find that second special character from the <em>Type</em> menu :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum11.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum11.png?w=584&#038;h=201" alt="screen grab of text variables flyout menu" width="584" height="201" class="alignnone size-full wp-image-3408" /></a></p>
<p>ok, now, you can also add a &#8216;section marker&#8217; from the <em>insert special character</em> flyout menu. on the master page it looks like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum07.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum07.png?w=584&#038;h=160" alt="screen grab of master page showing complete numbering line" width="584" height="160" class="alignnone size-full wp-image-3398" /></a><br />
just to make things clear, that&#8217;s : {section marker}+&#8221; ~ page &#8220;+{current page number marker}+&#8221; of &#8220;+{last page number text variable}</p>
<p>then you need to specify what you want the section marker to say — under your <em>numbering and section options</em> :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum12.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum12.png?w=584" alt="screen grab of numbering and section options"   class="alignnone size-full wp-image-3424" /></a></p>
<p>which will render your document page thus :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum08.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum08.png?w=584&#038;h=270" alt="screen grab of document page showing complete numbering line" width="584" height="270" class="alignnone size-full wp-image-3399" /></a></p>
<p>so far so good.</p>
<p><span style="font-size:18px;color:grey;"><strong>unfortunately&#8230;</strong></span><br />
the last page number text variable is just a tad clunky — even in CS6. so far we&#8217;ve been looking at page two of this document :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum01.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum01.png?w=584" alt="screen grab of pages panel showing six pages in two sections"   class="alignnone size-full wp-image-3392" /></a><br />
six pages with a two-page section followed by a four-page section. and the text variable has been used with these options :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum09.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum09.png?w=584" alt="screen grab of last page number text variable options"   class="alignnone size-full wp-image-3400" /></a><br />
notice that the <em>scope</em> is set to &#8216;section&#8217;. so we get &#8217;2 of 2&#8242; because there are only two pages in the section.</p>
<p><strong>but</strong>, if we change the scope to &#8216;document&#8217; we don&#8217;t get &#8217;2 of 6&#8242; :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/pagenum10.png"><img src="http://macgrunt.files.wordpress.com/2013/05/pagenum10.png?w=584&#038;h=270" alt="screen grab of page numbering showing &#039;2 of 4&#039;" width="584" height="270" class="alignnone size-full wp-image-3401" /></a></p>
<p><strong>why?</strong> because the text variable is for &#8216;last page number&#8217; (4) not &#8216;total page count&#8217; (6). your challenge is to come up with even one scenario where you&#8217;d want to number your pages in that fashion.</p>
<p>you&#8217;d have to agree that that&#8217;s pretty crap. at the very least, InDesign should offer the option to use <em>absolute page numbering</em> for that text variable — maybe one day.</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3389&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/05/20/indesign-tip-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum00.png" medium="image">
			<media:title type="html">screen grab of insert special character flyout menu</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum02.png" medium="image">
			<media:title type="html">screen grab of master page with basic page numbering</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum03.png" medium="image">
			<media:title type="html">screen grab of document page with basic page numbering</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum05.png" medium="image">
			<media:title type="html">screen grab of extended page numbering on document page</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum11.png" medium="image">
			<media:title type="html">screen grab of text variables flyout menu</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum07.png" medium="image">
			<media:title type="html">screen grab of master page showing complete numbering line</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum12.png" medium="image">
			<media:title type="html">screen grab of numbering and section options</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum08.png" medium="image">
			<media:title type="html">screen grab of document page showing complete numbering line</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum01.png" medium="image">
			<media:title type="html">screen grab of pages panel showing six pages in two sections</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum09.png" medium="image">
			<media:title type="html">screen grab of last page number text variable options</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/pagenum10.png" medium="image">
			<media:title type="html">screen grab of page numbering showing &#039;2 of 4&#039;</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign scripting : lesson 29</title>
		<link>http://macgrunt.com/2013/04/24/indesign-scripting-lesson-29/</link>
		<comments>http://macgrunt.com/2013/04/24/indesign-scripting-lesson-29/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 12:03:48 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[scripting lesson]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[preferences]]></category>
		<category><![CDATA[startup script]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[workspace]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3365</guid>
		<description><![CDATA[the original version of this script was created, like so many scripts, in response to a problem. a necessary third-party export plugin was changing InDesign&#8217;s colour settings to a default custom set whenever it was used. obviously, this is not &#8230; <a href="http://macgrunt.com/2013/04/24/indesign-scripting-lesson-29/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3365&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>the original version of this script was created, like so many scripts, in response to a problem. a necessary third-party export plugin was changing InDesign&#8217;s colour settings to a default custom set whenever it was used. </p>
<p>obviously, this is not an ideal situation for a colour-managed workflow and required each user to manually change the settings back every time the plug-in was run. needless to say, sometimes a user forgot to do this.</p>
<p>ordinarily, a script is not going to be of much use in this situation, because the user still needs to remember to run it. but this one takes advantage of yet another handy scripting feature supported by InDesign — <em>the startup script</em>. as you can probably guess, a startup script runs automatically whenever InDesign starts up — not an absolutely perfect solution to this problem, but at least a useful safeguard.</p>
<p>the structure of the script itself is quite simple :</p>
<pre style="background-color:#1b1334;">tell application id "com.adobe.InDesign"
  
  set CMS settings of color settings to "macgrunt colour settings"
  
end tell</pre>
<p>well, having gone that far, why not also reset a couple of other things, that might be periodically changed during the day, back to your preferred defaults at the start of the next day? this version of the script also resets some display preferences and the workspace :</p>
<pre style="background-color:#1b1334;">tell application id "com.adobe.InDesign"
  
  set CMS settings of color settings to "macgrunt colour settings"
  set properties of display settings to {raster:proxy, vector:high resolution, transparency:medium quality}
  
  -----------------------------
  -- thanks to milligramme — adobe forums
  -- http://forums.adobe.com/message/3822734
  do script "app.applyWorkspace('macgrunt');" language javascript
  -----------------------------
  
end tell</pre>
<p>that last command is an interesting one. if you look at the scripting dictionary for InDesign, you&#8217;ll see there&#8217;s an <strong><em>apply workspace</em></strong> command specified for applescript. problem is, <em>it doesn&#8217;t work</em>. but, as shown above, it&#8217;s possible to call the equivalent javascript using the <em>do script</em> command.</p>
<p>the finished compiled script looks like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/04/resetsettings1.png"><img src="http://macgrunt.files.wordpress.com/2013/04/resetsettings1.png?w=584" alt="screen grab of reset settings script"   class="alignnone size-full wp-image-3368" /></a></p>
<p>of course, you would need to substitute your own colour settings and workspace names.</p>
<p>well, that&#8217;s all very interesting, but how do you make this thing run every time InDesign starts up? rather than the <em>scripts panel</em> folder — just save it using the <em>script</em> file format into this folder :<br />
<strong><em>Applications  &gt;  Adobe InDesign CS6  &gt;  Scripts  &gt;  startup scripts</em></strong></p>
<p>what other things could you use a startup script for to help make your day a little easier?</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3365&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/04/24/indesign-scripting-lesson-29/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/04/resetsettings1.png" medium="image">
			<media:title type="html">screen grab of reset settings script</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign tip : #29</title>
		<link>http://macgrunt.com/2013/04/01/indesign-tip-29/</link>
		<comments>http://macgrunt.com/2013/04/01/indesign-tip-29/#comments</comments>
		<pubDate>Mon, 01 Apr 2013 07:30:34 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[indesign]]></category>
		<category><![CDATA[indesign tip]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[design menu]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[layers]]></category>
		<category><![CDATA[prerelease program]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3329</guid>
		<description><![CDATA[adobe&#8217;s prerelease program is a brilliant way to contribute to the development of future software releases. this is what adobe has to say about the program : &#8220;The goal of a Prerelease Program at Adobe is to solicit early feedback &#8230; <a href="http://macgrunt.com/2013/04/01/indesign-tip-29/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3329&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>adobe&#8217;s prerelease program is a brilliant way to contribute to the development of future software releases. this is what adobe has to say about the program :</p>
<blockquote><p>&#8220;The goal of a Prerelease Program at Adobe is to solicit early feedback on new features and bugs in order to produce a unique and a bug free product that can deliver maximum results.&#8221;</p></blockquote>
<p>it&#8217;s not something you can just sign up for — you have to apply, giving your areas of expertise, years of experience, etc. and if adobe think you may have something to contribute you&#8217;re in. you can apply to be part of <a href="https://www.adobe.com/cfusion/mmform/index.cfm?name=prerelease_interest" title="adobe prerelease program" target="_blank">adobe&#8217;s prerelease program here</a></p>
<p>if you get accepted into the program you get a sneak-preview of some of the cool stuff currently in development — some of it is just tweaks to existing tools — some of it doesn&#8217;t make the cut because it just doesn&#8217;t work, or whatever — but some of it is truly awesome — like this new menu that&#8217;s in the very early stages of development :<br />
<a href="http://macgrunt.files.wordpress.com/2013/05/design_menu.png"><img src="http://macgrunt.files.wordpress.com/2013/05/design_menu.png?w=584&#038;h=217" alt="screen grab of beta design menu" width="584" height="217" class="alignnone size-full wp-image-3427" /></a><br />
<em>(apologies, the conditions of the prerelease program forbid showing screen grabs of the actual functionality)<br />
</em></p>
<p>the top few menu items are pretty clunky at this early stage and will probably only be useful to talentless desktop publishers in the first few incarnations of this menu. but the basic concept is sound and there&#8217;s already quite a bit of evidence from the beta-testing that one day these will be really powerful features of InDesign.</p>
<p>the last two menu items are the ones with immediate application for designers. as you can probably guess, these allow for quickly testing different colour sets and font sets throughout a document. these rely on the user correctly assigning swatches and type styles onto which the test colours and fonts can be temporarily mapped. if you&#8217;re happy with the results, just confirm your choice and all your swatches and/or type styles are updated accordingly. a cool thing about this functionality is the capability to switch between up to three different colour sets and font sets — giving you all the experimental scope you need.</p>
<p>adobe keep things pretty tight, so it&#8217;s hard to know if this menu will make the cut for CS7. there is a positive vibe on the review forums, but there&#8217;s also a lot of concern about some of the more obvious bugginess — so it might be a bit longer before we see this menu released for real.</p>
<p>if you&#8217;re excited by this kind of future functionality, then you&#8217;re exactly the kind of person that adobe needs to help with testing and reviewing. so apply for the prerelease program and have your say.</p>
<p>keep grunting</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3329&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/04/01/indesign-tip-29/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/05/design_menu.png" medium="image">
			<media:title type="html">screen grab of beta design menu</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign scripting : lesson 28</title>
		<link>http://macgrunt.com/2013/03/22/indesign-scripting-lesson-28/</link>
		<comments>http://macgrunt.com/2013/03/22/indesign-scripting-lesson-28/#comments</comments>
		<pubDate>Fri, 22 Mar 2013 02:00:27 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[scripting lesson]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[interactive pdf]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3274</guid>
		<description><![CDATA[we&#8217;ve already looked a fair bit at how to export pdfs from InDesign using applescript. see lessons 08, 09, 10, 11, and 12 plus InDesign scripting : bringing it together. but these scripts have relied on pdf export presets and, &#8230; <a href="http://macgrunt.com/2013/03/22/indesign-scripting-lesson-28/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3274&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>we&#8217;ve already looked a fair bit at how to export pdfs from InDesign using applescript. see lessons <a href="/2011/10/29/indesign-scripting-lesson-08/" title="InDesign scripting : lesson 08" target="_blank">08</a>, <a href="/2011/11/06/indesign-scripting-lesson-09/" title="InDesign scripting : lesson 09" target="_blank">09</a>, <a href="/2011/11/10/indesign-scripting-lesson-10/" title="InDesign scripting : lesson 10" target="_blank">10</a>, <a href="/2011/11/26/indesign-scripting-lesson-11/" title="InDesign scripting : lesson 11" target="_blank">11</a>, and <a href="/2011/11/30/indesign-scripting-lesson-12/" title="InDesign scripting : lesson 12" target="_blank">12</a> plus <a href="/2012/09/05/indesign-scripting-bringing-it-together/" title="InDesign scripting : bringing it together" target="_blank">InDesign scripting : bringing it together</a>. but these scripts have relied on pdf export presets and, as it turns out, there&#8217;s a really good reason NOT to use an export preset when creating a pdf.</p>
<p>presets invariably export a &#8216;print&#8217; pdf, but these often have tiny white lines criscrossing the screen. this is an unfortunate side effect of transparency flattening and is quite off-putting to clients, who incessantly ask &#8220;is it going to print like that?&#8221;. <strong>but if you export an &#8216;interactive&#8217; pdf, you don&#8217;t get the dreaded white criscrossy lines </strong>(strange but true — who knows why?).</p>
<p>now, at this stage, you can&#8217;t save interactive pdf settings as export presets. but that don&#8217;t matter none — cause we got applescript.</p>
<p>this script is a stripped back version of a much larger one — with additional export options and email generation. this post will focus mainly on the syntax for exporting interactive pdfs — so refer back to the posts listed above if any of the other bits are confusing.</p>
<p>the first part of the script generates a dialog like this :</p>
<pre style="background-color:#1b1334;">  set mgDialog to make dialog with properties {name:"How you want this exported then?"}
  tell mgDialog
    tell (make dialog column)
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"PDF export setting : ", min width:140}
        end tell
        tell (make dialog column)
          set mgResolutionButtons to make radiobutton group
          tell mgResolutionButtons
            make radiobutton control with properties {static label:"72ppi layout", checked state:true}
            make radiobutton control with properties {static label:"96ppi layout", min width:180}
            make radiobutton control with properties {static label:"144ppi layout"}
          end tell
        end tell
      end tell
      tell (make border panel)
        tell (make dialog column)
          make static text with properties {static label:"Document option : ", min width:140}
        end tell
        tell (make dialog column)
          set mgDocumentsButtons to make radiobutton group
          tell mgDocumentsButtons
            make radiobutton control with properties {static label:"active document only", checked state:true}
            make radiobutton control with properties {static label:"all open documents", min width:180}
          end tell
        end tell
      end tell
      
      set mgResult to show mgDialog
      if mgResult is true then
        set mgResolution to selected button of mgResolutionButtons
        set mgDocuments to selected button of mgDocumentsButtons
        destroy mgDialog
      else
        error number -128
      end if
    end tell
  end tell</pre>
<p>that gives you a dialog that looks something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/03/exportpdf3_01.png"><img src="http://macgrunt.files.wordpress.com/2013/03/exportpdf3_01.png?w=584" alt="screen grab of script dialog"   class="alignnone size-full wp-image-3311" /></a></p>
<p>and captures the results into two variables : <strong>mgResolution</strong> and <strong>mgDocuments</strong></p>
<p>it&#8217;s important to remember that a radiobutton group returns an integer – starting at 0 – not the label assigned to the selected button. for example, if you select the second option in the top radio button group you will get &#8217;1&#8242; as the result (not &#8220;96ppi layout&#8221;)</p>
<p>so, the next thing we need to do is assign variables depending on the choices made in the dialog :</p>
<pre style="background-color:#1b1334;">  if mgDocuments is 0 then
    set mgDocList to name of active document as list
  else if mgDocuments is 1 then
    set mgDocList to name of every document
  end if
  if mgResolution is 0 then
    set mgResolution to seventy two ppi
  else if mgResolution is 1 then
    set mgResolution to ninety six ppi
  else if mgResolution is 2 then
    set mgResolution to one hundred forty four ppi
  end if
  
  my mgExportInteractive(mgResolution, mgDocList)</pre>
<p>you&#8217;ll notice here that when re-specifying the variable <em>mgResolution</em> we don&#8217;t use quotation marks (it&#8217;s <em>seventy two ppi</em> not <em>&#8220;seventy two ppi&#8221;</em>). this is because the three options shown above are <strong>constants</strong> defined by the developers. if you want a different resolution you can use an integer between 72 and 300 (eg. set mgResolution to 200).</p>
<p>that last line passes the two final variables (<strong>mgResolution</strong> and <strong>mgDocList</strong>) to the subroutine that does the actual work (<strong>mgExportInteractive</strong>). </p>
<p>now, it&#8217;s not really necessary to use subroutines, but they are a great way to make scripts modular. it makes it easy to cut and paste whole chunks of reusable functionality into a future script (and you WILL do this as you get more and more into scripting).</p>
<p>there are two subroutines in this script, the second one is called from within the first one :</p>
<pre style="background-color:#1b1334;">on mgExportInteractive(mgResolution, mgDocList)
  tell application id "com.adobe.InDesign"
    set properties of interactive PDF export preferences to {interactive PDF interactive elements option:include all media, generate thumbnails:true, pdf magnification:fit page, pdf page layout:single page, flip pages:false, PDF JPEG quality:maximum, open in full screen:false, page transition override:from document, PDF raster compression:JPEG compression, include structure:false, page range:all pages, export layers:false, export reader spreads:false, view PDF:false}
    set raster resolution of interactive PDF export preferences to mgResolution
    repeat with i from 1 to (count of mgDocList)
      set active document to (every document whose name is item i of mgDocList)
      my mgProcess()
      tell active document
        export format interactive PDF to mgFilePath without showing options
      end tell
    end repeat
  end tell
end mgExportInteractive

on mgProcess()
  tell application id "com.adobe.InDesign"
    set mgFolder to file path of active document
    set mgDocName to name of active document
    set text item delimiters of AppleScript to {"."}
    set mgDocName to text item 1 of mgDocName
    set text item delimiters of AppleScript to ""
    set mgFilePath to mgFolder &amp; mgDocName &amp; ".pdf" as string
  end tell
end mgProcess</pre>
<p>now, if you scroll all the way out to the right, you&#8217;ll see an interesting thing. oh, all right, you don&#8217;t have to scroll all the way out — I&#8217;ll tell you — there&#8217;s a piece of code there that says <em>&#8220;&#8230; export reader spreads:false &#8230;&#8221;</em>. why is this interesting? because, in CS5 (the version this script was written for), exporting reader spreads in an interactive pdf is the default and there&#8217;s no option to change it in the standard export dialog box (this has been rectified by CS6). but you CAN change it through applescript — a rare case of something you can do with applescript which <em>cannot</em> be done with the native program. running a script containing that piece of code will change all future exports as well — so you may want to add another line to your final script to reset it back to the default &#8220;true&#8221; — it&#8217;s up to you.</p>
<p>so, that&#8217;s the basic syntax for exporting &#8216;interactive&#8217; pdfs rather than &#8216;print&#8217; pdfs. check the dictionary for all the other settings you can adjust through applescript.</p>
<p>to download the complete functioning script, you can <a href="/downloads/" title="downloads" target="_blank">go here</a>.</p>
<p>have a good one </p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3274&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/03/22/indesign-scripting-lesson-28/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/03/exportpdf3_01.png" medium="image">
			<media:title type="html">screen grab of script dialog</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>image processing with applescript III</title>
		<link>http://macgrunt.com/2013/02/08/image-processing-with-applescript-iii/</link>
		<comments>http://macgrunt.com/2013/02/08/image-processing-with-applescript-iii/#comments</comments>
		<pubDate>Thu, 07 Feb 2013 20:00:06 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[resizing]]></category>
		<category><![CDATA[scaling]]></category>
		<category><![CDATA[sips]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3244</guid>
		<description><![CDATA[a little while ago we had a look at how to use applescript and sips to scale image files without the hassle of going through photoshop – see image processing with applescript II. open the terminal application, type in &#8220;man &#8230; <a href="http://macgrunt.com/2013/02/08/image-processing-with-applescript-iii/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3244&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>a little while ago we had a look at how to use applescript and <em>sips</em> to scale image files without the hassle of going through photoshop – see <a href="/2011/11/22/image-processing-with-applescript-ii/" target="_blank">image processing with applescript II</a>. open the terminal application, type in &#8220;man sips&#8221; and you&#8217;ll find there&#8217;s a whole bunch stuff you can do with images without ever opening photoshop — pretty cool :<br />
<a href="http://macgrunt.files.wordpress.com/2013/02/sips01.png"><img src="http://macgrunt.files.wordpress.com/2013/02/sips01.png?w=584" alt="screen grab of the sips manual in terminal"   class="alignnone size-full wp-image-3248" /></a></p>
<p>&#8230; but you can play around with all that another time. today we&#8217;re focussing on extending the functionality of the image resize script from that post to make it a little more user friendly. rather than a have script that&#8217;s hard-wired to scale images to 500px high, we&#8217;ll create one that can accept user input, so that the pixel dimensions can be changed each time the script is run.</p>
<p>to do that we need to first create a <em>dialog</em>. unfortunately the dialog possibilities with standard applescript are pretty crap — particularly when compared to all the options available to applescript dialogs in InDesign – border panels, columns, rows, checkbox controls, dropdowns, enabling groups, event listeners, comboboxes, editboxes, radiobuttons, etc. </p>
<p>here is all you get with standard dialogs :<br />
<a href="http://macgrunt.files.wordpress.com/2013/02/dialog_01.png"><img src="http://macgrunt.files.wordpress.com/2013/02/dialog_01.png?w=584&#038;h=465" alt="screen grab of dialog entry in standard additions dictionary" width="584" height="465" class="alignnone size-full wp-image-3252" /></a></p>
<p>well, although that&#8217;s pretty diabolical, it&#8217;s still enough for what we need. here&#8217;s the first part of the script :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">display dialog "enter the pixel ratio you want these scaled to" with title "resize images" default answer "800" buttons {"cancel", "wide", "high"} default button 1
set mgResult to result
set mgText to text returned of mgResult
set mgButton to button returned of mgResult</pre>
<p>that&#8217;ll give us a dialog something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/02/resize_01.png"><img src="http://macgrunt.files.wordpress.com/2013/02/resize_01.png?w=584" alt="screen grab of resize images script dialog"   class="alignnone size-full wp-image-3253" /></a></p>
<p>&#8230; which gives us two pieces of information — the text entered and the button clicked – both captured into variables. if you want to make the script fool-proof, you&#8217;ll need to add some error handling to ensure that the text entered is an integer. but in its current form, the script assumes that the user is not an idiot.</p>
<p>the next part of the script creates a subfolder in the finder to save the transformed images into (this script creates duplicates of the original images rather than overwriting the originals with the resized versions) – then creates a reference to that folder for use later in the script :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgFolder to (mgText &amp; "px") as string

tell application "Finder"
  set mgItems to selection
  set mgContainer to container of item 1 of mgItems
  set mgContainer to mgContainer as alias
  if (exists folder mgFolder of folder mgContainer) is false then
    make folder at mgContainer with properties {name:mgFolder}
  end if
end tell

set mgFinalFolder to mgContainer &amp; mgFolder &amp; ":" as string</pre>
<p>then comes the key to the adaptability of this script — altering the final <em>sips</em> command based on the user&#8217;s choices in the dialog. we capture this into a variable called <em>mgScriptString</em> :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">if mgButton is "high" then
  set mgScriptString to "sips --resampleHeight '" &amp; mgText &amp; "' "
else
  if mgButton is "wide" then
    set mgScriptString to "sips --resampleWidth '" &amp; mgText &amp; "' "
  end if
end if</pre>
<p>the rest of the script is pretty much as per the previous post except that we insert the mgScriptString variable into the <em>do shell script</em> command :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">repeat with mgItem in mgItems
  set mgName to name of mgItem
  set mgFinalpath to mgFinalFolder &amp; mgName
  set mgPath to POSIX path of (mgItem as text)
  
  --convert mgFinalpath to POSIX form
  set text item delimiters to ":"
  set mgFinalpath to text items 2 thru -1 of mgFinalpath
  set text item delimiters to "/"
  set mgFinalpath to mgFinalpath as string
  set text item delimiters to ""
  
  set mgFinalpath to quoted form of mgFinalpath
  
  try
    do shell script mgScriptString &amp; quoted form of POSIX path of mgPath &amp; " --out " &amp; mgFinalpath
    do shell script "sips -m '/System/Library/ColorSync/Profiles/sRGB Profile.icc' -i " &amp; mgFinalpath
  end try
end repeat</pre>
<p>wrap all that in an open handler (and delete the line &#8220;set mgItems to selection&#8221;) and you&#8217;ll have a script that looks like this :<br />
<a href="http://macgrunt.files.wordpress.com/2013/02/resize_02.png"><img src="http://macgrunt.files.wordpress.com/2013/02/resize_02.png?w=584&#038;h=655" alt="screen grab of finished script" width="584" height="655" class="alignnone size-full wp-image-3254" /></a></p>
<p>save that as an application and whack it in your sidebar. drag and drop as many images as you like onto the app — they&#8217;ll all be scaled quicker than you could do it through photoshop. don&#8217;t worry about accidentally dropping non-image files — these just get skipped.</p>
<p>you can also go here to get the complete <strong><a href="/downloads/" title="downloads" target="_blank">image processing script</a></strong>.</p>
<p>have a good one</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3244&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/02/08/image-processing-with-applescript-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/02/sips01.png" medium="image">
			<media:title type="html">screen grab of the sips manual in terminal</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/02/dialog_01.png" medium="image">
			<media:title type="html">screen grab of dialog entry in standard additions dictionary</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/02/resize_01.png" medium="image">
			<media:title type="html">screen grab of resize images script dialog</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/02/resize_02.png" medium="image">
			<media:title type="html">screen grab of finished script</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>aussie, aussie, aussie</title>
		<link>http://macgrunt.com/2013/01/26/aussie-aussie-aussie/</link>
		<comments>http://macgrunt.com/2013/01/26/aussie-aussie-aussie/#comments</comments>
		<pubDate>Fri, 25 Jan 2013 15:00:24 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[frivolousness]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[aussie]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[say command]]></category>
		<category><![CDATA[speech]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3213</guid>
		<description><![CDATA[someone once said — something along the lines of — &#8220;if you ever want to invade australia, do it in january, because there&#8217;s no-one doing a goddamn thing.&#8221; — which goes some way to explaining why there have been no &#8230; <a href="http://macgrunt.com/2013/01/26/aussie-aussie-aussie/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3213&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>someone once said — something along the lines of — <em>&#8220;if you ever want to invade australia, do it in january, because there&#8217;s no-one doing a goddamn thing.&#8221;</em> — which goes some way to explaining why there have been no posts this month.</p>
<p>so we&#8217;re going to finish this slack month with a slack post — but one which demonstrates a handy little applescript trick — the <strong>say</strong> command. and we&#8217;re going to make it a bit aussie-themed on this important anniversary because, well, why the hell not?</p>
<p><a href="http://macgrunt.files.wordpress.com/2013/01/austdaylogo.jpg"><img src="http://macgrunt.files.wordpress.com/2013/01/austdaylogo.jpg?w=584&#038;h=280" alt="Australia Day Logo" width="584" height="280" class="alignnone size-full wp-image-3217" /></a></p>
<p>to date, the scripts on this site give feedback to users through dialogs — little windows that pop up with appropriate messages. but there&#8217;s no reason why you can&#8217;t use apple&#8217;s text-to-speech technology to give verbal feedback to users when tasks are complete, or whatever.</p>
<p>&#8230; and it really is as simple as this :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">say "something"</pre>
<p>that will give you <em>something</em> in whatever the default voice is set to. there are a bunch of different voices to choose from in the <strong>speech</strong> panel of your system preferences :<br />
<a href="http://macgrunt.files.wordpress.com/2013/01/saycommand01.png"><img src="http://macgrunt.files.wordpress.com/2013/01/saycommand01.png?w=584&#038;h=428" alt="screen grab of speech preferences" width="584" height="428" class="alignnone size-full wp-image-3223" /></a></p>
<p>specifying a particular voice for your feedback is also simple :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">say "aussie, aussie, aussie" using "Alex"
say "oy, oy, oy" using "Alex"</pre>
<p>or you might prefer to use a random voice :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgVoices to {"Kathy", "Vicki", "Victoria", "Alex", "Bruce", "Fred"}
set mgTheVoice to some item of mgVoices
say "aussie, aussie, aussie" using mgTheVoice
say "oy, oy, oy" using mgTheVoice</pre>
<p>and now you can also download additional voices to play around with — just click on the <em>customise</em> option in the system voice dropdown :<br />
<a href="http://macgrunt.files.wordpress.com/2013/01/saycommand02.png"><img src="http://macgrunt.files.wordpress.com/2013/01/saycommand02.png?w=584&#038;h=427" alt="screen grab of voice download options" width="584" height="427" class="alignnone size-full wp-image-3227" /></a></p>
<p>you can find samples of some of the voices over at <a href="http://www.nextup.com/nuance.html" title="NextUp.com" target="_blank">NextUp</a></p>
<p><span style="font-size:18px;color:grey;"><strong>but &#8230;</strong></span><br />
you have to be a little careful with your voice choice. here&#8217;s a little homage to <a href="http://www.youtube.com/watch?v=_f_p0CgPeyA" title="Monty Python — Bruce" target="_blank">monty python</a> :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">say "strailya, strailya, strailya, we love you" using "Bruce"</pre>
<p>now bruce doesn&#8217;t do a bad job (alex is better) but how would it sound with an australian voice? well the results are disappointing — karen (who pronounces her name more like &#8216;corinne&#8217;) doesn&#8217;t know how to speak australian. i reckon she&#8217;s a ring-in. when asked to say &#8216;strailya&#8217; — a very basic aussie term — she instead says &#8216;stray liar&#8217; — very odd behaviour for an aussie sheila.</p>
<p>the closest you&#8217;ll get with poor old kazza is this :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">say "strail yuh, strail yuh, strail yuh, we love you" using "Karen"</pre>
<p>&#8230; and the same goes for that un-australian &#8220;Lee&#8221; too — flamin&#8217; wowser.</p>
<p>there are a few other things you can play around with when using the say command (rate, pitch modulation, volume, etc). check out the standard additions dictionary. unfortunately, not all properties work with all voices (eg. pitch and modulation do not affect the australian voices) :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">say "chuckus a tinny would you darlin?" using "Lee" speaking rate 200
delay 0.2
say "no worries love" using "Karen" speaking rate 130</pre>
<p>have a bonza aussie day — and keep grunting</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3213&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2013/01/26/aussie-aussie-aussie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/01/austdaylogo.jpg" medium="image">
			<media:title type="html">Australia Day Logo</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/01/saycommand01.png" medium="image">
			<media:title type="html">screen grab of speech preferences</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2013/01/saycommand02.png" medium="image">
			<media:title type="html">screen grab of voice download options</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>password generator</title>
		<link>http://macgrunt.com/2012/12/23/password-generator/</link>
		<comments>http://macgrunt.com/2012/12/23/password-generator/#comments</comments>
		<pubDate>Sun, 23 Dec 2012 02:00:39 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[random password]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3131</guid>
		<description><![CDATA[applescript can be immensely frustrating at times — trying to get the syntax and structure to work just right is often a torturous process for us novices. but sometimes an applescript solution turns out to be astonishingly easy &#8230; this &#8230; <a href="http://macgrunt.com/2012/12/23/password-generator/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3131&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>applescript can be immensely frustrating at times — trying to get the syntax and structure to work just right is often a torturous process for us novices. but sometimes an applescript solution turns out to be astonishingly easy &#8230;</p>
<p><em>this script is the result of simple paranoia : there are a lot of online services offering to generate randomised passwords for you. now, it seems rational to expect at least some of these services may be malignant — they generate a password for you, then follow your digital trail to where that password is used. again, this may simply be paranoia and have absolutely no bearing at all on reality — or maybe not.</em></p>
<p><strong>this is a simple script to generate passwords, on your own machine, of whatever length you like</strong><sup> *</sup></p>
<p><span style="font-size:12px;">* yes, whatever length you like, but you may find the script bogs down a bit when generating passwords of more than 50,000 characters — apologies.</span></p>
<p>a good password is a random collection of upper case letters, lower case letters and digits (even better passwords also include punctuation, but many, many sites do not allow punctuated passwords) — so the first thing we do is create a bunch of lists (see below for an explanation of why we don&#8217;t use just one list) :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgList1 to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
set mgList2 to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
set mgList3 to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
set mgList4 to {mgList1, mgList2, mgList3}</pre>
<p>that last list is a list of lists — things will become clearer in a moment.</p>
<p>next we ask the user to specify the length of the password. this uses the handy <em>display dialog</em> command which is standard issue with applescript :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgAnswer to display dialog "How long should this password be?" with title "password generator" default answer "8"
set x to text returned of mgAnswer</pre>
<p>&#8230; and will generate a dialog something like this :<br />
<a href="http://macgrunt.com/2012/12/23/password-generator/pg1/" rel="attachment wp-att-3138"><img src="http://macgrunt.files.wordpress.com/2012/12/pg1.png?w=584" alt="screen grab of password generator dialog"   class="alignnone size-full wp-image-3138" /></a><br />
usually the result of a dialog is only <em>button returned</em> — but because we used the <em>default answer</em> property, we can also retrieve the <em>text returned</em>. in this case, the text returned is captured by the variable &#8216;x&#8217;.</p>
<p>the next part is the creation of the password :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgPassword to ""
repeat x times
  set mgThisList to some item of mgList4
  set mgPassword to mgPassword &amp; some item of mgThisList
end repeat</pre>
<p>first we create an empty variable (mgPassword) then run that variable through a repeat loop &#8216;x&#8217; number of times — each time adding another randomly chosen letter or digit. this is achieved through the &#8220;some item of&#8230;&#8221; trick. first we randomly choose one of the three lists, then we randomly choose one of the items from that list.</p>
<p>finally, we present the password back to the user :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">display dialog "Here you go …" with title "password generator" default answer mgPassword buttons "bonza" default button 1</pre>
<p><a href="http://macgrunt.com/2012/12/23/password-generator/pg3/" rel="attachment wp-att-3160"><img src="http://macgrunt.files.wordpress.com/2012/12/pg3.png?w=584" alt="screen grab of dialog showing generated password"   class="alignnone size-full wp-image-3160" /></a></p>
<p>wrap all that in an <em>on run</em> statement and you&#8217;ll have a neat little script that looks like this :<br />
<a href="http://macgrunt.com/2012/12/23/password-generator/pg2/" rel="attachment wp-att-3139"><img src="http://macgrunt.files.wordpress.com/2012/12/pg2.png?w=584" alt="screen grab of password generator complete script "   class="alignnone size-full wp-image-3139" /></a><br />
save that out as an application somewhere then just double-click to run.</p>
<p>or, if you&#8217;re really lazy, you can download the completed app here : <strong><a href="http://macgrunt.com/downloads/" title="downloads" target="_blank">password generator</a></strong></p>
<p><span style="font-size:18px;color:grey;"><strong>so, why not use just one list?</strong></span><br />
you could combine all those lists at the start into one like this :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgList1 to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", 
"L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", 
"Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", 
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", 
"2", "3", "4", "5", "6", "7", "8", "9", "0"}</pre>
<p>&#8230; but your passwords will be less likely to contain digits. with three lists you have a 1 in 3 chance that a digit will be chosen on each pass through the repeat loop. with only one list that chance is reduced to 1 in 6.2.</p>
<p><span style="font-size:18px;color:grey;"><strong>yeah, sure, but why not just do it like this? &#8230;</strong></span></p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">set mgList1 to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", 
"L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", 
"Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", 
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", 
"2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", 
"6", "7", "8", "9", "0"}</pre>
<p>because i didn&#8217;t bloody think of that when i first wrote the script — now shut up!<br />
&#8230; but also because, with the three list version, you have the opportunity to extend the script to ensure that, for example, you don&#8217;t get three capitals in a row (so there).</p>
<p><strong>now for your homework :</strong> how would you alter the script so that it generates five passwords at a time :<br />
<a href="http://macgrunt.com/2012/12/23/password-generator/pg4/" rel="attachment wp-att-3163"><img src="http://macgrunt.files.wordpress.com/2012/12/pg4.png?w=584" alt="screen grab of dialog with five generated passwords"   class="alignnone size-full wp-image-3163" /></a></p>
<p>hoping you all have yourselves a grunting great christmas.</p>
<p><span style="font-size:12px;">if you find this script handy, feel free to spread a little christmas cheer by hitting the donate button — thanks</p>
<p></span></div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3131&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2012/12/23/password-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/12/pg1.png" medium="image">
			<media:title type="html">screen grab of password generator dialog</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/12/pg3.png" medium="image">
			<media:title type="html">screen grab of dialog showing generated password</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/12/pg2.png" medium="image">
			<media:title type="html">screen grab of password generator complete script </media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/12/pg4.png" medium="image">
			<media:title type="html">screen grab of dialog with five generated passwords</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign scripting : lesson 27</title>
		<link>http://macgrunt.com/2012/11/29/indesign-scripting-lesson-27/</link>
		<comments>http://macgrunt.com/2012/11/29/indesign-scripting-lesson-27/#comments</comments>
		<pubDate>Thu, 29 Nov 2012 02:00:49 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[indesign]]></category>
		<category><![CDATA[scripting lesson]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[script property]]></category>
		<category><![CDATA[slug information]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3070</guid>
		<description><![CDATA[here is a variation on the slug form script from lesson 25. this version does not use a pre-existing form on the page — it creates a simple text frame holding information similar to the &#8216;page information&#8217; you can add to &#8230; <a href="http://macgrunt.com/2012/11/29/indesign-scripting-lesson-27/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3070&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>here is a variation on the slug form script from <a href="http://macgrunt.com/2012/10/02/indesign-scripting-lesson-25/" title="InDesign scripting : lesson 25" target="_blank">lesson 25</a>. this version does not use a pre-existing form on the page — it creates a simple text frame holding information similar to the &#8216;page information&#8217; you can add to your printouts, with three important improvements : it&#8217;s more readable ; it includes the page dimensions and ; it includes the user name.</p>
<p>the full version of the script prints the document and exports a pdf to an email attachment — functionality that you can find lessons for elsewhere on this site. today we&#8217;ll just focus on the core problem of creating the slug info which will look something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/11/slug2_1.png"><img src="http://macgrunt.files.wordpress.com/2012/11/slug2_1.png?w=584&#038;h=137" alt="screen grab of slug information" title="SLUG2_1" width="584" height="137" class="alignnone size-full wp-image-3072" /></a></p>
<p>the first part of the script demonstrates a handy little scripting trick — the <em>script property</em> :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">property mgUser : ""

if mgUser is "" then
  --bit to collect new user name
  tell application id "com.adobe.InDesign"
    activate
    set mgDialog to make dialog
    tell mgDialog
      tell (make dialog column)
        tell (make dialog row)
          make static text with properties {static label:"Enter the name you'd like to be known by."}
        end tell
        tell (make dialog row)
          set mgTextField to make text editbox with properties {edit contents:"Who you then?", min width:250}
        end tell
        tell (make dialog row)
          make static text with properties {static label:"(you won't be hassled with this again)"}
        end tell
      end tell
    end tell
    
    set mgResult to show mgDialog
    if mgResult is true then
      set mgUser to edit contents of mgTextField as string
      destroy mgDialog
    else
      error number -128
      destroy mgDialog
    end if
  end tell
  mgRunThisSucker()
else
  mgRunThisSucker()
end if
</pre>
<p>you&#8217;ll notice that we set the property mgUser to &#8220;&#8221; right at the start, and then go on to ask <em>if mgUser is &#8220;&#8221;&#8230;</em> — now that might seem nonsensical, but it&#8217;s not — because <strong>script properties have persistent data</strong>. the first time we run the script mgUser starts off as &#8220;&#8221; but is given a different value by the user when they enter their name in the dialog that&#8217;s generated (eg. &#8216;macgrunt&#8217;). that new value gets saved as an integral part of the script so that the next time it is run mgUser is &#8220;macgrunt&#8221;, not &#8220;&#8221;. by wrapping that whole script in an <em>if/then</em> statement, we ensure that the user only has to enter their name the first time the script is run. every subsequent run skips everything down to the second last line — mgRunThisSucker().</p>
<p>the user will be presented with a dialog something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/11/slug2_4.png"><img src="http://macgrunt.files.wordpress.com/2012/11/slug2_4.png?w=584" alt="screen grab of user dialog" title="SLUG2_4"   class="alignnone size-full wp-image-3097" /></a><br />
of course, you can change the various text elements in that dialog to read however you like.</p>
<p>the next part of the script captures a bunch of data we need :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">on mgRunThisSucker()
  with timeout of 36000 seconds
    set mgHour to do shell script "date '+%H'"
    set mgMinute to do shell script "date '+%M'"
    if mgHour is less than 12 then
      set mgAmPm to "am"
    else
      set mgAmPm to "pm"
    end if
    if mgHour is more than 12 then
      set mgHour to mgHour - 12
    end if
    set mgDate to do shell script "date '+%d/%m/%y'"
    set mgDate to mgDate &amp; "  :  " &amp; mgHour &amp; ":" &amp; mgMinute &amp; mgAmPm
    
    tell application id "com.adobe.InDesign"
      tell active document
        set mgName to name
        set mgFolder to file path
        set text item delimiters of AppleScript to "."
        set mgShortName to text item 1 of mgName
        set text item delimiters of AppleScript to ":"
        set mgClient to text item -4 of (mgFolder as string)
        set text item delimiters of AppleScript to default</pre>
<p>we&#8217;re capturing both the date and time for this version of the slug form. notice that <em>&#8230;&#8221;date &#8216;+%H&#8217;&#8221;</em> captures the hours in 24-hour time — but we want our time to appear as &#8220;2:00pm&#8221; rather than &#8220;14:00&#8243; — hence the bit of extra mucking around. if you&#8217;re happy with 24-hour time you could capture mgDate like this :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">do shell script "date '+%d/%m/%y  :  %H:%M'"</pre>
<p>note also that the way you capture mgClient depends on where the InDesign file sits in your folder hierarchy — <em>text item -2 of (mgFolder as string)</em> is the folder containing the InDesign file — <em>text item -3 of (mgFolder as string)</em> is the next folder up, etc.</p>
<p>next we create a layer and paragraph style for the slug information (if they don&#8217;t already exist) and the slug offset at the bottom of the page :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">        try
          set mgLayer to layer "SLUG"
          set locked of layer "SLUG" to false
          delete every text frame of layer "SLUG"
        on error
          set mgLayer to make layer with properties {name:"SLUG"}
        end try
        try
          set mgPara to paragraph style "SLUG"
        on error
          set mgPara to make paragraph style with properties {name:"SLUG", justification:left align, point size:7, applied font:"Minion Pro  Regular", fill color:"Black"}
        end try
        
        set mgBleed to document bleed bottom offset of document preferences
        set mgSlug to mgBleed + 5
        
        if slug bottom offset of document preferences is less than mgSlug then
          set properties of document preferences to {document slug uniform size:false}
          set properties of document preferences to {slug bottom offset:mgSlug}
        end if</pre>
<p>the first part has a couple of try blocks — the first time the script is run on a particular file it will create a new layer and para style — but on subsequent runs the layer and style will already exist and trying to create them again will cause an error. so, instead, we cover off all eventualities with the try blocks. notice that the first try block deletes all the text frames on the slug layer — new frames are created with fresh content on each run. the rest of that part of the script is dedicated to setting the slug offset to 5mm outside the bleed (unless it&#8217;s already bigger than that).</p>
<p>the next part captures the rest of the data we need and puts all the elements together into one long text string (mgContents) :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">        repeat with mgspread from 1 to count spreads
          set active spread of layout window 1 to spread mgspread
          tell active spread of layout window 1
            set mgPage to name of page 1
            set mgWidth to item 4 of bounds of page 1
            set mgWidth to mgWidth as integer
            set mgHeight to item 3 of bounds of page 1
            set mgHeight to mgHeight as integer
            set mgDimensions to ((mgHeight as string) &amp; "x" &amp; mgWidth as string) &amp; "mm"
          end tell
          
          set mgContents to mgShortName &amp; "  :  " &amp; mgClient &amp; "  :  page " &amp; mgPage &amp; "  :  " &amp; mgDimensions &amp; "  :  " &amp; mgUser &amp; "  :  " &amp; mgDate</pre>
<p>notice that we&#8217;ve opened a repeat loop here — because we want to add a separate slug to each spread (this script was created for a workflow where it is possible that a single file could have pages of varying sizes).</p>
<p>and finally the last bit — create the text frame, fill it with text, style the text, move the frame to the right layer and, when all frames are done, lock the layer so it can&#8217;t be inadvertently used for other content :</p>
<pre style="font-size:13px;color:#f6f6f6;background-color:#1b1334;">          set mgBounds1 to mgHeight + mgBleed
          set mgBounds3 to mgBounds1 + 4
          set mgFrameBounds to {mgBounds1, "0", mgBounds3, mgWidth}
          set mgSlug to make text frame in page mgPage with properties {geometric bounds:mgFrameBounds, fill color:swatch 1}
          set properties of text frame preferences of mgSlug to {inset spacing:{0, 2, 0, 2}}
          set vertical justification of text frame preferences of mgSlug to bottom align
          set contents of mgSlug to mgContents
          set applied paragraph style of parent story of mgSlug to "SLUG"
          move mgSlug to layer "SLUG"
        end repeat
        set locked of layer "SLUG" to true
      end tell
    end tell
  end timeout
end mgRunThisSucker</pre>
<p>cobble all that together and you&#8217;ll have a script that looks something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/11/slug2_3.png"><img src="http://macgrunt.files.wordpress.com/2012/11/slug2_3.png?w=584&#038;h=1454" alt="screen grab of entire script in script editor" title="SLUG2_3" width="584" height="1454" class="alignnone size-full wp-image-3081" /></a></p>
<p>save that as a script (.scpt) into your scripts panel folder. as discussed in the previous post, <a href="http://macgrunt.com/2012/11/24/indesign-scripting-lesson-26/" title="InDesign scripting : lesson 26" target="_blank">lesson 26</a>, if you save it in text format (.applescript) the property mgUser will not be saved as persistent data and will have to be entered every time the script is run — and that would be tedious.</p>
<p>if you can&#8217;t be bothered compiling this yourself, you can go here to get the <strong><a href="http://macgrunt.com/downloads/" title="downloads" target="_blank">complete slug script</a></strong></p>
<p>keep grunting</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3070&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2012/11/29/indesign-scripting-lesson-27/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/11/slug2_1.png" medium="image">
			<media:title type="html">SLUG2_1</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/11/slug2_4.png" medium="image">
			<media:title type="html">SLUG2_4</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/11/slug2_3.png" medium="image">
			<media:title type="html">SLUG2_3</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign scripting : lesson 26</title>
		<link>http://macgrunt.com/2012/11/24/indesign-scripting-lesson-26/</link>
		<comments>http://macgrunt.com/2012/11/24/indesign-scripting-lesson-26/#comments</comments>
		<pubDate>Sat, 24 Nov 2012 02:00:49 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[indesign]]></category>
		<category><![CDATA[scripting lesson]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[script property]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=3047</guid>
		<description><![CDATA[you learn something new every day — well, at least you should, if you&#8217;re paying sufficient attention. way back in lesson 04 you&#8217;ll find this statement : the first scripting lesson – lesson 01 – suggested you save your InDesign applescripts &#8230; <a href="http://macgrunt.com/2012/11/24/indesign-scripting-lesson-26/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3047&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>you learn something new every day — well, at least you should, if you&#8217;re paying sufficient attention. </p>
<p>way back in <a href="http://macgrunt.com/2011/09/07/indesign-scripting-lesson-04/" title="InDesign scripting : lesson 04" target="_blank">lesson 04</a> you&#8217;ll find this statement :</p>
<blockquote><p>the first scripting lesson – lesson 01 – suggested you save your InDesign applescripts in script file format (.scpt). but there’s a very good reason why you should ignore such nonsensical advice and save them in text file format (.applescript) instead&#8230;
</p></blockquote>
<p>well, it turns out that there&#8217;s also a very good reason to ignore THAT and go on and save your scripts in .scpt format — the marvellous <strong>script property</strong>.</p>
<p>a script property is an immensely handy little scripting trick. it allows you to save data into a variable, within the script, so that it is still available the next time the script is run, and the next time. The data is <em>persistent</em>.</p>
<p>one example of the use of a script property is in the <a href="http://macgrunt.com/2011/07/15/cleanup-finder/" title="finder cleanup" target="_blank">finder cleanup</a> app. on the first run, this script captures the way finder windows are set so that, the next time the script is run, and every time after, those same finder windows can be opened in exactly the same place and pointing to exactly the same folders. so, the data is captured, then used over and over again.</p>
<p>but, if your InDesign script is saved in text format (.applescript) the data captured in the script property <em>is not</em> persistent. it works fine while the script is running, but the data is lost once the script ends and has to be reinstated the next time the script is run. </p>
<p><strong>so, if you&#8217;re going to take advantage of a persistent script property you need to save your work in the .scpt format.<br />
</strong><br />
the next scripting lesson will show how a script property is used in a variation of the slug form script from <a href="http://macgrunt.com/2012/10/02/indesign-scripting-lesson-25/" title="InDesign scripting : lesson 25" target="_blank">lesson 25</a>.</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=3047&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2012/11/24/indesign-scripting-lesson-26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
		<item>
		<title>InDesign tip : #28</title>
		<link>http://macgrunt.com/2012/10/23/indesign-tip-28/</link>
		<comments>http://macgrunt.com/2012/10/23/indesign-tip-28/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 02:00:15 +0000</pubDate>
		<dc:creator>macgrunt</dc:creator>
				<category><![CDATA[indesign]]></category>
		<category><![CDATA[indesign tip]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[guides]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[InDesign]]></category>
		<category><![CDATA[layers]]></category>
		<category><![CDATA[rulers]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://macgrunt.com/?p=2985</guid>
		<description><![CDATA[with a little bit of effort you can turn poor typography into ok typography in your body copy. unfortunately, InDesign doesn&#8217;t really allow for great typography — but that&#8217;s something we&#8217;ll touch on in a moment. this post is about &#8230; <a href="http://macgrunt.com/2012/10/23/indesign-tip-28/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=2985&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="font-family:verdana;font-size:15px;">
<p>with a little bit of effort you can turn poor typography into ok typography in your body copy. unfortunately, InDesign doesn&#8217;t really allow for <em>great</em> typography — but that&#8217;s something we&#8217;ll touch on in a moment. this post is about automatic kerning, justification and hyphenation.</p>
<p>the first thing to check when you&#8217;re working with a particular font is what result you get with each of the <em>automatic kerning</em> options — metrics and optical. which one of those is best for a particular font depends on how good the type designers were at doing their job.</p>
<p>when you choose <em>metrics</em> you are using the mathematical settings created by the typographer. a well created font will have metrics for all the most common character pairs — specifying, for example, the amount of space that should appear between &#8216;AB&#8217;, which will (at least, should) be different from the amount of space that appears between &#8216;AV&#8217;. these metrics are generally known as <em>kerning tables</em>.</p>
<p>when you choose <em>optical</em> you are asking InDesign to override the typographer&#8217;s kerning tables and space the characters more or less visually based on the shapes of the characters.</p>
<p>here are a couple of screen grabs showing the same portion of text using the two different automatic kerning methods :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/kerning_01.jpg"><img src="http://macgrunt.files.wordpress.com/2012/10/kerning_01.jpg?w=584&#038;h=387" alt="screen grab of text set with metric automatic kerning" title="kerning_01" width="584" height="387" class="alignnone size-full wp-image-2991" /></a><a href="http://macgrunt.files.wordpress.com/2012/10/kerning_02.jpg"><img src="http://macgrunt.files.wordpress.com/2012/10/kerning_02.jpg?w=584&#038;h=387" alt="screen grab of text set with metric automatic kerning" title="kerning_02" width="584" height="387" class="alignnone size-full wp-image-2992" /></a> </p>
<p>as you can see, neither of these methods is perfect. &#8216;his&#8217; and &#8216;and&#8217; are undoubtedly better using <em>metrics</em> kerning, but &#8216;winston&#8217; and &#8216;musing&#8217; are better when using <em>optical</em> kerning — the metrics don&#8217;t come up to scratch. and this for a font called <em>Adobe Garamond Pro</em> — you would think we should expect better from the metrics.</p>
<p>and here&#8217;s why InDesign doesn&#8217;t allow for great typography and why, in at least this one aspect, Quark shits all over InDesign. with Quark you have the option to correct dodgy metrics by <em>editing the kerning tables</em>. so, with Quark we could get in there and fix that diabolical &#8216;mu&#8217; combination in the kerning table and then it would be corrected for every instance throughout the entire document. InDesign allows no such finessing — we are stuck with the shitty kern-pairs that come with the font or we take our chances with optical kerning.</p>
<p>so, when working with a new font, always check both automatic kerning methods to see which will give you the least disappointing results.</p>
<p>ok, now on to justification. the default justification settings that come with InDesign are simply insane and lead to this kind of abomination :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/justification_01.png"><img src="http://macgrunt.files.wordpress.com/2012/10/justification_01.png?w=584&#038;h=171" alt="screen grab of poorly justified type" title="justification_01" width="584" height="171" class="alignnone size-full wp-image-3003" /></a></p>
<p>this is because the default justification settings look something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/justification_02.png"><img src="http://macgrunt.files.wordpress.com/2012/10/justification_02.png?w=584&#038;h=190" alt="screen grab of poor justification settings" title="justification_02" width="584" height="190" class="alignnone size-full wp-image-3004" /></a></p>
<p>those numbers are invariably going to lead to shit results. all the adjustments to a line of text happen between the words — none between the individual characters — and those adjustments range from 133% word spacing (big gaps) down to 80% (words running together).</p>
<p>settings which make just a little more sense look something like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/justification_03.png"><img src="http://macgrunt.files.wordpress.com/2012/10/justification_03.png?w=584&#038;h=190" alt="screen grab of better justification settings" title="justification_03" width="584" height="190" class="alignnone size-full wp-image-3005" /></a></p>
<p>&#8230; and will lead to better results — not perfect, but better :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/justification_04.png"><img src="http://macgrunt.files.wordpress.com/2012/10/justification_04.png?w=584&#038;h=171" alt="screen grab of better justified type" title="justification_04" width="584" height="171" class="alignnone size-full wp-image-3006" /></a></p>
<p>right, last we have hyphenation and, again, the defaults are ludicrous :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/hyphenation01.png"><img src="http://macgrunt.files.wordpress.com/2012/10/hyphenation01.png?w=584&#038;h=262" alt="screen grab of default hyphenation settings" title="hyphenation01" width="584" height="262" class="alignnone size-full wp-image-3022" /></a><br />
just the fact that automatic hyphenation is turned on by default is silly enough — because InDesign is not that great at deciding where a hyphen should appear within a word. but the rest of those settings will, AGAIN, invariably lead to shit results — like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/hyphenation02.png"><img src="http://macgrunt.files.wordpress.com/2012/10/hyphenation02.png?w=584&#038;h=287" alt="screen grab of text using default hyphenation settings" title="hyphenation02" width="584" height="287" class="alignnone size-full wp-image-3023" /></a><br />
four hyphens in the first seven lines and the very first word on the page is the second half of a word from the previous page — just atrocious.</p>
<p>most jobs do not require automatic hyphenation — you should add your own (discretionary) hyphens, where appropriate, as you set the text. if you really must use automatic hyphenation (eg. you&#8217;re laying out vast tracts of text like a novel) then you should uncheck all those check boxes and adjust the other settings to something more like this :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/hyphenation03.png"><img src="http://macgrunt.files.wordpress.com/2012/10/hyphenation03.png?w=584&#038;h=262" alt="screen grab of better hyphenation settings" title="hyphenation03" width="584" height="262" class="alignnone size-full wp-image-3031" /></a></p>
<p>the improvement to the type is simply indisputable :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/hyphenation04.png"><img src="http://macgrunt.files.wordpress.com/2012/10/hyphenation04.png?w=584&#038;h=287" alt="screen grab of text using better hyphenation settings" title="hyphenation04" width="584" height="287" class="alignnone size-full wp-image-3032" /></a></p>
<p><span style="font-size:18px;color:grey;"><strong>but wait, there&#8217;s more &#8230;</strong></span><br />
once you come up with a bunch of settings which suit your sensibilities you can make them your very own defaults — just the same as you can change so many of InDesign&#8217;s default settings. just make sure you have no documents open then adjust the justification and hyphenation settings through the paragraph panel (under the type menu) :<br />
<a href="http://macgrunt.files.wordpress.com/2012/10/typography-prefs.png"><img src="http://macgrunt.files.wordpress.com/2012/10/typography-prefs.png?w=584" alt="screen grab of paragraph panel and dropdown menu" title="typography-prefs"   class="alignnone size-full wp-image-3033" /></a><br />
those will be your new defaults for every new document from now on.</p>
<p>keep grunting</p>
</div>
<p><img class="alignleft size-full wp-image-52" title="macgrunt" alt="macgrunt icon" src="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg?w=584"   /></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=macgrunt.com&#038;blog=24640695&#038;post=2985&#038;subd=macgrunt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://macgrunt.com/2012/10/23/indesign-tip-28/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a7008337658fe8064f32b37c35469da?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/kerning_01.jpg" medium="image">
			<media:title type="html">kerning_01</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/kerning_02.jpg" medium="image">
			<media:title type="html">kerning_02</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/justification_01.png" medium="image">
			<media:title type="html">justification_01</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/justification_02.png" medium="image">
			<media:title type="html">justification_02</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/justification_03.png" medium="image">
			<media:title type="html">justification_03</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/justification_04.png" medium="image">
			<media:title type="html">justification_04</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/hyphenation01.png" medium="image">
			<media:title type="html">hyphenation01</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/hyphenation02.png" medium="image">
			<media:title type="html">hyphenation02</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/hyphenation03.png" medium="image">
			<media:title type="html">hyphenation03</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/hyphenation04.png" medium="image">
			<media:title type="html">hyphenation04</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2012/10/typography-prefs.png" medium="image">
			<media:title type="html">typography-prefs</media:title>
		</media:content>

		<media:content url="http://macgrunt.files.wordpress.com/2011/08/macgrunt1a.jpg" medium="image">
			<media:title type="html">macgrunt</media:title>
		</media:content>
	</item>
	</channel>
</rss>
