パソコンとの付き合いは20年以上。最初はWindowsを使っていたが、務めていたソフトウェア開発会社…
北欧好きが、愛用の北欧モノを見せ合うコミュニティ
Mac OS 関連情報
更新日:2003年04月13日
AppleScript でのスケジュールの作成と言う意味で、iCal を利用した「タイムカード」を作ってみました。
「Mac でしかできないこと」ってなんだろう・・・で単純に思い付くのは、“AppleScript”です。対応ソフトは限られますが、対応しているソフトであれば、同じ書式でいろんな作業の自動化ができます。
今回は、そんな自動化をいろいろ紹介してみたいと思います。
iCal でタイムカード?
iCal も当然、AppleScript 対応です。なんせ、スケジュールをメール送信したりするしくみは、iCal のパッケージに含まれるAppleScriptにより動作しています。
今回は、AppleScript でのスケジュールの作成と言う意味で、「タイムカード」を作ってみました。まずは、“iCal” と “スクリプトエディタ”(/Applications/AppleScript 以下) を起動して準備オッケーです。
※この記事は、Mac OS X 10.2.5 と iCal 1.0.2 で動作確認しています。
スケジュール作成の基本形
まずは、ベースとなるスクリプトを考えてみましょう。以下のスクリプトがスケジュール作成の基本形になります。試しに書き込んで実行してみて下さい。
|
set
sum1
to
"スケジュールの見出し" set startDate to date "2003年 4月 14日 月曜日 0:00:00 PM" copy startDate to endDate set time of endDate to ((time of endDate ) + 5) tell application "iCal" make event at end of events of calendar 1 with properties {sequence :0, summary :sum1 , start date :startDate , end date :endDate } end tell |
|
on
makeEvent
(sum1
, startDate
) copy startDate to endDate set time of endDate to ((time of endDate ) + 5) tell application "iCal" make event at end of events of calendar 1 with properties {sequence :0, summary :sum1 , start date :startDate , end date :endDate } end tell end makeEvent |
|
on
run
set startDate to current date set sum1 to "開始" makeEvent (sum1 , startDate ) of me end run on quit set startDate to current date set sum1 to "終了" makeEvent (sum1 , startDate ) of me continue quit end quit on makeEvent (sum1 , startDate ) copy startDate to endDate set time of endDate to ((time of endDate ) + 5) tell application "iCal" make event at end of events of calendar 1 with properties {sequence :0, summary :sum1 , start date :startDate , end date :endDate } end tell end makeEvent |
関連キーワード[PR]
人気Mac OSの使い方ランキング
Powered by 価格.com
北欧好きが、愛用の北欧モノを見せ合うコミュニティ
関連キーワード[PR]