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.
|
'Display Alert' Dialogs
These 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):


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
|
 
HTML Guide from Peachpit Press
 iPhoto 6
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 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
|
 Concept Drawing for iMac prior to Production
Fun HTML Use this to add interest to your pages, but be careful, if you overdo it, it can make your page look gaudy, if not ridiculous!
Read All About It
Here's is the code as it appears above:
<p align="center" style="padding: 5px; background-color: #FFCE9C; border: dotted 5px #FFCE9C;"><marquee width=20% behavior=scroll direction=left loop=infinite> Latest Headlines... </marquee><blink>Read All About It</blink>/p>
Check out this color HTML!!!
AppleScript for Setting System Volume Copy and paste this into the Script Editor and try it out:
set defaultVolume to "3"
set volumeLevel to text returned of ¬
(display dialog ¬
"Set the system volume to (7 is the highest):"¬
default answer defaultVolume with icon note¬
buttons {"OK"} default button "OK") as integer
set volumeValues to {0, 1, 2, 3, 4, 5, 6, 7} ¬
as list
if volumeLevel is not in volumeValues then ¬
set volumeLevel to defaultVolume
tell application "Finder"
try
set volume volumeLevel
beep 2
on error errDlog
display dialog errDlog with icon stop ¬
buttons {"Abort"} default button ¬
"Abort" giving up after 15
end try
end tell
Earn Wealth on Internet
Learn Tips and Tricks to Making Money on the Internet
www.internetwealth.com
Learn How To Make Money Blogging - Blog Mastermind
Six-figure Yaro Starak Teaches You How To Set Up And Profit From A Successful Blog. Start Making Money From Blogs By Following This Step-by-step, Weekly Coaching Program
http://www.blogmastermind.com/coaching/
Seo Elite: New Seo Software!
The Grand Daddy Of All Seo Software!
Get A Top 5 Google Ranking In Under 30 Days!
http://www.seoelite.com/
Turn Your Photos Into Cash
All You Need Is A Digital Camera, A Computer And An Internet Connection To Get Started Making Extra Income Every Month!
http://turnyourphotosintocash.com/
Infinite Income Plan - Instant Wealth Guide & CDs.
Easy Money For Affiliates, Huge 8.3% Conversions On Generic Traffic. Massive 70% Commissions Plus
HyperCard AppleScript Users:
Heres an AppleScript for backing up a selected group of HyperCard files. this was used in one of my HyperCard stacks, but could be adapted for use in OSX programs with little or no modification:
send "suiteBkp(true)" to bg btn "BackupSuite"
--Use this line to call the handler below (true displays a notification dialog when the process is complete, you must have a button named bg btn "BackupSuite"):
on suiteBkp(theBoolean)
copy line 1 of field "selectedFolder" to theHFFolderPath --You'll need a hidden field named "selectedFolder" that a script (prior to the call) will place the path to the desired folder in.
tell application "Finder"
activate
set todaysDate to (current date)
set bkpYear to (year of todaysDate)
set monthlyBkp to ("Monthly Reports_" & bkpYear) as string
if exists (folder "HyperCard Backup") then
select folder "HyperCard Backup"
delete selection
end if
if exists (folder "HyperCard Backup" of folder theHFFolderPath) then
select folder "HyperCard Backup" of folder theHFFolderPath
delete selection
end if
make new folder at folder theHFFolderPath with properties {name:"HyperCard Backup"}
select {file "Appointments" of folder theHFFolderPath, ¬ file "HyperFile" of folder theHFFolderPath, ¬ file "Outstanding Invoices" of folder theHFFolderPath, ¬ file "Year" of folder theHFFolderPath, ¬ file monthlyBkp of folder theHFFolderPath, ¬
copy selection to folder "HyperCard Backup" of folder theHFFolderPath
select folder "HyperCard Backup" of folder theHFFolderPath
select file "Appointments" of folder ¬ "HyperFile Suite Backup" of folder theHFFolderPath
set name of selection to "Appointments.bkp"
select file "HyperFile" of folder "HyperCard Backup" of ¬ folder theHFFolderPath
set name of selection to "HyperFile.bkp"
select file "Outstanding Invoices" of ¬ folder "HyperFile Suite Backup" of folder theHFFolderPath
set name of selection to "Outstanding Invoices.bkp"
select file "Year" of folder "HyperFile Suite Backup" of ¬ folder theHFFolderPath
set name of selection to "Year.bkp"
set prefMonthlyBkp to (monthlyBkp & ".bkp") as string
select file monthlyBkp of folder "HyperFile Suite Backup" of ¬ folder theHFFolderPath
set name of selection to prefMonthlyBkp
select folder "HyperFile Suite Backup" of folder "The HyperFile Folder"
move selection to desktop
end tell
if theBoolean = "true" then
tell application "HyperCard"
activate
display dialog ¬ "Your backup has been saved to desktop." buttons {"Done"} default button {"Done"} with icon 129 giving up after 10
end tell
end if
end suiteBkp
more HyperTalk
 Macintosh Plus (late 1984), followed close behind the Mac 512k
 The classic Apple IIc (1981), part of a series of Apple computers that preceded the debut of the Macintosh
HyperCard Users Corner:
Here's a simple, but very useful little HyperTalk script for verifying the validity of a date entered by a user, assuming that you have a menu item "flag date..." (or whatever you choose to name it) or it could be altered slightly and placed within a mouseUp statement:
if menuItem = "Flag Date..." then
global tryDate
ask "Enter a date for your new appointment:" with the long date
if it ≠ "" and the result ≠ "Cancel" then
put it into tryDate
else
put "" into tryDate
exit doMenu
end if
if invalidDate() then
answer "The date entered is not valid!"
put "" into tryDate
exit doMenu
end if
--Here you would put the statements to execute if the entered date proves to be valid
put "" into tryDate
end if
function invalidDate
global tryDate
convert tryDate to short date
if the result = "invalid date" then
return true
else
return false
end if
end invalidDate
more HyperTalk

 Mac SE (circa 1987), was a more advanced version of the Mac Plus and had an internal hard drive.
YouTube Video Search Script:
tell application "Finder"
try
set webSearch to text returned of (display dialog "Enter YouTube Video
Search" default answer "" buttons {"Search", "Cancel"} default button 1)
open location "http://www.youtube.com/results?search_query=" & webSearch
on error theError
display dialog theError
end try
end tell
|
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..