Programming Help by Programmer`s hub

AppleScript Programming language

Applescript is a scripting language created by Apple Inc. and build in to the Macintosh operating systems. Applescript provide more features than the AppleEvent. AppleEvent is used to transfer the data between the application of Macintosh operating systems to automate the repetitive task but AppleScript provide extra features e.g. basic calculations, text processing. AppleScript have some of the features of Object oriented programming and natural programming languages but not strictly follow the features of both these languages. AppleScript is used to create the scriptable applications. Scriptable applications are those which are controlled by the scripts.  For AppleScript, that means being responsive to inter application messages, called Apple events, sent when a script command targets the application.

AppleScript programming code example

{`

display alert "Hello, world!" buttons {"Rudely decline", "Happily accept"}

set theAnswer to button returned of the result

if theAnswer is "Happily accept" then

	beep 5

else

	say "Piffle!"

end if

`}

...

Basic data classes

  • File system
    • alias - The alias will maintain its link to the object if the object is moved or renamed.
    • file- This is a static reference, and can point to an object that does not currently exist.
    • POSIX file- a reference to a file system object (file or folder) in plain text, using Unix style notation.
  • Basic objects
    • application- an application object, used mostly as a specifier for tell statements
    • script- a script object. Script objects are containers for scripts
    • className- a meta-object that specifies the type of other objects
    • reference- a persistent, indirect pointer to a different object