2021-03-08 01:25:16 +00:00
|
|
|
#!/usr/bin/env scpt
|
|
|
|
|
2021-03-01 21:43:10 +00:00
|
|
|
set y to (display-dialog "Hello" with title 12 with type "yesno")
|
|
|
|
display-dialog "Goodbye" with title 21 with type "error"
|
|
|
|
do-shell-script "notify-send Test Notification"
|
2021-03-02 00:44:33 +00:00
|
|
|
do-shell-script {"echo " + (display-dialog {"Test " + "2"} with title 30 with type "entry" with default "text")}
|
2021-03-01 21:43:10 +00:00
|
|
|
set x to $y
|
2021-03-02 03:43:06 +00:00
|
|
|
|
|
|
|
if {3 == 3} {
|
|
|
|
set x to "hi"
|
|
|
|
do-shell-script {"echo " + $x}
|
|
|
|
display-dialog "3 is equal to 3!" with title "New Discovery" with type "info"
|
|
|
|
if {3 == 4} {
|
|
|
|
display-dialog "What? Why is 3 equal to 4?" with title "What?!" with type "error"
|
|
|
|
do-shell-script "echo hi"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-02 04:18:52 +00:00
|
|
|
repeat 5 times { z in
|
2021-03-02 08:33:55 +00:00
|
|
|
print $z
|
2021-03-03 08:27:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print (str 10.5)
|
|
|
|
|
|
|
|
if (bool "true") {
|
|
|
|
print "True"
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
This is a multiline comment
|
|
|
|
###
|
|
|
|
|
2021-03-05 03:30:08 +00:00
|
|
|
# This is a single line comment
|
|
|
|
|
2021-03-08 01:25:16 +00:00
|
|
|
set hi to ["test", 3]
|
2021-03-05 03:30:08 +00:00
|
|
|
|
2021-03-08 01:25:16 +00:00
|
|
|
set hi[0] to "test2"
|
2021-03-05 03:30:08 +00:00
|
|
|
|
|
|
|
print $hi[0]
|
|
|
|
|
|
|
|
set hi to (append $hi with items [5, 4])
|
|
|
|
|
|
|
|
print {$hi[2] + $hi[3]}
|
|
|
|
|
|
|
|
set msi to [5: "hi", "hello": "world"]
|
|
|
|
set msi[5] to "hello"
|
|
|
|
print $msi[5]
|
|
|
|
print $msi["hello"]
|
|
|
|
|
|
|
|
set c to 0
|
|
|
|
set f to true
|
|
|
|
loop while $f {
|
|
|
|
set c to {$c + 1}
|
|
|
|
if {$c == 3} {
|
|
|
|
set f to false
|
|
|
|
}
|
|
|
|
print {"iter: " + (str $c)}
|
|
|
|
}
|
|
|
|
|
2021-03-08 01:25:16 +00:00
|
|
|
repeat 6 times { i in
|
|
|
|
print {"brktest: " + (str $i)}
|
|
|
|
if {$i == 3} {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
print {"brktest: " + (str $i) + " (2)"}
|
|
|
|
}
|
|
|
|
|
2021-03-05 03:30:08 +00:00
|
|
|
define hi {
|
|
|
|
print {"Hello, " + $_args[""]}
|
2021-03-08 01:25:16 +00:00
|
|
|
return {"Hello, " + $_args[""]}
|
|
|
|
print "Something isn't right"
|
2021-03-05 03:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hi "Function"
|
2021-03-08 01:25:16 +00:00
|
|
|
set f to (hi "World")
|
|
|
|
print {"Returned: " + $f}
|