他のアプリケーションにメッセージを送る
tell application "Safari"
set hoge to URL of document 1
end tell
オブジェクト
文書(document),段落(paragraph)、文字列(word)、文字(character)等
オブジェクトにメッセージを送る
メッセージ オブジェクト
オブジェクトのプロパティ
hoge of document
document's hoge
オブジェクトのindexによる指定
document 3
オブジェクトの名前による指定
document "hoge.txt"
階層構造にあるオブジェクトの指定
paragraph 2 of document 1
オブジェクトの作成
make new
オブジェクトの詳細
コメント
--hoge
(* hoge *)
変数
大文字小文字の区別なし
代入
set foo to "a"
set foo to 1
配列
set hogelist to {}
set hogelist to item 4 of hogelist
count of hogelist
characters of "hoge"
{"h","o","g","e"}
set hogeText to text 3 thru 5 of "abcdefg"
文字列
"hoge" & "hogehoge"
the length of "hoge"
制御
繰り返し
repeat with i from 1 to 5 by 1
end repeat
関数
on hoge(a,b,c) --括弧はいるらしい
return a
end hoge
色々な関数
ログ出力
log "opi" & hoge
遅らせる
delay 5
クリップボードの値
set hoge to the clipboard
set the clipboard to hoge as string
ダイアログ表示
display dialog "aa"
アプリで呼べるAPIを調べる。
AppleScriptエディタで「用語の説明」から見れる。
ハンドラ
ドロップで実行される
on open(hoge)
end open
終了時に実行
on quit
end quit
10秒毎に実行
on idle
return 10
end idle
スクリプトオブジェクト
オブジェクトの関数の呼び出し
hoge() of myScriptObj
オブジェクトの定義
script myScriptObj
property foo
on hoge()
end hoge
end script
継承
script myChildObj
property parent : myParentObj
end script
自動継承
hoge() of myScriptObj
on hoge()
end hoge
script myScriptObj
end script
インスタンス作成
copy myScriptObject to huga
hoge() of huga
最終更新:2011年12月05日 15:10