Movable Type on Leopard - AppleScript から制御する。

| コメント(0) | トラックバック(0)

Mac OS X Leopard のAppleScriptが密かに面白い。
単なるOS Xネイティブなアプリケーションだけでなく例えば Movable Type 4.1 のようなソフトウェアを扱えるようになっているようだ(用語辞書、誰が書いたんだろう?)。

エントリーをブログに登録して再構築するスクリプトの例


tell application "Movable Type 4.1"
activate
set obj to new entry with property
{ title : "Welcome to Movable Type4!",
text : "New design launched using Movable Type.",
status : 2,
author : 1 }
set blog to item 1 of mt_blog
set result to save obj in blog
rebuild result without index archive
end tell

まぁ、ここまでなら素直にPerlで書けよ! ってなことになるけれど、以下の例なんかどうだ?

Excelと連携させる


tell application "Movable Type 4.1"
activate
set blog to item 1 of mt_blog
set entries to get entries of blog
set i to 1
repeat with entry in entries
tell application "Microsoft Excel"
tell document 1
set cell1 to "A" & i
set cell2 to "B" & i
set text of range cell1 to (title of entry)
set text of range cell2 to (permalink of entry)
set i to i + 1
end tell
end tell
end repeat
end tell

エントリーのタイトルとURLをExcelにそのまま渡してセルにセットしている。Excelからエントリーをインポートの方がニーズはありそうだけど。





嘘! 嘘です。すいません、もうしませんって言ったのに...一年に一度だし...また書いてしまいました。あんまり覚えてないや、AppleScript。(てかLeopardのマシンないし!)

それでも、


do shell script "./tools/run-periodic-tasks"

ってのは普通に使えるかもね。Excelから値をひっぱってシェル経由でPerlスクリプトに渡せばいいわけか。いや、できんことないよな。意味があるかどうかわからんけど。

トラックバック(0)

トラックバックURL: http://junnama.alfasado.net/mt5/mt-tb.cgi/102

コメントする

ウェブページ

OpenID対応しています OpenIDについて
Powered by Movable Type 5.04

このブログ記事について

このページは、Junnama Nodaが2008年4月 1日 13:08に書いたブログ記事です。

ひとつ前のブログ記事は「WordPressのプラグインをDrag & DropでMovable Typeのプラグインに変換するREALbasic製アプリケーション(Mac/Win/Ubuntsu対応)。」です。

次のブログ記事は「Web屋たるもの、自社のサイトくらいちゃんとしなくてどうするよ。」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。