GameSprit

自転車やMac・AppleScript、映画・小説やドラマのレビュー、備忘メモ・クイズなどを置いています。

AppleScript でテキストエディットを操作する

2006-11-16 22:07:32 | AppleScript
AppleScript でテキストエディットを操作してみます。

まずはテキストエディットの新しいウィンドウを開いてみます。

tell application "TextEdit" to make new document



開いたウィンドウのタイトルをつけてみます。

tell application "TextEdit" to make new document
tell application "TextEdit" to set name of front window to "かちかち"



その新しいウィンドウの中に『 Hello, script! 』と表示させてみます。

tell application "TextEdit" to make new document
tell application "TextEdit" to set name of front window to "かちかち"
tell application "TextEdit" to set text of front document to "Hello, script!"



もう少し遊んでみます。

tell application "TextEdit"
activate
make new document at beginning of documents
set name of front window to "かちかち"
set text of front document to "Hello"

delay 2
set text of front document to "Hello, s"
delay 1
set text of front document to "Hello, sc"
delay 1
set text of front document to "Hello, scri"
delay 1
set text of front document to "Hello, scrip"
delay 1
set text of front document to "Hello, script"
delay 1
set text of front document to ""
delay 1
set text of front document to "Hello, script!"
delay 1
set text of front document to ""
delay 2
set text of front document to "Hello, script!!"

end tell


-- Mac OS X 10.4.8 on Intel mac mini



TextEditを触ってみる
命令作ってラクしよう
おもろい、めずらしいアップルスクリプト発表会 6
Application Architecture: Scripting





最新の画像もっと見る

post a comment

ブログ作成者から承認されるまでコメントは反映されません。