About AppleScript
Speaking of AppleScript, there may be three meanings involved:
1.AppleScript language: Is the language of the Apple script that is used to write scripts that run on Mac systems.
2.AppleScript script: It is a series of instructions written in AppleScript language. Hereafter referred to as script.
3.AppleScript Script interpreter: A program used to interpret and execute instructions in a AppleScript script. is a native program and an important part of the MAC system. Hereinafter referred to as the AppleScript script program.
Say and beep
Let's play two fun things first: Make your Mac pronounce and talk.
Enter the following script in the edit area:
" How is it ? " using " Zarvox " "Fine, thank you. " using " Victoria " "Ha ha" beep
Then click Run (Command + R run, Command +. Stop running)
" What to say " using " designate a person's voice "
The script is meant to let the Mac system say what we have specified in the voice of a designated person. Of course the using "..." can be the default.
Beep Number of voices
This script means to let the Mac system make a sound, the number of sounds determines the number of times, such as Beep 2 Mac will knock two times. The number of audible hits defaults to 1.
The reply output at run time means:
Tell shows that the tasks above say and beep are delivered to the current application, which is the AppleScript script.
Tell module
Similarly, we can use the Tell module to deliver specific tasks to specific programs in the Mac.
The syntax of the Tell module is:
" Application Name " <span style="white-space:pre"> </span> do your job here End Tell
For example, we want the finder to empty the trash and then open the disk, which can be written like this:
" Finder " Empty the trash beep Open the startup disk End Tell
Note that the double quotation marks of the "Finder" are necessary.
AppleScript script Learning record "II"