OCInkjet.com 728x90 banner, image is updated by season.

Apple-AppleScript-Script-Editor-Logo

Shop HP Download Store and get $5 OFF Orders Over $50! Use Promo Code SPEND150SAVE15

Basic AppleScript Dialog:

display dialog "Your text here" with icon stop buttons {"OK"} default button {"OK"} giving up after 5

'giving up after 5' will automatically close the script after the indicated interval of time has elapsed.

HTML Anchor Code

Here is a sample of how to write code to link one part of your blog page to another:

<a name = "By Email">[optional text]</a> --place this where you want the link to go <a href = "#By Email">By Email</a> --this is the actual link

more HTML

HTML Code to Link to Other Web Pages

Here is a sample of code to link to another page. this is similar to the anchor code, except that the destination code is the url of the destination site:

<a href= "www.webSite.
com"> Website Name</a>

--just replace "www.webSite.
com"
with the actual url destination site and replace 'Website Name' with the prompt that the user will see.
Apple-IIc-Apple-Screen

AppleScript Note:

It might be interesting to those of you who are AppleScript enthusiasts that the HyperCard (HyperTalk) project was the prototype back in the '80's of what became the system-wide Applescript language (akin to JavaScript) that is in use today.
Apple-Mac-512-Screen
3d-iMac-Large

Trapping for List Dialog Errors

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: set x to (choose from list {"Joe","Amy",
"Bill"} with prompt "Choose a record:")
if x is false then
else
set targetItem to (x as text)
show every record whose cell "Name" contains x
end if
When the user clicks on 'Cancel', the variable x is assigned the boolean value false. So all you have to do is set up a conditional to deal with that and to perform the usual statements otherwise.

Learning AppleScript

Create Multiple Folders with Terminal

If you are more of a techy kind of person and are comfortable with using Terminal, here is a script you can use to easily create multiple folders:

First, for a single folder, type in: mkdir "Folder 1" --or whatever you want to name your folder, this creates a new directory, which, in effect is a new folder. To place multiple items in the 'Documents' folder: cd/Users/ Administrator/ Documents mkdir "Folder 1" "Folder 2" "Folder 3" To quickly create multiple folders, create a text file with the desired folder names (as many as you want) and name it something like 'folderList .txt'. Next type this in Terminal: cat folderList.txt |xargs mkdir Or you could create folders with the same prefix by entering: mkdir "Invoices " {"Corporate", "Individual", "Pro-Bono"}

Digg! Digg This!!

Mac LC III (1994), the first Mac that I ever owned, the CD-Rom and Zip drive were added much later.

Mac LC III (1994), the first Mac that I ever owned, the CD-Rom and Zip drive were added much later.

Basic HTML

Here is an example of a very simple HTML document:

<html>
<head>
<title>Basic HTML Document</title>
</head>
<body>
Your text goes here
</body>
</html>

more HTML

AppleScripts for Basic Printing

mac 512 screen 300x225

The Mac 512 K, the first in the Macintosh series of computers

The first script below is for printing a document in “TextEdit”. Before running the script, you must bring the desired document to the front:

tell application "TextEdit"
print the front document with properties {copies:2, collating:true, starting page:1, ending page:1, pages across:1, pages down:1, error handling:standard} without print dialog
end tell

Most of what appears in ‘with properties {….}’ 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 ‘target printer:’ and the actual name of the desired printer enclosed in quotes.

If you want to use different printers in certain cases, replace ‘without print dialog’ with ‘with print dialog’

tech fav 1

This second script, so that you aren’t required to specify the application file targeted by the print command:

tell application "Printer Setup Utility"
set the current printer to printer "Deskjet D2400 series"
(alias "Macintosh HD:Users:administrator:Documents:My Document.cwk")
end tell

Replace ‘Deskjet D2400 series’ with the name of your printer and replace ‘(alias “Macintosh HD:Users:administrator:Documents:My Document.cwk”)’ with the path to the document that you wish to print (Don’t forget to precede the path name by ‘alias’ – this is important).

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 Standard Suite (there are 3). If you have questions on printing or would like to suggest a post on another AppleScript topic, contact me at: hyperscripter@gmail.com or http://twitter.com/hyperscripter or to subscribe, click the By Email link at the top of the page

23 comments to AppleScripts for Basic Printing

  • I gotta bookmark this internet site it seems very beneficial handy

  • Thanks for the sensible critique. Me & my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post. I’m very glad to see such magnificent information being shared freely out there.

  • I pay a quick visit each day some blogs and information sites to read articles or reviews, however this website presents feature based content.

  • Yup, you are right Google is the most excellent for blogging, Google’s blog also come up to rapidly in search engines too.

  • I am personally really like within your blog…will get resolved accurately as soon as you can. I’m really fulfilled along with your composing competencies and also with the describe on your own site. Is that this a paid issue or did you personalize it your own? Anyway carry on the excellent high quality text, it’s rare to determine a wonderful weblog similar 1 today..

  • Sup, I believe your wordpress blog could possibly be having internet browser support matters. While i take a look at your website in Trip, it seems fine though when opening in The web Traveler, it possesses several overlapping. I simply wished to give you a quick heads over! Other in that case which often, superb site!

  • Say thanks a lot for supplying everyone shockingly marvellous possibility to learn important reviews from here. It’s always so awesome also jammed with entertaining for myself personally and my place of work partners to search your particular web site for a least thrice in a week to learn throughout the new stuff you may have. And then, I’m just always happy for the putting hints yourself allow. Designated 2 guidelines with this put up are truly the most amazing I’ve ever had

  • Hi there I am so thrilled I found your blog page. A quick question if you don’t mind. I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!…

  • I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it easy to read for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!…

  • I wanted to adhere to down and allow you to have a clue how a great deal I actually much-loved finding your internet web-site today. I would ponder over it an authentic recognize to operate within my place of work and then use the ideas offered on your own web site and as well be involved in visitors’ feedback in this way. Will need to a position connected with customer article writer turn out to be sold at your last, you need to figure out. homes for rent during boca raton

  • you’re really a good webmaster.The site loading speed is incredible.It seems that you’re doing any unique trick.Also, The contents are masterwork.you have done a great job on this topic!

  • I really appreciate this post.I’ve been looking everywhere for this! Thank goodness I found it on Bing.You’ve made my day! Thank you again

  • This one is an inspiration personally to uncover out much more related to this subject. I need to confess your data extended my sentiments in addition to I’m going to right now take your feed to stay updated on each coming weblog posts you might probably create. You are worthy of thanks for a job perfectly done!

  • Hey – nice weblog, just trying around some blogs, appears a fairly nice platform You Are using. I’m at present utilizing Drupal for a couple of of my websites but seeking to change one in every of them over to a platform very a lot the same to yours as a trial run. Something in particular you’d recommend about it?

  • I’m delighted that I have noticed this weblog. Lastly something not a junk, which we undergo extremely frequently. The website is lovingly serviced and saved as much as date. So it should be, thanks for sharing this with us.

  • wonderful points altogether, you just gained a brand new reader.What would you suggest in regards to your post that you made some days ago? Any positive?

  • How soon will you update your blog? I’m interested in reading some more information on this issue.

  • Nice to be visiting your blog again, it really has been weeks for myself. Well, here is the story that I’ve been waited for so long.

  • Say thanks a whole lot for granting everyone shockingly marvellous chance to learn to read crucial critiques from here. It’s always so amazing also filled with exciting for myself personally and my place of work partners to look your specific business at a least thrice within a week to learn to read through the new items you will have. And of course, I’m just always satisfied for placing guidelines everybody provide. Special 2 pointers in this submit are extremely the foremost amazing I’ve ever had

  • I bought some intersting info here. I think that if more people thought about it that way, they’d possess a better time obtain the hang ofing the matter.

Leave a Reply

  

  

  

HTML Guide from Peachpit Press

$1.99 Web Hosting at Go Daddy 120x240
Apple-Computer-Sticker-Old

iPhoto 6

Apple-ID-Badge
Create Multiple Folders with Terminal

If you are more of a techy kind of person and are comfortable with using Terminal, here is a script you can use to easily create multiple folders:

First, for a single folder, type in: mkdir "Folder 1" --or whatever you want to name your folder, this creates a new directory, which, in effect is a new folder. To place multiple items in the 'Documents' folder: cd/Users/ Administrator/ Documents mkdir "Folder 1" "Folder 2" "Folder 3" To quickly create multiple folders, create a text file with the desired folder names (as many as you want) and name it something like 'folderList.txt'. Next type this in Terminal: cat folderList.txt |xargs mkdir Or you could create folders with the same prefix by entering: mkdir "Invoices " {"Corporate", "Individual", "Pro-Bono"}

AppleScript 1-2-3

Stop by every day to shop our new Deal of the Day at BarnesandNoble.com!

Add http://www.scriptsforapple.com to Technorati Favorites

Apple-iMac-Rainbow

Digg! Digg This!!

An AppleScript to Verify a Date

Run this in the Script Editor:

set dateRecord to (current date)
set defaultDate to (date string of dateRecord)
try
set apptDate to text returned of (display dialog "Enter appointment date:" default answer defaultDate buttons {"Set"} default button {"Set"})
set datetext to apptDate as text
date apptDate --if an invalid date is entered, the next dialog is aborted and it triggers the error alert below.
display dialog datetext & " is a valid date." with icon note buttons {"OK"} default button {"OK"}
on error
set alertText to "An error has occurred!"
set messageText to quote & datetext & quote & " is an invalid date."
display alert alertText message messageText as warning buttons {"OK"} default button "OK" giving up after 15
return
end try