AppleScript script Learning record "II"

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.