AppleScript

AppleScript is a scripting language from Apple, which is a part of Mac OS. AppleScript is used to automate Mac OS programs to expand and remotely within a computer network.

The first version of AppleScript based on the HyperCard project. HyperCard involved with the scripting language Hyper talc -based English language scripting language. This is AppleScript programs for people who can not program, relatively easy to understand.

Language syntax

Apple has traditionally set a goal to spread easy to use computer and software. In this philosophy Apple AppleScript has developed so that it is adapted to the natural English language.

The call to an object-oriented method is done by AppleScript as follows:

Character 1 of item 2 of {" one", "two", "three" } In German it would read like this:

Characters 1 of element 2 {" one", "two", "three" } In "ordinary" languages ​​such as Java, however, as follows:

String [ ] x = {" one", "two", "three" }; y = x.charAt char (0); It is here seen that Apple is trying to set AppleScript on the basis of the English language and not to follow the trend of traditional programming languages.

Cross-application communication

AppleScript is primarily used to " remotely control " other programs from within a program. Mac OS offers Apple events, a cross- application communication protocol, with which it is possible to send messages from one application to another application, so that it behaves as desired.

So you can for example instruct from a script, an application to open a specific document. With the word " tell" such a message is sent eg to Word:

Tell application "Microsoft Word"      open file " thesis " of folder "Documents" of disk "studying" end tell In German:

Sage application "Microsoft Word "     Open file " thesis " of folder "Documents" from drive "studying" end Sage AppleScript to automate

AppleScript has been designed not only for cross-application tasks. It may, inter alia, also be used to automate frequently recurring tasks or have them perform calculations. An example:

Set to 72 pix set answer to text returned of ( display dialog "Enter the length in inches " default answer "1") display dialog answer & " in =" & ( answer * pix ) & " px" In German it would read like this:

Set to 72 pixels set answer to text returned of ( display dialog " Enter the length in inches is a " default answer "1") show dialog response & " in =" & (answer * pixels) & "pixel" It displays a dialog box and asks for the length in inches. It will then calculate how many pixels will give it to this length. A second dialog box will display the result.

AppleScript dialects

Apple could even extend for a short time AppleScript so that you did not have to write the scripts in English mandatory. You should write the scripts in their own native language. So the script terminology was translated into French, Japanese and Italian and Mac OS could translate them from one dialect to another dialect. While this worked, but the developers of Macintosh software (outside of Apple) supported multilingualism AppleScript because of the great expense only inadequate. Since the support was cumbersome, this idea was not pursued further in Mac OS 8.5 and higher.

72944
de