<?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/"
	>

<channel>
	<title>Creative Scripting &#187; Scripting Tips</title>
	<atom:link href="http://creativescripting.net/blog/index.php/category/scripting-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://creativescripting.net/blog</link>
	<description>Automating Adobe's Creative Suite</description>
	<lastBuildDate>Wed, 08 Feb 2012 20:58:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Yet Another Geek Alert</title>
		<link>http://creativescripting.net/blog/2009/08/yet-another-geek-alert/</link>
		<comments>http://creativescripting.net/blog/2009/08/yet-another-geek-alert/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 23:27:11 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[CS4]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Scripting Tips]]></category>

		<guid isPermaLink="false">http://creativescripting.net/blog/?p=178</guid>
		<description><![CDATA[If you are an InDesign scripter, you may find this interesting.
When I create scripted extensions, I always break things up into files that make things manageable. A large project for me might contain 200 script files. Rather than try to stuff it all into a single script for delivery, I came up with a template [...]]]></description>
			<content:encoded><![CDATA[<p>If you are an InDesign scripter, you may find this interesting.</p>
<p>When I create scripted extensions, I always break things up into files that make things manageable. A large project for me might contain 200 script files. Rather than try to stuff it all into a single script for delivery, I came up with a template that I use for just about all my InDesign scripting projects that makes this about as easy as it can be. This concept really only applies when a script will reside in a persistent (named) scripting engine and adds menus to the InDesign menu bar and/or context menu.</p>
<p>I have made the template available in the Free Stuff page of this site, so go ahead and download it.</p>
<p>When you unzip it, it creates a folder. Inside that folder is &#8220;startup scripts&#8221; that contains one jsx, &#8220;loader.jsx&#8221;. That file loads the entire extension. It recursively looks through all the folders and loads the entire project into the named scripting engine for you.</p>
<p>There&#8217;s a &#8220;resources&#8221; folder. It contains things, like images, that are not jsx files. The loader script does not load anything in the resources folder. As another freebie, I put some ESTK extensions in this folder. There&#8217;s a PDF that describes how to install and use them. One of those extensions does a batch conversion to jsxbin. It places all of the scripts into a &#8220;bin&#8221; folder except those in the &#8220;startup scripts&#8221; and &#8220;jsx&#8221; folder. The loader script that creates the names engine can not be a jsxbin. Files in the jsx folder are those script files which should not be converted to jsxbin (basically any class definition that might be serialized and deserialized using toSource()).</p>
<p>When you convert a project to binary for delivery, the loader script contains a flag, &#8220;loadBinary&#8221;. If you set that flag to &#8220;true&#8221;, it will load the binary files. You then remove the jsx&#8217;s to hide your source code, and yer&#8217; done.</p>
<p>Just to be clear &#8211; use the tempate (it has examples of menu creation, context menu creation, and some handy libraries), complete and test the project, convert it to binary (one step), remove the jsx files (other than those in the jsx folder), set the loader&#8217;s loadBinary to &#8220;true&#8221;, and you are ready to ship projects that are arbitrarily huge.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://creativescripting.net/blog/2009/08/yet-another-geek-alert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another Handy Flex Project</title>
		<link>http://creativescripting.net/blog/2009/07/another-handy-flex-project/</link>
		<comments>http://creativescripting.net/blog/2009/07/another-handy-flex-project/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 18:05:24 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[CS4]]></category>
		<category><![CDATA[Scripting Tips]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://creativescripting.net/blog/?p=176</guid>
		<description><![CDATA[Free stuff now includes a Flex project for receiving APID events in PatchPanel]]></description>
			<content:encoded><![CDATA[<p>Another one for the geeks. </p>
<p>I&#8217;ve uploaded a Flex project that received APID (http://www.rorohiko.com) events in PatchPanel.</p>
<p>If you&#8217;re interested, take a look at the free stuff page.</p>
]]></content:encoded>
			<wfw:commentRss>http://creativescripting.net/blog/2009/07/another-handy-flex-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Added some new free stuff</title>
		<link>http://creativescripting.net/blog/2009/07/added-some-new-free-stuff/</link>
		<comments>http://creativescripting.net/blog/2009/07/added-some-new-free-stuff/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 22:57:07 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[CS4]]></category>
		<category><![CDATA[Patchpanel]]></category>
		<category><![CDATA[Scripting Tips]]></category>

		<guid isPermaLink="false">http://creativescripting.net/blog/?p=163</guid>
		<description><![CDATA[Just that you gotta be a geek to appreciate it.
I&#8217;ve added a Flex project to the free stuff page. This was in response to a posting on the Patchpanel forums (Adobe Labs). The poster wanted to react to InDesign events in ActionScript. This Flex project shows you how to do it (and yes, it&#8217;s in [...]]]></description>
			<content:encoded><![CDATA[<p>Just that you gotta be a geek to appreciate it.</p>
<p>I&#8217;ve added a Flex project to the free stuff page. This was in response to a posting on the Patchpanel forums (Adobe Labs). The poster wanted to react to InDesign events in ActionScript. This Flex project shows you how to do it (and yes, it&#8217;s in a persistent scripting engine that is launched by InDesign at startup.</p>
]]></content:encoded>
			<wfw:commentRss>http://creativescripting.net/blog/2009/07/added-some-new-free-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Way</title>
		<link>http://creativescripting.net/blog/2009/02/my-way/</link>
		<comments>http://creativescripting.net/blog/2009/02/my-way/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 19:42:00 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[Scripting Tips]]></category>

		<guid isPermaLink="false">http://creativescripting.net/blog/?p=145</guid>
		<description><![CDATA[How to make a complex InDesign scripting project easier to edit and manage. This is the way I do it, and it's been working really well for me.]]></description>
			<content:encoded><![CDATA[<p>When I start an InDesign or Bridge Scripting project, I always use an &#8220;application template&#8221; that I have created. The templates are slightly different for Bridge and InDesign because of the way the host application loads scripts. There are a zillion ways to skin a cat (non acceptable to the cat); however, over time, I have found &#8220;my way&#8221; to be the easiest to manage.</p>
<p>When I started writing the Workflow Automation Scripts for CS2, I was pretty much just stuffing whatever I needed into a single script file. While it worked, I was constantly scrolling up and down through very large files. </p>
<p>My next approach was to separate the script into smaller files, using include directives to load the files. While this works, debugger support suffers. With includes, the debugger doesn&#8217;t have a link to the file, so the debugging information is incomplete for included files.</p>
<p>Being an old Java coder (and C++, and C, and Pascal, and assembly, and machine&#8230;.), I kinda like projects organized. Most of my code is object oriented, so there are a lot of classes that are better off in their own files. </p>
<p>Then in CS3, Adobe gave us jsxbin files, which finally allowed us to protect our intellectual property by encoding the script files. That added further complexity for InDesign coders as the #target and #targetengine directives do not work inside jsxbin files.</p>
<p>I finally hit on this approach.</p>
<p>For InDesign, I create a project folder inside the InDesign scripts folder ( Adobe InDesign CS3/Scripts &#8211; or CS4). Inside that folder I create another folder called &#8220;Startup Scripts&#8221;. On start-up InDesign loads all scripts inside any folder under its Scripts folder named &#8220;Startup Scripts&#8221;.</p>
<p>In my project startup scripts folder, I place a single script called &#8220;loader.jsx&#8221;. Loader.jsx is a standard script, it requires code changes.</p>
<p>In the root project folder, I place a script called &#8220;main.jsx&#8221; which contains constants, project build information, namespace objects and the like. </p>
<p>This is the minimal project template:</p>
<p>My Project<br />
&nbsp;&nbsp;&nbsp;main.jsx<br />
&nbsp;&nbsp;&nbsp;    Startup Scripts<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loader.jsx</p>
<p>The way the loader script works is to start at the root project folder and do a hierarchical search for all jsx files (ignoring the Startup Scripts folder). It then loads each of those files using the $.evalFile() statement. That means no matter what I write and where I put them, project jsx files will all be loaded by a single standard loader script without my having to think about it. The loader script contains a flag variable, loadBinary. If set to true, it will load jsxbins, not jsx&#8217;s. </p>
<p>So as you work, you just add folders and script files as you go.</p>
<p>My Project<br />
&nbsp;&nbsp;&nbsp;main.jsx<br />
&nbsp;&nbsp;&nbsp;menus<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;menuMaker.jsx<br />
&nbsp;&nbsp;&nbsp;Startup Scripts<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loader.jsx<br />
&nbsp;&nbsp;&nbsp;util<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;util.jsx<br />
&nbsp;&nbsp;&nbsp;ui<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass1.jsx<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass2.jsx</p>
<p>Then I wrote an extension to the ESTK that batch encodes the entire project into jsxbin files for me. Select the menu, select the folder, and go. It places all of the jsxbin files in a &#8220;bin&#8221; folder as a child of the root project folder.</p>
<p>The folder structure after conversion to jsxbin:</p>
<p>My Project<br />
&nbsp;&nbsp;&nbsp;bin<br />
&nbsp;&nbsp;&nbsp;main.jsxbin<br />
&nbsp;&nbsp;&nbsp;menus<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;menuMaker.jsxbin<br />
&nbsp;&nbsp;&nbsp;util<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;util.jsxbin<br />
&nbsp;&nbsp;&nbsp;ui<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass1.jsxbin<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass2.jsxbin<br />
&nbsp;&nbsp;&nbsp;main.jsx<br />
&nbsp;&nbsp;&nbsp;menus<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;menuMaker.jsx<br />
&nbsp;&nbsp;&nbsp;Startup Scripts<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loader.jsx<br />
&nbsp;&nbsp;&nbsp;util<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;util.jsx<br />
&nbsp;&nbsp;&nbsp;ui<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass1.jsx<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uiclass2.jsx</p>
<p>One issue with jsxbin files that affects object oriented coders is that classes that are defined in jsxbin files can not be serialized and recreated using toSource()/eval(). This means that in any project, there could be files that must stay as jsx files. The jsxbin conversion extension ignores any script file contained in a folder named &#8220;jsx&#8221;, and the script loader will always load scripts in any &#8220;jsx&#8221; folder as jsx even with the loadBinary variable set to true.</p>
<p>To develop code, I get all of flexibility I want and need, full debugger information, and the ability to reload a project with one click (run the loader under the estk). To ship, all I have to do is run my batch binary converter, set the loader&#8217;s loadBinary = true, move the jsx files out of the project folder, archive the folder. When I move the jsx files back, I&#8217;m ready to start work on the next build.</p>
<p>I&#8217;ll be posting the ESTK extensions and some samples over the next couple of weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://creativescripting.net/blog/2009/02/my-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

