<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;D0AGSXk9eCp7ImA9WxBTGEw.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959</id><updated>2009-12-14T10:35:28.760-08:00</updated><title>Free AppleScript Code Step-by-Step</title><subtitle type='html'>Discussions on AppleScripting, with emphasis on tutorials for those new to scripting. Example scripts of general utility, as well as some that relate to specific applications (FileMaker Pro, AppleWorks, Script Editor, specialized scripts and others). Some discussion of HyperCard and AppleScript and the Classic (OS9) environment</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;DU8GQ38-eCp7ImA9WxBTFUk.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-4372189990610617627</id><published>2009-09-06T07:59:00.000-07:00</published><updated>2009-12-11T08:10:22.150-08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-12-11T08:10:22.150-08:00</app:edited><title>The Finder's Standard Suite</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kNf8hE1pLOE/SyJttFgqy0I/AAAAAAAAAFw/tVN8aQUnHuw/s1600-h/Apple-Computer-Rosa-Parks.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 235px;" src="http://3.bp.blogspot.com/_kNf8hE1pLOE/SyJttFgqy0I/AAAAAAAAAFw/tVN8aQUnHuw/s400/Apple-Computer-Rosa-Parks.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5414010323393497922" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In my last post, we took a look at how to use the Finder's &lt;a href="http://www.scriptsforapple.com/2009/06/applescripts-for-basic-printing/"&gt;print command&lt;/a&gt;, which is part of the Standard Suite. As promised, in this post we will now look at the remaining commands that make up the Standard Suite, namely: open,quit and activate.&lt;br /&gt;&lt;br /&gt;While the last two are pretty simple to implement, the open command requires some explanation. First, the basic open syntax:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "Finder" to open home&lt;/code&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;This is easy to understand, it simply tells the Finder to open home of your HD.&lt;br /&gt;&lt;br /&gt;If you want to open a specific document, you would use a form such as:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "Finder"&lt;br /&gt;open document file "My Document.cwk" of folder "Documents" of home&lt;br /&gt;end tell&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here,&lt;/strong&gt; &lt;em&gt;'My Document.cwk'&lt;/em&gt; &lt;strong&gt;is replaced with your document residing in your&lt;/strong&gt; &lt;em&gt;'Documents' folder&lt;/em&gt; &lt;strong&gt;(or which ever folder you desire).&lt;br /&gt;&lt;br /&gt;To get the full path of a document, open the document and hold down the command key while clicking on the window's title bar. The result is something like:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;(alias “Macintosh HD:Users:administrator:Documents:My Document.cwk”)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Each level of the path is separated by a colon. The script would look like this:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "Finder"&lt;br /&gt; open document file (alias "Macintosh HD:Users:administrator:Documents:My Document.cwk")&lt;br /&gt;end tell&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://www.blogspot.com/"&gt; &lt;img border=0 src="http://cdn.stumble-upon.com/images/120x20_su_blue.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The basic quit and activate (bring app to front) commands take no parameters:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;tell application "Finder" to quit&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "Finder" to activate&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "FileMaker Pro" to activate&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tell application "AppleWorks 6" to activate&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Remember that I cover the &lt;a href="http://www.scriptsforapple.com/2009/06/applescripts-for-basic-printing/"&gt;print command&lt;/a&gt; in my previous post.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Have any questions or comments? Contact me at: &lt;strong&gt;hyperscripter@gmail.com&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-4372189990610617627?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/4372189990610617627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=4372189990610617627&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/4372189990610617627?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/4372189990610617627?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/09/finders-standard-suite.html' title='The Finder&apos;s Standard Suite'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_kNf8hE1pLOE/SyJttFgqy0I/AAAAAAAAAFw/tVN8aQUnHuw/s72-c/Apple-Computer-Rosa-Parks.jpg' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;DUYCSHoyfCp7ImA9WxBTFUk.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-795780643232494235</id><published>2009-08-26T05:49:00.000-07:00</published><updated>2009-12-11T07:59:29.494-08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-12-11T07:59:29.494-08:00</app:edited><title>AppleScripts for Basic Printing</title><content type='html'>&lt;a href="http://www.scriptsforapple.com/wp-content/uploads/2009/03/mac-512_screen.jpg"&gt;&lt;img class="size-medium wp-image-107" src="http://www.scriptsforapple.com/wp-content/uploads/2009/03/mac-512_screen-300x225.jpg" alt="The Mac 512 K, the first in the Macintosh series of computers" width="300" height="225" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The first script below is for printing a document in "TextEdit". Before running the script, you must bring the desired document to the front:&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;p style="padding: 5px; background-color: #F7BDDE; border: dotted 1px red;"&gt;&lt;code&gt;tell application "TextEdit"&lt;br /&gt;print the front document &lt;strong&gt;with properties {copies:2, collating:true, starting page:1, ending page:1, pages across:1, pages down:1, error handling:standard}&lt;/strong&gt; without print dialog&lt;br /&gt;end tell&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Most of what appears in&lt;/strong&gt; &lt;em&gt;'with properties {....}'&lt;/em&gt; &lt;strong&gt;above should be fairly obvious. If you want to specify the printer, you could follow the last parameter in the list with a comma and&lt;/strong&gt; &lt;em&gt;'target printer:'&lt;/em&gt; &lt;strong&gt;and the actual name of the desired printer enclosed in quotes.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;If you want to use different printers in certain cases, replace&lt;/strong&gt;&lt;strong&gt; &lt;em&gt;'without print dialog'&lt;/em&gt; &lt;/strong&gt;&lt;strong&gt;with&lt;/strong&gt; &lt;em&gt;'with print dialog'&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://www.scriptsforapple.com/"&gt;&lt;img src="http://static.technorati.com/pix/fave/tech-fav-1.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;This second script, so that you aren't required to specify the application file targeted by the print command:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;p style="padding: 5px; background-color: #F7BDDE; border: dotted 1px red;"&gt;&lt;code&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;tell application "Printer Setup Utility"&lt;br /&gt;set the current printer to printer "Deskjet D2400 series"&lt;br /&gt;(alias "Macintosh HD:Users:administrator:Documents:My Document.cwk")&lt;br /&gt;end tell&lt;/strong&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;Replace&lt;/strong&gt; &lt;em&gt;'Deskjet D2400 series'&lt;/em&gt; &lt;strong&gt;with the name of your printer and replace&lt;/strong&gt;&lt;em&gt; '(alias "Macintosh HD:Users:administrator:Documents:My Document.cwk")'&lt;/em&gt; &lt;strong&gt;with the path to the document that you wish to print (Don't forget to precede the path name by 'alias' - this is important).&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;The print command is part of the 'Standard Suite' of the Finder's Dictionary, and so, in my next post, We will look at the remaining commands that make up the &lt;a href="http://www.scriptsforapple.com/2009/06/the-finders-standard-suite/"&gt;Standard Suite&lt;/a&gt; (there are 3). If you have questions on printing or would like to suggest a post on another AppleScript topic, contact me at: &lt;/strong&gt;&lt;strong&gt;&lt;a href="mailto:hyperscripter@gmail.com?body=I am having trouble finding information on "&gt;hyperscripter@gmail.com&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt; or to subscribe, click the &lt;a href="#By Email"&gt;By Email&lt;/a&gt; link at the top of the page&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-795780643232494235?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/795780643232494235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=795780643232494235&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/795780643232494235?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/795780643232494235?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/12/applescripts-for-basic-printing.html' title='AppleScripts for Basic Printing'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;AkAGQn86eip7ImA9WxNTEU8.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-1407726330227918843</id><published>2009-08-12T05:18:00.000-07:00</published><updated>2009-08-12T18:58:43.112-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-12T18:58:43.112-07:00</app:edited><title>Display Dialog with Password</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNl80vhDdI/AAAAAAAAAEI/t_2Ki1mAKTA/s1600-h/Macintosh+Plus+Ad.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 251px; height: 320px;" src="http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNl80vhDdI/AAAAAAAAAEI/t_2Ki1mAKTA/s320/Macintosh+Plus+Ad.jpg" alt="" id="BLOGGER_PHOTO_ID_5369247276380261842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;strong style="font-family: lucida grande;"&gt;This script presents a text entry dialog where the text entered by the user is encrypted as bullets so that nosy people, for instance, cannot see what is being entered on your screen.&lt;br /&gt;&lt;br /&gt;Seriously, though, the main purpose of this type of dialog is as a security measure to restrict access to critical files.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;set thePass to "pass90805"&lt;/code&gt;&lt;br /&gt;&lt;strong style="font-family: lucida grande;"&gt;--Here, depending upon the application, you could have&lt;/strong&gt;&lt;span style="font-family: lucida grande;"&gt; 'thePass' &lt;/span&gt;&lt;strong style="font-family: lucida grande;"&gt;set to the value stored in a global field, In &lt;a href="http://www.scriptsforapple.com/using-filemaker-pro/"&gt;FileMaker&lt;/a&gt; it would be something like&lt;/strong&gt;&lt;span style="font-family: lucida grande;"&gt; 'set thePass to data of cell "passwordStorage"'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;considering case&lt;br /&gt;repeat with x from 1 to 3&lt;br /&gt;display dialog ("Enter the password for access to this file:") default answer "" with icon stop with hidden answer&lt;br /&gt;if the text returned of the result is thePass then&lt;br /&gt;exit repeat&lt;br /&gt;end if&lt;br /&gt;if x is 3 then return "You have attempted to access this file too many times. Your access is denied. Please try again."&lt;br /&gt;end repeat&lt;br /&gt;end considering&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong style="font-family: lucida grande;"&gt;The considering case &lt;a href="http://www.scriptsforapple.com/applescript-definitions/"&gt;block&lt;/a&gt; tells AppleScript to require that the text entered match the particular case of the pre-determined password (upper or lower).&lt;br /&gt;&lt;br /&gt;By the way, the part that gives the bullets instead of the actual text entered is&lt;/strong&gt;&lt;span style="font-family: lucida grande;"&gt; &lt;/span&gt;&lt;em style="font-family: lucida grande;"&gt;'with hidden answer'&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong style="font-family: lucida grande;"&gt;The repeat block allows the user 3 attempts at entering the password for access and after that, terminates the script.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://scriptingissues.blogspot.com/"&gt;&lt;img src="http://static.technorati.com/pix/fave/tech-fav-1.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: lucida grande;"&gt;Contact me if you have any questions or comments at: &lt;/span&gt;&lt;strong style="font-family: lucida grande;"&gt;&lt;a href="mailto:hyperscripter@gmail.com?body=I%20am%20having%20trouble%20finding%20information%20on%20"&gt;hyperscripter@gmail.com&lt;/a&gt;&lt;/strong&gt;&lt;span style="font-family: lucida grande;"&gt; or &lt;/span&gt;&lt;strong style="font-family: lucida grande;"&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-1407726330227918843?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/1407726330227918843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=1407726330227918843&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/1407726330227918843?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/1407726330227918843?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/08/display-dialog-with-password.html' title='Display Dialog with Password'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNl80vhDdI/AAAAAAAAAEI/t_2Ki1mAKTA/s72-c/Macintosh+Plus+Ad.jpg' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;A0ANR3s9fSp7ImA9WxNaFUw.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-523718724560647531</id><published>2009-08-12T05:14:00.000-07:00</published><updated>2009-11-29T10:36:36.565-08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-29T10:36:36.565-08:00</app:edited><title>'Display Alert' Dialogs</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNj7AV8XcI/AAAAAAAAAEA/ciWiDO3gqqk/s1600-h/IMG00108.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 208px;" src="http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNj7AV8XcI/AAAAAAAAAEA/ciWiDO3gqqk/s320/IMG00108.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5369245046111231426" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;These are a type of dialog, introduced in OS 10.4 (Tiger), which are similar to &lt;a href="http://www.scriptsforapple.com/2008/01/getting-started-with-applescript-dialogs/"&gt;regular dialogs&lt;/a&gt; (in use as well as syntax), the noteable difference being that their purpose is to expand upon the standard &lt;a href="http://www.scriptsforapple.com/2008/01/getting-started-with-applescript-dialogs/"&gt;'display dialog'&lt;/a&gt;. They are used when it is important to impart further information on the state of the Finder or another application, where, for instance, some data loss could occur as a result of an incorrect action being taken.&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;try&lt;br /&gt; display dialog ("Enter a number") default answer ("") buttons {"OK"} default button "OK"&lt;br /&gt; set userEntry to text returned of result&lt;br /&gt; return userEntry as number&lt;br /&gt;on error&lt;br /&gt; set alertString to "The text entered is not a number"&lt;br /&gt; set messageString to ("" &amp; userEntry &amp; "is not a number. ") &amp; "Run the script again and use only number keys."&lt;br /&gt; display alert alertString message messageString buttons {"OK"} default button "OK" giving up after 20&lt;br /&gt;end try&lt;/code&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;This is fairly straightforward, below the resulting dialog when the user happens to enter 'abc' (a non-numerical value):&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.scriptsforapple.com/wp-content/uploads/2009/06/displayalertdlog.png"&gt;&lt;img src="http://www.scriptsforapple.com/wp-content/uploads/2009/06/displayalertdlog.png" alt="displayalertdlog" title="displayalertdlog" width="563" height="217" class="aligncenter size-full wp-image-442" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://www.scriptsforapple.com"&gt;&lt;img src="http://static.technorati.com/pix/fave/tech-fav-1.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Contact me if you have any questions or comments at: &lt;strong&gt;&lt;a href="mailto:hyperscripter@gmail.com?body=I am having trouble finding information on "&gt;hyperscripter@gmail.com&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;p style="padding: 5px; background-color: #C6EFF7; border: dotted 1px teal;"&gt;If you like this post, check out this one: &lt;a href="http://www.scriptsforapple.com/using-applescript-dialogs-to-invoke-actions/"&gt;Invoking actions with dialogs&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-523718724560647531?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/523718724560647531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=523718724560647531&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/523718724560647531?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/523718724560647531?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/08/display-alert-dialogs.html' title='&apos;Display Alert&apos; Dialogs'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kNf8hE1pLOE/SoNj7AV8XcI/AAAAAAAAAEA/ciWiDO3gqqk/s72-c/IMG00108.JPG' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;D08ARHgzcSp7ImA9WxNTEUg.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-6650163309005640545</id><published>2009-06-10T18:44:00.000-07:00</published><updated>2009-08-13T02:30:45.689-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-13T02:30:45.689-07:00</app:edited><title>Creating a New Document with Microsoft Word 2004</title><content type='html'>&lt;a href="http://www.scriptsforapple.com/wp-content/uploads/2009/06/g5guts.jpg"&gt;&lt;img style="float:left;border:5px solid #FFFFFF;margin:0 10px 10px 0;" src="http://www.scriptsforapple.com/wp-content/uploads/2009/06/g5guts.jpg" alt="g5guts" title="g5guts" class="alignleft size-full wp-image-358" height="95" width="143" /&gt;&lt;/a&gt;&lt;b&gt;For those of you who prefer to use Word for your text documents, this is a fairly straightforward script to create a new document with a default font and text and save it to your hard drive:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;tell application "Microsoft Word"&lt;br /&gt;activate&lt;br /&gt;try&lt;br /&gt;set newDoc to make new document&lt;br /&gt;set name of font object of text object of newDoc to "Arial"&lt;br /&gt;&lt;b&gt;--Here you could have a&lt;/b&gt; 'text returned of' &lt;b&gt;dialog to set the text font for the new document to a font of your choice. Of course, the font would have to exist on the target hard drive.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;set documentName to text returned of (display dialog "Enter name for new document:" default answer "Untitled Document" with icon note buttons {"Cancel","Save"} default button {"Save"})&lt;br /&gt;save as newDoc file name documentName&lt;br /&gt;&lt;b&gt;--By default, the document is created in the currently active folder.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;set initialText to text returned of (display dialog "Enter initial text for new document:" default answer "" with icon note buttons {"Cancel","Insert"} default button {"Insert"})&lt;br /&gt;if initialText&lt;&gt;"" then&lt;br /&gt;set documentRange to create range active document start 0 end 0&lt;br /&gt;insert text initialText at documentRange&lt;br /&gt;end if&lt;br /&gt;&lt;b&gt;--If initialText has no value, then a text document is opened with no initial text.&lt;/b&gt;&lt;br /&gt;on error&lt;br /&gt;if documentName = "" then&lt;br /&gt;display dialog "Document creation aborted!" with icon stop buttons {"OK"} default button {"OK"}&lt;br /&gt;else&lt;br /&gt;end if&lt;br /&gt;end try&lt;br /&gt;end tell&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The&lt;/b&gt; else &lt;b&gt;part of the conditional above instructs AppleScript to ignore the fact that no initial text was requested for the new document and creates the document anyway. The value of 0 for start and end tells Word that it is a document that does not yet have any text or if there is existing text, to place it before the existing text .&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height="285" width="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/GvskEGWMLp4&amp;amp;hl=en&amp;amp;fs=1&amp;amp;color1=0x006699&amp;amp;color2=0x54abd6&amp;amp;border=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/GvskEGWMLp4&amp;amp;hl=en&amp;amp;fs=1&amp;amp;color1=0x006699&amp;amp;color2=0x54abd6&amp;amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="285" width="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;If you have any questions or comments, contact me at: &lt;strong&gt;hyperscripter@gmail.com&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://www.scriptsforapple.com"&gt;&lt;img src="http://static.technorati.com/pix/fave/btn-fave2.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-6650163309005640545?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/6650163309005640545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=6650163309005640545&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/6650163309005640545?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/6650163309005640545?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/06/creating-new-document-with-microsoft.html' title='Creating a New Document with Microsoft Word 2004'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;A0MHQnk7fSp7ImA9WxJQGUU.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-4499313886575467881</id><published>2009-06-02T16:56:00.000-07:00</published><updated>2009-06-02T17:37:13.705-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-06-02T17:37:13.705-07:00</app:edited><title>Trapping for List Dialog Errors</title><content type='html'>&lt;b&gt;With 'List Dialog' type dialogs, since errors cannot be intercepted in an 'on error' handler, there is no 'normal' way to trap for 'Cancel' which, of course, would result in some sort of undesirable error dialog such as 'User cancelled. Error number -128'. Here is an example of one simple way I have found to trap for this type of error:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;set x to (choose from list {"Joe","Amy","Bill"} with prompt "Choose a record:")&lt;br /&gt;&lt;b&gt;&lt;i&gt;if x is false then&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;else&lt;br /&gt;set targetItem to (x as text)&lt;br /&gt;show every record whose cell "Name" contains x&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;&lt;p style="padding: 5px; background-color: #C6EF8C; border: dotted 1px #C6EF8C;"&gt;&lt;a href="http://www.scriptsforapple.com/wp-content/uploads/2009/06/imacrainbow.jpg"&gt;&lt;img src="http://www.scriptsforapple.com/wp-content/uploads/2009/06/imacrainbow.jpg" alt="imacrainbow" title="imacrainbow" width="127" height="126" class="alignleft size-full wp-image-360" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When the user clicks on &lt;i&gt;'Cancel'&lt;/i&gt;, the variable &lt;i&gt;x&lt;/i&gt; is assigned the boolean value false. So all you have to do is set up a conditional clause to deal with that (notice it does nothing at all) and to perform the usual statements otherwise.&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As always, if you have any questions or comments, contact me at: &lt;strong&gt;&lt;a href="mailto:hyperscripter@gmail.com?body=I am having trouble finding information on "&gt;hyperscripter@gmail.com&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt; or to subscribe, click the &lt;a href="#By Email"&gt;By Email&lt;/a&gt; link at the top of the page&lt;br /&gt;If you like this site, check out this one: &lt;a href="http://www.squidoo.com/applescripter"&gt;http://www.squidoo.com/applescripter&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-4499313886575467881?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/4499313886575467881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=4499313886575467881&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/4499313886575467881?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/4499313886575467881?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/06/trapping-for-list-dialog-errors.html' title='Trapping for List Dialog Errors'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;A0cDQXc9eSp7ImA9WxJQGU4.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-6780233854427914834</id><published>2009-06-02T02:50:00.000-07:00</published><updated>2009-06-02T03:37:50.961-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-06-02T03:37:50.961-07:00</app:edited><title>Finder Script to Delete Old Folders</title><content type='html'>&lt;strong&gt;This script can be used in a database program or compiled for general use in the Script Editor. It looks for folders such as 'January 2009' and determines if they are 3 or more months old and, if so, places them in the trash.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://www.scriptsforapple.com"&gt;&lt;img src="http://static.technorati.com/pix/fave/tech-fav-1.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;set AppleScript's text item delimiters to ","&lt;br /&gt;set theLongDate to (current date)&lt;br /&gt;set targetDate to (date string of theLongDate)&lt;br /&gt;set currentMonth to (word 1 of text item 2 of targetDate)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;--This determines numerical value equivalent to &lt;em&gt;'currentMonth'&lt;/em&gt; above:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;set monthList to {January, February, March, April, May, June, July, August, September, October, November, December}&lt;br /&gt;repeat with i from 1 to 12&lt;br /&gt;if currentMonth = ((item i of monthList) as string) then&lt;br /&gt;set targetMonth to (text -2 thru -1 of ("0" &amp;amp; i))&lt;br /&gt;exit repeat&lt;br /&gt;end if&lt;br /&gt;end repeat&lt;br /&gt;purgeFolders(targetMonth)&lt;br /&gt;&lt;br /&gt;on purgeFolders(startMonth)&lt;br /&gt;tell application "Finder"&lt;br /&gt;activate&lt;br /&gt;set todaysDate to (current date)&lt;br /&gt;set startMonth to (startMonth as integer)&lt;br /&gt;set {d, m, y} to {day, month, year} of todaysDate&lt;br /&gt;set monthName to (month of todaysDate) as string&lt;br /&gt;set monthList to {January, February, March, April, May, June, ¬&lt;br /&gt;July, August, September, October, November, December}&lt;br /&gt;repeat with i from 1 to 12&lt;br /&gt;if m = (item i of monthList) then&lt;br /&gt;set monthString to text -2 thru -1 of ("0" &amp;amp; i)&lt;br /&gt;exit repeat&lt;br /&gt;end if&lt;br /&gt;end repeat&lt;br /&gt;set dayString to text -2 thru -1 of ("0" &amp;amp; d)&lt;br /&gt;set yearString to text -2 thru -1 of ("0" &amp;amp; y)&lt;br /&gt;set dateNumeric to monthString &amp;amp; "/" &amp;amp; dayString &amp;amp; "/" &amp;amp; yearString&lt;br /&gt;if (startMonth &amp;gt; 3 and startMonth &amp;lt; 13) then&lt;br /&gt;set deleteMonth to (item (monthString - 3) of monthList) as string&lt;br /&gt;else if (startMonth &amp;gt; 0 and startMonth &amp;lt; 4) then&lt;br /&gt;set deleteMonth to (item (monthString + 9) of monthList) as string&lt;br /&gt;end if&lt;br /&gt;set currYear to yearString as text&lt;br /&gt;set prevYear to (yearString - 1) as text&lt;br /&gt;set prevYear to "0" &amp;amp; prevYear&lt;br /&gt;if (startMonth &amp;gt; 3 and startMonth &amp;lt; 13) then&lt;br /&gt;set deleteFolder to (deleteMonth &amp;amp; " '" &amp;amp; currYear) as string&lt;br /&gt;else&lt;br /&gt;set deleteFolder to (deleteMonth &amp;amp; " '" &amp;amp; prevYear) as string&lt;br /&gt;end if&lt;br /&gt;if (folder deleteFolder of folder "Backup Files" exists) then&lt;br /&gt;display dialog ¬&lt;br /&gt;"Old backup folders will be moved to trash." with icon caution ¬&lt;br /&gt;buttons {"OK"} default button "OK" giving up after 15&lt;br /&gt;select (folder deleteFolder of folder "Backup Files")&lt;br /&gt;delete selection&lt;br /&gt;end if&lt;br /&gt;end tell&lt;br /&gt;&lt;strong&gt;tell application "FileMaker Pro" to activate--Or whatever application you use (omit this if you are only going to use this in the Finder)&lt;/strong&gt;&lt;br /&gt;end purgeFolders&lt;br /&gt;&lt;br /&gt;As always, if you have any questions or comments, contact me at: &lt;strong&gt;&lt;a href="mailto:hyperscripter@gmail.com?body=I am having trouble finding information on "&gt;hyperscripter@gmail.com&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/strong&gt; or to subscribe, click the &lt;a href="#By Email"&gt;By Email&lt;/a&gt; link at the top of the page&lt;br /&gt;&lt;p style="padding: 5px; background-color: #C6EFF7; border: dotted 1px teal;"&gt;If you like this site, check out this one: &lt;a href="http://www.squidoo.com/applescripter"&gt;http://www.squidoo.com/applescripter&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-6780233854427914834?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/6780233854427914834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=6780233854427914834&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/6780233854427914834?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/6780233854427914834?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/06/finder-script-to-delete-old-folders.html' title='Finder Script to Delete Old Folders'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;A0QHRXk8eCp7ImA9WxJQGUU.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-895379525263672572</id><published>2009-04-06T06:33:00.000-07:00</published><updated>2009-06-02T17:35:34.770-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-06-02T17:35:34.770-07:00</app:edited><title>Applescript for Creating a New Document with AppleWorks 6</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kNf8hE1pLOE/SiTzJx0fQZI/AAAAAAAAADo/fKfAg0xLrTc/s1600-h/ApplePs-2-port.jpg"&gt;&lt;img style="float:right; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 269px;" src="http://1.bp.blogspot.com/_kNf8hE1pLOE/SiTzJx0fQZI/AAAAAAAAADo/fKfAg0xLrTc/s320/ApplePs-2-port.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5342662407286112658" /&gt;&lt;/a&gt;&lt;br /&gt;Generic, not gospel, but should work just fine...&lt;br /&gt;&lt;br /&gt;IF YOU USE APPLEWORKS 6, YOU MAY FIND THIS SCRIPT USEFUL IN CREATING NEW DOCUMENTS. IT SHOULD BE FAIRLY EASY TO SEE HOW THIS CAN BE ADAPTED TO YOUR SPECIFIC NEEDS OR ADAPTED FOR USE WITH WORD ETC :&lt;br /&gt;&lt;br /&gt;set theDocName to "Simple Text Document"&lt;br /&gt;set theData to "Basic text for new document"&lt;br /&gt;tell application "AppleWorks 6"&lt;br /&gt;activate&lt;br /&gt;make new document with data theData with properties {name:theDocName}&lt;br /&gt;tell front document&lt;br /&gt;select paragraph 1&lt;br /&gt;set the properties of the selection to {font:"Helvetica", size:24}&lt;br /&gt;--HERE, YOU COULD SUBSTITUTE FOR 'Helvetica', ANY FONT THAT YOU HAVE AVAILABLE (Arial,Monaco,Geneva etc), AND SIZE, IN THIS CASE '24', ANY SIZE THAT YOU HAVE AVAILABLE.&lt;br /&gt;end tell&lt;br /&gt;end tell&lt;br /&gt;&lt;br /&gt;YOU COULD SET 'theDocName' TO THE RESULT OF A QUERY DIALOG WHERE THE USER ENTERS A SPECIFIC NAME FOR THE NEW DOCUMENT AND 'theData' TO THE RESULT OF A DIALOG WHERE THE USER ENTERS THE INITIAL TEXT FOR THE NEW DOCUMENT. IF YOU READ MY PREVIOUS POSTS, BECAUSE I APPROACH THINGS AS A PROGRESSION, YOU WILL PROBABLY HAVE A PRETTY GOOD IDEA OF HOW TO WRITE THE DIALOG STATEMENTS THAT I HAVE SUGGESTED HERE. IF YOU HAVEN'T SEEN MY PREVIOUS POSTS, I ENCOURAGE YOU TO CHECK THEM OUT. MY OLDER POSTS ARE START AT THE BOTTOM OF THIS BLOG PAGE.&lt;br /&gt;&lt;br /&gt;Questions or comments are always welcome (positive - hopefully or negative - if that is the case). Contact me at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-895379525263672572?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/895379525263672572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=895379525263672572&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/895379525263672572?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/895379525263672572?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/04/applescript-for-creating-new-document.html' title='Applescript for Creating a New Document with AppleWorks 6'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_kNf8hE1pLOE/SiTzJx0fQZI/AAAAAAAAADo/fKfAg0xLrTc/s72-c/ApplePs-2-port.jpg' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;DEMBR308eSp7ImA9WxNTEUg.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-5619009913616716167</id><published>2009-04-06T06:20:00.000-07:00</published><updated>2009-08-13T02:40:56.371-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-13T02:40:56.371-07:00</app:edited><title>FileMaker Pro AppleScript to Backup Files</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kNf8hE1pLOE/SiUDMxvpnkI/AAAAAAAAAD4/e1waZAXHmbo/s1600-h/AppleStoreChicago.jpg"&gt;&lt;img style="float:left;display:block; margin:0 10px 10px 0; text-align:left;cursor:pointer; cursor:hand;width: 132px; height: 98px;" src="http://4.bp.blogspot.com/_kNf8hE1pLOE/SiUDMxvpnkI/AAAAAAAAAD4/e1waZAXHmbo/s320/AppleStoreChicago.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5342680050991472194" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;THIS SCRIPT WAS ADAPTED FROM ONE WRITTEN SPECIFICALLY FOR A FILEMAKER PRO PROGRAM, ALTHOUGH IT COULD EASILY BE USED IN ANY DATABASE PROGRAM YOU USE THAT SUPPORTS APPLESCRIPT:&lt;br /&gt;&lt;br /&gt;MOST OF WHAT APPEARS HERE BUILDS UPON THE INFORMATION PRESENTED IN PREVIOUS POSTS. &lt;br /&gt;&lt;br /&gt;tell application "Finder"&lt;br /&gt;try&lt;br /&gt;set todaysDate to (current date)&lt;br /&gt;  set bkpYear to (year of todaysDate)&lt;br /&gt;set monthlyBkp to ("Monthly Reports " &amp; bkpYear) as text&lt;br /&gt;if not (folder "Database Backups" exists) then&lt;br /&gt;   set targetFolder to (make new folder at folder "Desktop" of startup disk with properties {name:"Database Backups"})&lt;br /&gt;end if&lt;br /&gt;set replaceExecute to button returned of (display dialog "Are you sure you want to replace current backup contents with the selected items?" with icon caution buttons {"Cancel","OK"} default button {"OK"} giving up after 60) --GIVE USER THE CHANCE TO EXIT IN CASE THERE IS ALREADY A FOLDER 'Database Backups' CONTAINING ITEMS THAT THE USER DOES NOT WANT TO REPLACE&lt;br /&gt;if replaceExecute = "OK" then&lt;br /&gt;select {file "Home Database" of folder "Database Programs)", ¬&lt;br /&gt;  file "Appointments" of folder "Database Programs", ¬&lt;br /&gt;  file monthlyBkp of folder "Database Programs", ¬&lt;br /&gt;  file "Accounts Receivable" of folder "Database Programs", ¬&lt;br /&gt;  file "Calendar" of folder "Database Programs"}&lt;br /&gt;duplicate the selection to folder "Database Backups" replacing true --IF WE PROCEED, 'replacing true' REPLACES THE CONTENTS OF THE FOLDER "Database Backups"&lt;br /&gt;end if&lt;br /&gt;on error&lt;br /&gt;display dialog "Backup cancelled!" with icon stop buttons {"OK"} default button {"OK"} giving up after 3&lt;br /&gt;end try&lt;br /&gt;end tell&lt;br /&gt;tell application "FileMaker Pro" to activate&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kNf8hE1pLOE/SiUCj-WYFkI/AAAAAAAAADw/_5TrCNM-bgI/s1600-h/AppleStickerOld.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 112px; height: 130px;" src="http://3.bp.blogspot.com/_kNf8hE1pLOE/SiUCj-WYFkI/AAAAAAAAADw/_5TrCNM-bgI/s320/AppleStickerOld.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5342679350000490050" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As always, if you have any questions or comments, contact me at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-5619009913616716167?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/5619009913616716167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=5619009913616716167&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/5619009913616716167?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/5619009913616716167?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/04/filemaker-pro-applescript-to-backup.html' title='FileMaker Pro AppleScript to Backup Files'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kNf8hE1pLOE/SiUDMxvpnkI/AAAAAAAAAD4/e1waZAXHmbo/s72-c/AppleStoreChicago.jpg' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;D0ICQnkzeyp7ImA9WxVaGEw.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-2137313758419526027</id><published>2009-03-04T10:30:00.000-08:00</published><updated>2009-04-15T10:12:43.783-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-04-15T10:12:43.783-07:00</app:edited><title>More on List Dialogs</title><content type='html'>This post will deal with what I consider a very concrete use of the 'choose from list' dialog. After reading this (and perhaps trying it out in the Script Editor) you will probably be totally confused (just kidding!!) It gets a little complicated, but it is basically a cut-and-paste script.&lt;br /&gt;&lt;br /&gt;If you pay close attention to my comments, I'm sure you'll understand most of what is going on and, after all, it's understanding how a script works that allows you adapt it to other applications that you may have in mind.&lt;br /&gt;&lt;br /&gt;So anyway, here it is:&lt;br /&gt;&lt;br /&gt;set AppleScript's text item delimiters to ","&lt;br /&gt;&lt;br /&gt;--THIS FIRST LINE IS NEEDED, BECAUSE IT SETS THINGS UP FOR EXTRACTING THE INFO WE NEED&lt;br /&gt;&lt;br /&gt;set theLongDate to (current date)&lt;br /&gt;set theLongDate to (date string of theLongDate)&lt;br /&gt;&lt;br /&gt;--THE NEXT 2 LINES SET US UP FOR THE CALCULATING THE NUMERICAL DATA FOR MONTH AND DAY&lt;br /&gt;&lt;br /&gt;set currentMonth to (word 1 of text item 2 of theLongDate)&lt;br /&gt;set currentDay to (word 2 of text item 2 of theLongDate)&lt;br /&gt;&lt;br /&gt;--THIS GETS THE NUMERICAL VALUE FOR THE MONTH&lt;br /&gt;&lt;br /&gt;set currentYear to (word 1 of text item 3 of theLongDate)&lt;br /&gt;set monthList to {January, February, March, April, May, June, July, August, September, October, November, December}&lt;br /&gt;repeat with x from 1 to 12&lt;br /&gt;if currentMonth = ((item x of monthList) as string) then&lt;br /&gt;set theRequestNumber to (text -2 thru -1 of ("0" &amp; x))&lt;br /&gt;exit repeat&lt;br /&gt;end if&lt;br /&gt;end repeat&lt;br /&gt;set currentMonth to theRequestNumber&lt;br /&gt;set currentDay to (text -2 thru -1 of ("0" &amp; currentDay))&lt;br /&gt;set theShortDate to (currentMonth &amp; "/" &amp; currentDay &amp; "/" &amp; currentYear) as string&lt;br /&gt;&lt;br /&gt;--PREVIOUS CODE SETS UP THE DEFAULT TEXT (CURRENT DATE IN THE FORM MM/DD/YYYY - SOMETHING LIKE '02/03/2009') FOR DIALOG BELOW :&lt;br /&gt;&lt;br /&gt;set theDefaultDate to text returned of (display dialog "Enter a date in the form MM/DD/YYYY:" default answer theShortDate buttons {"Calc Date"} default button {"Calc Date"} giving up after 20)&lt;br /&gt;&lt;br /&gt;--THIS LINE CONVERTS THE TEXT SUPPLIED BY THE DIALOG INTO CLASS 'DATE' (THE LONG FORM OF THE DATE, INCLUDING THE TIME):&lt;br /&gt;set calcLongDate to date theDefaultDate&lt;br /&gt;&lt;br /&gt;--THIS LINE EXTRACTS THE DATE PORTION AND LEAVES THE TIME PORTION BEHIND:&lt;br /&gt;set calcLongDateTrunc to (date string of calcLongDate)&lt;br /&gt;&lt;br /&gt;--THIS CONVERTS calcLongDateTrunc BACK INTO THE FORM 'TEXT' SO THAT IT CAN BE DISPLAYED IN A DIALOG:&lt;br /&gt;set calcLongDateTrunc to calcLongDateTrunc as string&lt;br /&gt;display dialog calcLongDateTrunc buttons {"Done"} default button {"Done"} giving up after 15&lt;br /&gt;&lt;br /&gt;--YIELDS - 'Tuesday, February 3, 2009'&lt;br /&gt;&lt;br /&gt;These sort of dialogs are so useful that in my next post, I will continue by presenting another useful example of how they may be used.&lt;br /&gt;&lt;br /&gt;In conclusion, please note in my right sidebar (you may have to scroll), that in the future I will be featuring (here and there) little snippets of HyperTalk code (and others as they occur to me)  &lt;br /&gt;&lt;br /&gt;As always, if you have any questions or comments, contact me at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://technorati.com/faves?sub=addfavbtn&amp;amp;add=http://scriptingissues.blogspot.com"&gt;&lt;img src="http://static.technorati.com/pix/fave/tech-fav-1.png" alt="Add to Technorati Favorites" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-2137313758419526027?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/2137313758419526027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=2137313758419526027&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/2137313758419526027?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/2137313758419526027?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/03/this-post-will-deal-with-what-i.html' title='More on List Dialogs'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CUEARn8-fip7ImA9WxVaGEw.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-2101007560400503355</id><published>2009-02-27T11:46:00.000-08:00</published><updated>2009-04-15T09:40:47.156-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-04-15T09:40:47.156-07:00</app:edited><title>Dialogs for Lists</title><content type='html'>In this post, we will deal with situations when you want to choose from multiple options within a list. You can have lists that are preset, such as choosing from a list of months of the year, for instance, or perhaps a list such as that which might be generated from a database program when certain criteria are specified (ie names beginning with the surname Bill).&lt;br /&gt;&lt;br /&gt;Take a look at this example:&lt;br /&gt;&lt;br /&gt;set theName to (choose from list {"John", "Joe", "Bill"})&lt;br /&gt;if theName is false then&lt;br /&gt; display dialog "You clicked cancel to exit." with icon stop buttons {"Exit"} default button {"Exit"}&lt;br /&gt;else&lt;br /&gt; set theName to (item 1 of theName)&lt;br /&gt;display dialog theName with icon note buttons {"Info"} default button {"Info"}&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--FIRST NOTE IN THE FIRST LINE THAT 'choose from list' PROMPTS YOU TO CHOOSE FROM THE THREE NAMES GIVEN {"John", "Joe", "Bill"}. THE NAME CHOSEN IS ASSIGNED TO THE VARIABLE 'theName'.&lt;br /&gt;&lt;br /&gt;--IF THE USER CLICKS CANCEL FROM A 'choose from list' DIALOG SUCH AS THIS, THEN THE VARIABLE 'theName' TAKES ON THE VALUE false INDICATING THAT THE USER DECIDED NOT TO MAKE A CHOICE OF THE ITEMS LISTED IN THE DIALOG.&lt;br /&gt;&lt;br /&gt;--IF THE USER MAKES A CHOICE, SAY FOR INSTANCE "Bill", THEN 'theName' TAKES ON THAT VALUE AND CAN BE USED FOR FURTHER SCRIPT EXECUTION.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Adapting the previous dialog, assuming you had a list of items (whatever criteria relevant to what you want) compiled from a database of your own design, in this case we will call the list 'recentOrders', a list of customer names who have ordered products or services from you in recent months. Another version of the list dialog that could be used based on these premises:&lt;br /&gt;&lt;br /&gt;set recentOrders to recentOrdersArray as list&lt;br /&gt;try&lt;br /&gt;set recentCustomer to (choose from list recentOrders)&lt;br /&gt;if recentCustomer ≠ false then&lt;br /&gt;  set recentCustomer to (item 1 of recentCustomer)&lt;br /&gt;set scriptAction to button returned of (display dialog "Get information for last order from '" &amp; recentCustomer &amp; "' ?" with icon note buttons {"Cancel","Info"} default button {"Info"})&lt;br /&gt;display dialog "Info for last order from: " &amp; recentCustomer&lt;br /&gt;--HERE YOU WOULD RETURN TO THE USER THE INFO FROM YOUR DATABASE ON 'recentCustomer'&lt;br /&gt;end if&lt;br /&gt;on error&lt;br /&gt;end try&lt;br /&gt;&lt;br /&gt;--HERE, WE CHOOSE A PARTICULAR ITEM (CUSTOMER) FROM 'recentOrders'. NEXT, IF WE DO NOT CANCEL EXECUTION, THE VARIABLE 'recentCustomer' IS ASSIGNED. IF WE DO NOT CANCEL THE NEXT REQUEST DIALOG, THE DATA ON THE REQUESTED CUSTOMER CAN BE DISPLAYED (BASED UPON INFO STORED IN WHATEVER THE REFERENCED DATABASE).&lt;br /&gt;&lt;br /&gt;As list type dialogs deviate from the standard dialogs dealt with up until now, it is important to note that, although computers are supposed to follow some sort of logic, you sometimes have to 'go with the flow' on things that don't seem to follow that logic.&lt;br /&gt;&lt;br /&gt;I have tried to emphasize from the beginning, that the whole process of learning how to AppleScript builds upon itself. In my coming posts, I will continue to try to make things easier to grasp by using a step-by-step approach, as I have found it effective in building my AppleScript repertoire.&lt;br /&gt;&lt;br /&gt;I hope everyone has found this post useful in furthering their knowledge of scripting with AppleScript. If you do not understand the basics of this post, please see my Archives at the top of the page (on the left), as they are the basis of understanding the more complex ones.&lt;br /&gt;&lt;br /&gt;As always, if you have any questions or comments, contact me at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-2101007560400503355?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/2101007560400503355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=2101007560400503355&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/2101007560400503355?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/2101007560400503355?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/02/dialogs-for-lists.html' title='Dialogs for Lists'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CUcMSXg_eSp7ImA9WxBTFUo.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-708498333353640666</id><published>2009-01-22T06:40:00.000-08:00</published><updated>2009-12-11T15:11:28.641-08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-12-11T15:11:28.641-08:00</app:edited><title>Using AppleScript Dialogs to invoke actions</title><content type='html'>If you remember from my last post, we ended up with this dialog which had to be encompassed by a 'TRY CLAUSE' to prevent an error message from being generated by activating the 'Cancel' button. In this post, I will begin by modifying the script below to show you how you can use data returned from a dialog to invoke an action from &lt;a href="http://www.apple.com/"&gt;AppleScript&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
display dialog "Your text here" with icon caution buttons {"OK","Cancel"} default button {"Cancel"} giving up after 30&lt;br /&gt;
on error&lt;br /&gt;
end try&lt;br /&gt;
&lt;br /&gt;
Taking our original script I will make a few additions:&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;set theAction to button returned of (&lt;/span&gt;display dialog "Quit application 'AppleWorks 6'" with icon caution buttons {"OK", "Cancel"} default button {"Cancel"} giving up after 30&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;if theAction = "OK" then tell application "AppleWorks 6" to quit&lt;/span&gt;&lt;br /&gt;
on error&lt;br /&gt;
end try&lt;br /&gt;
&lt;br /&gt;
You can see by the text in bold, that I have set the variable 'theAction' to take on the value of the name of the button chosen. As before, if the user clicks on the 'Cancel' button the script halts without any action being taken. If, however the 'OK' button is chosen, then AppleScript sends the quit message to AppleWorks 6.&lt;br /&gt;
&lt;br /&gt;
Now suppose we wanted a dialog that quits an application, but we want to be able to enter in the name of a specific application ahead of time.&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;set dialogResult to (&lt;/span&gt;display dialog "Enter name of application to quit:" &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;default answer ""&lt;/span&gt; with icon caution buttons {"OK", "Cancel"} default button {"Cancel"} giving up after 30&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;set appToQuit to (text returned of dialogResult)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;if (button returned of dialogResult) = "OK" then tell application appToQuit to quit&lt;/span&gt;&lt;br /&gt;
on error&lt;br /&gt;
end try&lt;br /&gt;
&lt;br /&gt;
As before, I have highlighted the changes to be noted, and there are a few, but it's not as complicated as it may seem.&lt;br /&gt;
&lt;br /&gt;
First, I have enclosed the dialog part of the script in parentheses and before that I have inserted 'set dialogResult to'. This tells AppleScript to give the variable dialogResult the values that will be derived from executing the dialog part of the script.&lt;br /&gt;
&lt;br /&gt;
The text 'default answer ""' inserted into the dialog section tells AppleScript to give us a blank text field where the name of the app to quit will be entered. The variable dialogResult will contain both the text entered and the name of the button clicked.&lt;br /&gt;
&lt;br /&gt;
Next, the variable appToQuit extracts the text part of dialogResult (the application name)&lt;br /&gt;
&lt;br /&gt;
The next line determines if the 'OK' button was activated and, if so, quits the application supplied by the variable appToQuit, otherwise the script ends with no further action.&lt;br /&gt;
&lt;br /&gt;
I hope by now you're having a little bit of fun and seeing just how powerful the AppleScript language can be. In my next post, I will go into more specialized dialogs such as those that are useful when you have lists of items to choose from.&lt;br /&gt;
&lt;br /&gt;
If you have any questions or comments, contact me at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-708498333353640666?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/708498333353640666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=708498333353640666&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/708498333353640666?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/708498333353640666?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/01/if-you-remember-from-my-last-post-we.html' title='Using AppleScript Dialogs to invoke actions'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;AkUHSH4_fyp7ImA9WxBTFk0.&quot;'><id>tag:blogger.com,1999:blog-4023384538469484959.post-179049164359310554</id><published>2009-01-20T10:53:00.000-08:00</published><updated>2009-12-12T00:57:19.047-08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-12-12T00:57:19.047-08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS'/><category scheme='http://www.blogger.com/atom/ns#' term='HyperCard'/><category scheme='http://www.blogger.com/atom/ns#' term='Script Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='FileMaker'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title>Getting Started with AppleScript Dialogs</title><content type='html'>Getting Started with AppleScript Dialogs &lt;span style="font-weight:bold;"&gt;Dialogs are essential when you want to communicate with users so that they can make decisions on a course of action when notified of the state of an application or the system itself. Well written dialogs that are informative and clear are vital to any credible software solution.&lt;br /&gt;
&lt;br /&gt;
Furthermore, as you'll see, I will try to show you how to make your dialogs not only easy for your users to understand, but also easy to use so that they will always know what course of action to take.&lt;br /&gt;
&lt;br /&gt;
With all that said, here is a very simple dialog script to notify the user of the result of some action:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;display dialog "Your text here" with icon &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;stop&lt;/span&gt; buttons {"OK"} default button {"OK"}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
--NOTE IN THE ABOVE SCRIPT THAT YOU COULD SUBSTIUTE 'NOTE' OR 'CAUTION' FOR 'STOP' TO INDICATE VARYING DEGREES OF IMPORTANCE OR URGENCY&lt;br /&gt;
&lt;br /&gt;
--TAKING THE ABOVE SCRIPT A STEP FURTHER, YOU COULD INCLUDE 'GIVING UP AFTER 5' (OR 15, 20, 60 ETC) SO THAT A DIALOG WILL AUTOMATICALLY CLOSE ITSELF AFTER THE INDICATED INTERVAL OF TIME:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;display dialog "Your text here" with icon stop buttons {"OK"} default button {"OK"} &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;giving up after 5&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
--YOU CAN HAVE ALSO MULTIPLE BUTTON CHOICES (UP TO 3). TAKE SPECIAL NOTE OF THE FORMATTING REQUIRED FOR MULTIPLE BUTTONS:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;display dialog "Your text here" with icon note buttons &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;{"OK","Cancel"}&lt;/span&gt; default button {"Cancel"} giving up after 30&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
--NOTE IN THE ABOVE EXAMPLE, IF YOU CLICK ON 'Cancel' OR STRIKE THE ENTER OR RETURN KEYS, IT WILL GENERATE AN ERROR MESSAGE. TO AVOID THIS AND TO GET YOUR DIALOG TO CLOSE 'SILENTLY', THE ABOVE MUST BE ENCLOSED WITHIN A 'TRY CLAUSE' SUCH AS:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;
display dialog "Your text here" with icon caution buttons {"OK","Cancel"} default button {"Cancel"} giving up after 30&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;on error&lt;br /&gt;
end try&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
I hope that those of you who are new to appleScripting will find these sample dialog scripts useful as you begin to explore the magic of appleScript. If you still don't understand how these scripts work, I strongly urge you to cut and paste them into your Script Editor and run them - this should clear up any questions you may still have.&lt;br /&gt;
&lt;br /&gt;
In my next post, I will continue in more detail with these and other dialogs and how they can be used to process text and variables etc, so that your scripts can take a course of action.&lt;/b&gt;&lt;div&gt;If you have any questions or suggestions send me email at: &lt;b&gt;hyperscripter@gmail.com&lt;/b&gt; or &lt;b&gt;&lt;a href="http://twitter.com/hyperscripter"&gt;http://twitter.com/hyperscripter&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Till then, happy scripting!&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4023384538469484959-179049164359310554?l=scriptingissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingissues.blogspot.com/feeds/179049164359310554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4023384538469484959&amp;postID=179049164359310554&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/179049164359310554?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4023384538469484959/posts/default/179049164359310554?v=2'/><link rel='alternate' type='text/html' href='http://scriptingissues.blogspot.com/2009/01/getting-started-with-applescript.html' title='Getting Started with AppleScript Dialogs'/><author><name>HyperScripter</name><email>hyperscripter@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='04482541654022195659'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>