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

'Display Alert' Dialogs

Apple IIc Apple Screen Small 300x267These are a type of dialog, introduced in OS 10.4 (Tiger), which are similar to regular dialogs (in use as well as syntax), the noteable difference being that their purpose is to expand upon the standard ‘display dialog’. 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.
try
display dialog ("Enter a number") default answer ("") buttons {"OK"} default button "OK"
set userEntry to text returned of result
return userEntry as number
on error
set alertString to "The text entered is not a number"
set messageString to ("" & userEntry & "is not a number. ") & "Run the script again and use only number keys."
display alert alertString message messageString buttons {"OK"} default button "OK" giving up after 20
end try

This is fairly straightforward, below the resulting dialog when the user happens to enter ‘abc’ (a non-numerical value):

displayalertdlog

tech fav 1

Contact me if you have any questions or comments at: hyperscripter@gmail.com or http://facebook.com/hyperscripter or to subscribe, click the By Email link at the top of the page

If you like this post, check out this one: Invoking actions with dialogs

482 comments to Display Alert Dialogs

  • I need to exhibit my capability to one’s support delivering assist to actually personnel that need relief about that state of great interest. Your special dedication to having the message all-around came to be incredibly significantly important and also has in each and every situation triggered ladies just like me to become at their pursuits. This new humid and pleasant guide indicates tons to me and pretty well excess upto my consorts. Best wishes; from each one of us.

  • Happy to be visiting your blog again, the doll has been weeks for me. Well, right here is the comment that I’ve been waited for so long.

  • It’s hard to seek out knowledgeable people on this matter, however you sound like you recognize what you’re talking about! Thanks

  • Thanks, You haven’t purported to achieve this, however I believe you could have managed to express the mind-set that lots of people are really in.

  • Thanks, You almost certainly haven’t that will do so, however I believe you encounter could express the mind-set that lots of patients are in.

  • Hi there, I think your website may very well be having mozilla firefox browser compatibility challenges. When I research your blog in Safari, it appears fine though when opening in The net Explorer, it uses some overlapping. I simply desired to provide you a immediate minds high! Other then which often, shining website!

  • The sense of planning to assist, however not figuring out how and the place, is something various us already went through a.

  • Many thanks lots for delivering everyone shockingly marvellous possibility to learn to read vital reviews from here. It’s always therefore awesome also full of enjoyable most likely for me in person and my workplace co-workers to appear your web site at a least thrice in a seven days to read in the new stuff you could have. And naturally, I’m just always pleased for hanging hints individuals provide. Selected 2 tips with this publish are very by far the most impressive I’ve ever had

  • It a new idea! Just wanna say thank you for your information you have posted. Just continue publishing this type of post. I am going to a loyal reader, thanks a lot.

  • I really like what you guys are usually up too. This kind of clever work and reporting! Keep up the good works guys I’ve added you guys to blogroll.

  • Sup, I do think your website could be having browser analysis concerns. Once i look at your site in Trip, it seems great but when opening in World wide web Explorer, it uses some overlapping. I basically planned to provide you with quick heads up! Other you should that in fact, very good website!

  • My hope is the idea that some participants in our community will be curious about shared their activity work for possible presentation for the conference.

  • I d been very glad to find this internet site.I wanted to thank for you for this great read!! I finaly enjoying every part of it and that i have you ever gigs to looking for new stuff from you post.

  • It a new idea! Just wanna say thank you of the news you have diffused. Just continue composing this sort of post. I’m going to a loyal reader, thanks a lot.

  • Thanks, You haven’t meant to achieve this, however I believe you have got was able to express the mind-set that lots of persons are currently in.

  • We’re a bunch of volunteers and opening a brand new scheme in our community. Your site provided us with valuable info to work on. You have done an impressive job and our whole community can be thankful to you.

  • You made some decent factors there. I appeared on the internet for the difficulty and located most people will go together with together with your website.

  • This is very attention-grabbing, You’re an excessively professional blogger. I have joined your feed and look forward to searching for extra of your great post. Additionally, I’ve shared your website in my social networks

  • You can definitely see your skills in the work you write. The sector hopes for even more passionate writers like you who aren’t afraid to mention how they believe. At all times go after your heart.

  • We’re really fan of your respective blog…will get solved properly immediately. I’m really happy along with one’s writing skills and likewise with the blueprint on your web site. Is this a paid masquerade or perhaps you personalize it your own? Anyway keep up the excellent high-quality writing, it’s sparse to determine an amazing site like we are now one today..

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