File: applescript

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (57 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- Multi-word commands
do shell script "date"
display dialog "Does this work?"

-- Some special kind of syntax for builtins
«NoIdea»

-- Multi-word constant
set text item delimiters to "|"

-- Types and properties
tell application "iTunes" to get current selection
get character 5 from "abcdefghij"

-- Multi-word keyword (greater than)
if 5 is greater than 4 then
  set thing to 6
end if

-- "return" as a constant
set a to return & "abc" & return & "def" & linefeed & "ghi"

-- "return" as a command
return a

-- "return" as a command and constant
if 4 is less than 5 then
  return thing & return & a
end if

-- "return" inside string is properly identified
set c to "abc is not a
  return to def"

-- Multi-line string escaping
set b to "abc" & ¬
  return & "def"

-- Application dictionaries can redefine words
tell application "BBEdit" to set show tab stops to true

tell application "System Events"
    tell network preferences
        tell current location
            set aPPPoEService to a reference to (first service whose kind is 10)
            if exists aPPPoEService then
                connect aPPPoEService
            end if
        end tell
    end tell
end tell

set jp to "日本語"

set ru to "Русский"

jp & " and " & ru -- returns "日本語 and Русский"