var	ShowString = 'Show content &gt;&gt;';
var	HideString = '&lt;&lt; Hide content';
var	HidePlace = 'bottom';
var	HideLineFeed = 1;
var	GotoEntryOnHide = 1;
var	CategoryUUID;
var	OnUnyoOpen;
var	OnUnyoClose;

if (location.pathname.match(/\/(C\d+)\/index\.html$/)) {
	CategoryUUID = RegExp.$1;
}
else if (location.pathname.match(/\/(C\d+)\/$/)) {
	CategoryUUID = RegExp.$1;
}

function ShowLink(divID, entryUUID) {
	var	entryURL = entryUUID+'/index.html';
	var	action = 'return !ShowEntryBody(\''+divID+'\', \''+entryUUID+'\');';

	return '   <a href="'+entryURL+'" onclick="'+action+'" onkeypress="'+action+'">'+ShowString+'</a>\n';
}

function WriteUnyo(entryUUID) {
	var	divID = 'Unyo'+entryUUID;

	document.write(
		'<div id="'+divID+'">\n',
		ShowLink(divID, entryUUID),
		'</div>\n'
	);

	return true;
}

function ShowEntryBody(divID, entryUUID) {
	if (!document.getElementById) {
		return false;
	}

	var	text = '';
	var	url = '#' + entryUUID;
	var action;

	if (GotoEntryOnHide) {
		action = 'HideEntryBody(\''+divID+'\', \''+entryUUID+'\'); return  true;';
	}
	else {
		action = 'return !HideEntryBody(\''+divID+'\', \''+entryUUID+'\');';
	}

	if (HidePlace == 'top') {
		text += '<a href="'+url+'" onclick="'+action+'" onkeypress="'+action+'">'+HideString+'</a>';
		if (HideLineFeed) {
			text += '<br />\n';
		}
		else {
			text += '\n';
		}
	}
	text += EntryBody[entryUUID];
	if (HidePlace == 'bottom') {
		if (HideLineFeed) {
			text += '<br />';
		}
		text += '<a href="'+url+'" onclick="'+action+'" onkeypress="'+action+'">'+HideString+'</a>\n';
	}

	document.getElementById(divID).innerHTML = text;

	if (OnUnyoOpen) {
		OnUnyoOpen(CategoryUUID, entryUUID);
	}

	return true;
}

function HideEntryBody(divID, entryUUID) {
	if (!document.getElementById) {
		return false;
	}

	document.getElementById(divID).innerHTML = ShowLink(divID, entryUUID);

	if (OnUnyoClose) {
		OnUnyoClose(CategoryUUID, entryUUID);
	}

	return true;
}

var	EntryBody = new Array;

EntryBody['E20070815123455'] = '<div><br /><p class="firstParagraph">\nスクリプトは以下のようになります。\n</p>\n<form action="index.html"><textarea accesskey="X" tabindex="100" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="70" rows="20">\nproperty search_word : &quot;&quot;\n\ndisplay dialog &quot;Enter search word&quot; default answer search_word buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button 2\ncopy the result as list to {text_returned, button_pressed}\n\nset search_word to text_returned\nset theURI_1 to &quot;http://www.google.com/search?q=&quot; &amp; text_returned &amp; &quot;+site:ja.wikipedia.org/wiki&quot;\nset theURI_2 to &quot;http://ja.wikipedia.org/wiki/&quot; &amp; text_returned\n\ntell application &quot;System Events&quot;\n	open location theURI_1\n	open location theURI_2\nend tell\n</textarea></form>\n<p>\nこれをスクリプト形式で、ユーザ/ライブラリ/Scripts に保存します。スクリプトメニューから実行すると、ダイアログが表示されますので、検索したい単語を入力します。\n</p>\n例えば、検索単語として Macintosh と入力すると、\n<ol>\n<li><a href=\'http://www.google.com/search?q=Macintosh+site:ja.wikipedia.org/wiki\' title=\'『Macintosh site:ja.wikipedia.org/wiki - Google 検索』へのリンクをこのウインドウで開く\'>ウィキペディア日本語版内で Macintosh の含まれるページを検索した Google の検索結果</a></li>\n<li><a href=\'http://ja.wikipedia.org/wiki/Macintosh\' title=\'『Macintosh - Wikipedia』へのリンクをこのウインドウで開く\'>ウィキペディア日本語版でMacintoshについて記述したページ</a></li>\n</ol>\nの２つのページがタブ（またはウインドウ）で開かれます。\n<p>\nダイアログを表示して、入力された単語をあらかじめ設定した文字列と組み合わせて開く、という単純なスクリプトです。Safari と Camino でしか検証していませんが、URI を開く際に System Events を利用しているので、デフォルトブラウザで利用できるという点が便利かなと思います。\n</p></div>\n';

EntryBody['E20070405224834'] = '<div><br /><p class="firstParagraph">\n後述のスクリプトを（ユーザ）／ライブラリ／Scripts フォルダに保存して、アドレスブック.app などで電話番号を選択した状態でスクリプトメニューから実行すれば、どのアプリケーションからでも利用できます。\n</p>\n\n<p>\n090、080、050 など３桁目が "0" の番号は、携帯、PHS,IP 電話として「09011112222」を「090 1111-2222」の形式に変更します。\n</p>\n\n<p>\n0594、03、045、0120、など３桁目が "0" でない番号は、「0123121234」を「0123 12-1234」の形式に変更します。この場合、すべてを４桁市外局番に変更してしまうわけです。2桁市外局番や３桁市外局番への対応が必要な場合、または「(0123) 456-789」などの表現形式が必要な場合は、Script を改造してください。（私には必要なかったので… ）\n</p>\n<form action="index.html"><textarea accesskey="X" tabindex="100" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="70" rows="70">\n(* Copyrihgt (C) 2007 kaoru arimura *)\n\n-- 全体の delay time 設定（秒）\nproperty the_time : 0.5\n\n-- 最前面のアプリを最前面にする処理\ntell application "System Events"\n	set theFrontApp to name of (path to frontmost application)\nend tell\ntell application theFrontApp to activate\ndelay the_time\n\n-- 選択範囲をコピー\ntell application "System Events"\n	keystroke "c" using command down\nend tell\ndelay the_time\n\n-- クリップボードの内容を取得\nget the clipboard\nset the_num to the result\nset the_rep_num to ""\n\n-- 電話番号の 3 桁目が "0" なら携帯番号として処理\nif character 3 of the_num is "0" then\n	repeat with i from 1 to 3\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\n	\n	set the_rep_num to the_rep_num & " "\n	\n	repeat with i from 4 to 7\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\n	\n	set the_rep_num to the_rep_num & "-"\n	\n	repeat with i from 8 to 11\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\nend if\n\n-- 電話番号の 3 桁目が "0" 以外なら加入電話番号として処理\nif character 3 of the_num is not "0" then\n	repeat with i from 1 to 4\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\n	\n	set the_rep_num to the_rep_num & " "\n	\n	repeat with i from 5 to 6\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\n	\n	set the_rep_num to the_rep_num & "-"\n	\n	repeat with i from 7 to 10\n		set the_rep_num to the_rep_num & (item i of the_num)\n	end repeat\nend if\n\nset the clipboard to the_rep_num\n\n-- 選択範囲にペースト\ntell application "System Events"\n	keystroke "v" using command down\nend tell\n</textarea></form></div>\n';

EntryBody['E20070104020742'] = '<div><br /><p class="firstParagraph">\n私は System 7 上で動いた「<a href="http://www.kaleidoscope.net/greg/browser.html" title="Link to [Greg\'s Browser]">Greg\'s Browser</a>」以来のカラム表示ファンです。階層をキーボードでたどるのが簡単だし、パスを把握しやすいところがいいのです。\n</p>\n<p>\nそこで、Finder ではいつも２つのカラム表示にしたウインドウを開いています。ファイルの移動／コピーは、この２つのウインドウ間でドラッグ＆ドロップするわけです。\n</p>\n<p>\n以下のスクリプトをスクリプトメニューから実行すると、いい感じで2枚のウインドウがタイル状に上下で並びます。（３枚以上のウインドウがすでに開かれている場合は、それらが上下に並びます）\n</p>\n<form action="index.html"><textarea accesskey="X" tabindex="100" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="70" rows="37">\ntell application "Finder"\n	\n	(*最低でも2枚のウインドウがないと使う意味がないから*)\n	repeat\n		if number of window ≧ 2 then exit repeat\n		make new Finder window\n	end repeat\n	\n	(*デスクトップの幅、高さを得る*)\n	set the_screen_size to bounds of window of desktop\n	set the_window_width to item 3 of the_screen_size\n	set the_window_height to (item 4 of the_screen_size) - 21 - 29\n	\n	(*ウインドウの幅、高さを決定*)\n	set the_window_height to the_window_height / (number of windows)\n	set the_window_width to the_window_width * 0.75\n	\n	repeat with i from 1 to number of windows\n		tell window i\n			try\n				set current view to column view\n				set bounds to {0, the_window_height * (i - 1) + 21 + 23, the_window_width, the_window_height * i + 21}\n			on error\n				(*情報ウインドウなど、view を変更できないウインドウがあることにそなえて*)\n				display dialog "エラー：操作できないウインドウがあります" buttons {"Cancel"} default button 1 with icon caution\n			end try\n		end tell\n	end repeat\n	\nend tell\n</textarea></form>\n<p>\n以下の記事を参考にしました。<br />\n<a href="http://www.macosxhints.com/article.php?story=2006122713210062" title="Link to [macosxhints.com - Tile Safari windows via AppleScript]">macosxhints.com - Tile Safari windows via AppleScript</a>\n</p></div>\n';

EntryBody['E20061223131414'] = '<div><br /><p class="firstParagraph">\n出張から帰ってきました。出張先では、あいかわらずアンテナが立つかどうかギリギリの電波状況で、携帯を使ってネット接続してました。\n</p>\n<p>\n<a href=\'http://homepage.mac.com/kaoru_ari/iblog/C35549667/E20060102180530/index.html\' title=\'Link to [Mac と au 端末でインターネット接続]\'>以前のエントリ</a>で書いた通り、au 携帯でネットに接続する場合にはパケットサイズを変更したほうが効率が良いようです。そのためには\n</p>\n<form action="index.html"><textarea accesskey="X" tabindex="100" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="60" rows="2">\nsudo sysctl -w net.inet.udp.recvspace=32120\n</textarea></form>\n<p>\nをターミナルから実行すればよいのですが、これをインターネット接続.app を起動することとともに、自動化しようと思いつきました。\n</p>\n<p>\nパスワードの入力が必要な sudo コマンドを実行するためには、\n</p>\n<form action="index.html"><textarea accesskey="Y" tabindex="101" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="60" rows="2">\ndo shell script "sudo ~" password "PASSWORD" with administrator privileges\n</textarea></form>\n<p>\nとすればよいのですが、パスワードをスクリプトの中に埋め込むのは気持ちよくありません。これは、毎回入力を求めたほうがいいでしょう。\n</p>\n<p>\nAppleScript から実行するなら、Finder あたりに display dialog させてパスワードを入力させるステップを組むのですが、Automator を使えば簡単にスクリプトを組むことができます。\n</p>\n<h4>\n作り方\n</h4>\n<ol>\n<li>ライブラリ／テキストエディットの「テキストの入力を求める」アクションをワークフローエリアに追加し、「質問」を「管理者のパスワードを入力してください」。「回答を必須にする」チェックボックスを ON。</li>\n<li>ライブラリ／Automator の「AppleScript を実行」を追加し、内容を後述のスクリプトにする。</li>\n<li>「アプリケーションを起動」などの、必要なアクションを追加する。</li>\n</ol>\n<p>\nパケットサイズを変更する場合なら、スクリプトは\n</p>\n<form action="index.html"><textarea accesskey="Z" tabindex="102" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="60" rows="6">\non run {input}\n	\n	do shell script "sudo sysctl -w net.inet.udp.recvspace=32120" password input with administrator privileges\n	\nend run\n</textarea></form>\n<p>\nとなります。\n</p>\nこれをスクリプトメニューから実行できるように保存すれば OK。Automator と AppleScript を組み合わせれば、こまかいことを気にせずに自動化できるのはいいね。</div>\n';

EntryBody['E20061217172826'] = '<div><br /><p class="firstParagraph">\n１０月末から現在まで、ずうっと出張中です。その間、自宅に戻ったのは二回、日数にしてわずか６日間。家族にとっては単身赴任と変わりませんね。\n</p>\n<p>\n出張から帰ってくると、会社に業務関係の書類を提出します。出張旅費精算書、出張報告書、客先に出す見積書、見積の明細書、経費の内訳…。すべて A4 １枚に収まるサイズで作られた書類ですが、全部で５〜６枚になってしまいます。ほとんどを MS Excel で作成して、会社の PC でプリントアウトしたり、自宅から Mac の『PDF をファクス…』機能を使って送信したりしています。\n</p>\n<p>\n会社の PC で印刷する場合、Mac で作成したファイルを直接 PC に移すと日付がずれるので、Mac 側で PDF に変換してから読み込ませています。\n</p>\n<p>\n自宅から FAX する場合も、PDF を経由することになるのですが、書類ごとに送信する必要があるので、けっこうめんどうです。\n</p>\n<p>\n複数の PDF ファイルを１つのファイルにまとめることができれば楽だな、と思っていたら、Automator で簡単にできました。\n</p>\n<h4>\n作り方\n</h4>\n<p>\nAutomator を起動し、右側のワークフローエリアに以下のアクションをライブラリから追加していきます。\n</p>\n<ol>\n<li>「選択された Finder 項目を取得」</li>\n<li>「PDF ページを結合」</li>\n<li>「プレビューでイメージを開く」</li>\n</ol>\n<p>\n注意すべきは、３番目の「プレビューでイメージを開く」はライブラリのアプリケーション＞プレビューにあるものではなく、サンプルワークフローの「Process Images」にあるものを使うという点です。前者は入力が<br/>\n<span style="color: blue;">\n入力:(イメージファイル) イメージファイル\n</span><br/>\nであるのに対し、後者は<br/>\n<span style="color: blue;">\n入力: (ファイル／フォルダ) イメージファイル\n</span><br/>\nと、なぜか別の動作をするからです。ちなみに、２番目の「PDF ページを結合」の結果は<br/>\n<span style="color: blue;">\n結果: (PDF ファイル) 新規に作成された PDF 書類への参照\n</span><br/>\nなので、アプリケーション＞プレビューにある「プレビューでイメージを開く」では、アクションがつながりません。\n</p>\n<p>\n作成したワークフローをホーム＞ライブラリ＞Scripts フォルダにワークフロー形式で保存してスクリプトメニューから実行するか、アプリケーション形式で保存して Dock から起動するようにします。\n</p>\n<h4>\n使い方\n</h4>\n<p>\nFinder で結合したい複数の PDF ファイルを選択してからワークフローを実行すると結合された状態でプレビュー表示されますから、プリント / FAX するなり、保存するなりご自由に。\n</p>\n<p>\n<p>\nこのワークフローの欠点は、Finder で選択されたファイルが PDF かどうかを判定しないことです。複数の Finder ウインドウを開いて作業していると、関係のないファイルまで選択した状態になっていることがあります。処理自体は PDF 以外のファイルを無視して終了しますが、ユーザの選択ミスに対してなんのフィードバックもないというのは気に入りません。\n</p>\n<p>\n私はワークフローの先頭に Automator のアクション「AppleScript を実行」を置いて、そこに\n</p>\n<form action="index.html"><textarea accesskey="X" tabindex="100" onfocus="this.select();" onclick="this.select();" onkeypress="this.select();" readonly="readonly" cols="60" rows="15">\non run\n	\n	tell application "Finder"\n		set the_target to the selection\n		repeat with i from 1 to the number of the_target\n			get the name extension of item i of the_target\n			if the result is not "pdf" then\n				display dialog "選択されたファイル（の一部）が PDF ではありません。" buttons {"Cancel", "OK"} default button 2 with icon note\n			end if\n		end repeat\n	end tell\n	\nend run\n</textarea></form>\n<p>\nというスクリプトを入れています。これで、PDF 以外のファイルが選択されていたら教えてくれるというわけです。\n</p>\n<h4>\nAutomator の Tips\n</h4>\n<p>\n作成したワークフローをワークフロー形式でホーム／ライブラリ／Workflows フォルダ（なければ作成して）に保存するとライブラリの「マイワークフロー」に表示されます。\n</p>\n<p>\nこの Workflows フォルダのエイリアスを Scripts フォルダに入れると、スクリプトメニューから実行できます。ワークフロー形式で保存したファイルをスクリプトメニューから実行する方法は、アプリケーション形式で保存したワークフローを起動して使うよりも手軽です。\n</p>\n<p>\noption キーを押した状態でスクリプトメニューからワークフローを選択すると、内容を編集することができます。AppleScript と同じですね。\n</p></div>\n';

EntryBody['E20060506013809'] = '<div><br /><p class="firstParagraph">\n<!-- <img src="E20060506013809/Media/ProcessSpy.jpg" height="314" width="490" alt="" /> -->\n<img src="E20060506013809/Media/ProcessSpy.jpg" height="314" width="490" alt="ProcessSpy window image" style="border:none" />\n</p>\n<p>\nウインドウの左側にアプリケーションを登録すると、右側に登録したアプリケーションが自動的に起動／終了します。\n</p>\n<p>\nこれが何の役に立つかというと…　とりあえず iTunes を起動したときに<a href=\'http://otolog.jp/\' title=\'Link to [音楽つながる - 音ログ.jp]\'>音ログ</a>コントローラを自動起動したいとか…　iBlog を使うときに <a href=\'http://www.juno.dti.ne.jp/~kokam/wsc/hpdrafter.html\' title=\'Link to [Project hpDrafter]\'>hpDrafter</a>を起動させたいとか。まぁ、そんなとこです。\n</p>\n<p>\nダウンロード (44KB) …　<a href="http://idisk.mac.com/kaoru_ari/Public/ProcessSpy010.zip">ProcessSpy011.zip</a><br />\n（こっそりバージョンアップしてます）\n</p>\n役に立ちそうだったら、ログイン項目に登録してくださいませ。</div>\n';

EntryBody['E20060122043222'] = '<div><br /><h4 class="H4">初期設定を保存／読み出す方法は？</h4>\n<p>\n<a href=\'http://kiwi-us.com/~mizusawa/\' title=\'Link to [penguin-19 home]\'>penguin-19</a>　さんの『<a href=\'http://kiwi-us.com/~mizusawa/penguin/html_hint/as_x/index.shtml#handles\' title=\'Link to [AppleScript for OS X]\'>AppleScript for OS X</a>』というページにズバリ書いてありました。<br />\nしかし、このハンドラを単独で使ったばあい、初期設定は ~/Libraly/Preferences/com.apple.ASApplication.plist の中に書き込まれます。このファイルは、AppleScript が共通して使う初期設定ファイルです。<br />\n独自の初期設定ファイルを作るなら、プロジェクトの Info.plist をPropertyList Editor で開いて、CFBundleIdentifier　の Value を例えば、jp.ddo.arimura.processspy などに変更してやります。これで、jp.ddo.arimura.processspy.plist という初期設定ファイルが作成されます。\n</p>\n<h4 class="H4">About ウインドウの MyCompanyName って…</h4>\n<p>\n新規プロジェクトを作成したときに設定したはずなのに、__ MyCompanyName__ のまま…<br />\nプロジェクトウインドウの Resources/InfoPlist.strings/English で変更。\n</p>\n<h4 class="H4">idle ハンドラは使える？</h4>\n<p>\nどこかで Xcode で作った AppleScript アプリケーションでは on idle ハンドラは使えないという記述を見たことがあるのですが、間違い。<br />\n掌田津耶乃さんの<a href=\'http://www.h5.dion.ne.jp/~tuyano/Tankoubon/X-AS.html\' title=\'Link to [AppleScript Programming for Mac OS X]\'>「AppleScript Programming for Mac OS X」追補情報</a>ページに解決方法が書かれています。\n</p>\n<blockquote>\n<ol>\n<li>MainMenu.nibをInterface Builderで開く。</li>\n<li>Nibファイルウィンドウで「File\'s Owner」を選択し、InfoウィンドウのAppleScriptを開く。</li>\n<li>Applicationの中に「idle」「open」の２つの項目がONになっていることを確認する。</li>\n<li>その下のスクリプトファイルのチェックがはずれているはずなのでONにする。</li>\n<li>すべて保存すれば完了。これできちんとイベントが機能するはずです。</li>\n</ol>\n</blockquote>\n<p>\n（注：上記は、ドロップレットについて書かれたものなので「open」にもチェックを入れるようにされています。また、Xcode2.0 に付属する Interface Builder では、Info ウィンドウというより、Inspector ウインドウと言った方がわかりやすいかも。\n</p>\n<h4 class="H4">日本語アプリケーション名は使える？</h4>\n<p>\nSystem Events を介してアプリケーションが起動しているか判定するのに、アプリケーション名の使い方でおかしなことになる。<br />\n<span style="color: blue;">exists</span> (<span style="color: blue;">application processes whose name is</span> <span style="color: green;">theTargetApp</span>)<br />\nとするなら、\n</p>\n<ul>\n<li><span style="color: green;">theTargetApp</span> が "テキストエディット" … ×</li>\n<li><span style="color: green;">theTargetApp</span> が "TextEdit.app" … ×</li>\n<li><span style="color: green;">theTargetApp</span> が "TextEdit" … ○</li>\n</ul>\n<p>\nアプリ名を<br />\n<span style="color: blue;">choose file with prompt</span> "Select target application" <span style="color: blue;">\nof type</span> {"APPL"} <span style="color: blue;">without invisibles</span><br />\nで選択して、<span style="color: green;">theStr</span> という変数に格納するなら、<br />\n<span style="color: blue;">set</span> <span style="color: green;">theStr</span> <span style="color: blue;">to short name of</span> (<span style="color: blue;">info for the result</span>)<br />\nとする。<br />\nちなみに、「テキストエディット」なら　<span style="color: blue;">displayed name</span>、「TextEdit.app」なら <span style="color: blue;">name</span> で OK。<br />\nこれは Xcode ではなく、AppleScript の仕様だけど。\n</p>\n<h4 class="H4">short name がないアプリはどうする？</h4>\n<p>\n上記の <span style="color: blue;">choose file ~</span> で <span style="color: blue;">short name</span> を得ようとすると、結果が &lt;null&gt; になるアプリケーションが存在します。（iCal など)<br />\n自作アプリの場合は、Info.plist を PropertyList Editor で開いて「CFBundleName」を追加、value を「ProcessSpy」などとすれば、それが short name になります。<br />\n自作でないアプリケーションも、この方法で short name を埋め込むことはできるけど…<br />\n<span style="color: blue;">display dialog</span> "" <span style="color: blue;">default answer</span> "" <span style="color: blue;">buttons</span> {"Cancel", "OK"} <span style="color: blue;">default button</span> 2<br />\nとして、タイプしてもらうほうがユーザーフレンドリーかな。\n</p>\n<h4 class="H4">display dialog の結果が逆？</h4>\n<p>\nスクリプトエディタで上記の text input ダイアログを表示した場合、つづけて<br />\n<span style="color: blue;">copy the result as list to</span> {<span style="color: green;">text_returned</span>, <span style="color: green;">button_pressed</span>}<br />\nとして、入力されたテキストを変数 <span style="color: green;">text_returned</span> に、押されたボタンを <span style="color: green;">button_pressed</span> に格納するのが常套手段だけど、これを Xcode 上の AppleScript でやると、なぜか <span style="color: green;">text_returned</span> に「OK」が、<span style="color: green;">button_pressed</span> に「iCal」が入ってしまうという謎。<br />\n<span style="color: blue;">copy the result as list to</span> {<span style="color: green;">button_pressed</span>, <span style="color: green;"> text_returned</span>}<br />\nとしときましょう。\n</p>\nそれにしても、がんばって検索しても情報が少ないなぁ。で、どんなアプリケーションを作ったかというと…　もう少しベータテストしてからにしときます(w</div>\n';

EntryBody['E20050622200025'] = '<div><br /><p class="firstParagraph">\n<a href="http://idisk.mac.com/kaoru_ari/Public/Google_Site_Search_2.1.scpt.zip"> ダウンロード：Google_Site_Search_2.1.scpt.zip </a> (8KB)\n</p>\n<p>\n＜使い方＞\n</p>\n<ol>\n<li>解凍してできあがった Google_Site_Search_2.scpt をホームフォルダ内のライブラリ/Scripts またはその中のサブフォルダ内に入れます。Safari または Firefox が最前面にあるときにしか動作しませんので、Scripts フォルダ内に Applications フォルダを作っている方は、その中の Safari または Firefox フォルダに入れておいてもいいかもしれません。両方のブラウザで動作させたいなら、片方のフォルダにはエイリアスを入れておくといいでしょう。</li>\n<li>UI Element Scripting 環境が必要になりますので、『This script needs UI Element Scripting.』というダイアログが出てしまった場合には『システム環境設定 → ユニバーサルアクセスペイン』で『補助装置を使用可能にする』チェックボックスをチェックしてください。</li>\n<li>Safari または Firefox でサイト内検索をしたいページを開いた状態で、スクリプトメニューから実行します。たとえばブログの場合、エントリページからスタートしても OK です。</li>\n<li>サイト内検索の対象にする URI がダイアログで示されますので、必要に応じて編集（URI を削る）してください。</li>\n<li>２番目のダイアログに検索語を入れます。複数の検索ワードを使う場合は、スペース区切りです。ただ、複数の検索語をクオーテイションマークでくくっておこなう「フレーズ検索」には対応していません。複数語の「and 検索」になってしまいます。</li>\n</ol>\n<p>\nFirefox の場合、AppleScript から URI を直接渡すと、日本語が文字化けしてしまいます。そのため、UI Element Scripting で Systen Events を操作して『URI をクリップボードに格納 → 新規タブ → URI 入力窓にペースト → リターンキー』という動作をさせています。そのため、Safari で動作させるよりもじゃっかん、もたつくかもしれません。\n</p>\n<p>\nこんなスクリプトになりました。\n</p>\ntell application "System Events"<br />\n&nbsp;&nbsp;if not (UI elements enabled) then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;tell application &quot;System Preferences&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;activate<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set current pane to pane &quot;com.apple.preference.universalaccess&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set dialog_message to &quot;Error: This script needs UI Element Scripting.&quot; &amp; return &amp; return &amp; &quot;Set it on Univesal Access pane.&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;display dialog dialog_message buttons &quot;Cancel&quot; default button 1 with icon caution<br />\n&nbsp;&nbsp;&nbsp;&nbsp;end tell<br />\n&nbsp;&nbsp;end if<br />\n&nbsp;&nbsp;<br />\n&nbsp;&nbsp;set the browser_name to &quot;&quot;<br />\n&nbsp;&nbsp;set the frontmost_application_name to displayed name of (path to frontmost application)<br />\n&nbsp;&nbsp;if frontmost_application_name is &quot;Safari&quot; then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the browser_name to &quot;Safari&quot;<br />\n&nbsp;&nbsp;else if frontmost_application_name is &quot;Firefox&quot; then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the browser_name to &quot;Firefox&quot;<br />\n&nbsp;&nbsp;else<br />\n&nbsp;&nbsp;&nbsp;&nbsp;activate<br />\n&nbsp;&nbsp;&nbsp;&nbsp;display dialog &quot;Error: Any Browser is not Frontmost.&quot; &amp; return &amp; return &amp; &quot;You must bring \\&quot;Safari\\&quot; or \\&quot;Firefox\\&quot; to frontmost Application.&quot; buttons {&quot;Cancel&quot;} default button 1 with icon caution<br />\n&nbsp;&nbsp;end if<br />\nend tell<br />\n--<br />\nif browser_name is &quot;Safari&quot; then<br />\n&nbsp;&nbsp;tell application &quot;Safari&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the url_for_search to the URL of document 1 as text<br />\n&nbsp;&nbsp;end tell<br />\nelse<br />\n&nbsp;&nbsp;tell application &quot;Firefox&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the url_for_search to «class curl» of window 1<br />\n&nbsp;&nbsp;end tell<br />\nend if<br />\n--<br />\nmy replaceText(url_for_search, &quot;http://&quot;, &quot;&quot;)<br />\nset the url_for_search to the result<br />\nset the number_of_search_words to number of items of url_for_search<br />\nrepeat with i from 1 to number_of_search_words<br />\n&nbsp;&nbsp;if item -i of url_for_search is &quot;/&quot; then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the minus_num to i<br />\n&nbsp;&nbsp;&nbsp;&nbsp;exit repeat<br />\n&nbsp;&nbsp;end if<br />\nend repeat<br />\nset the search_site to &quot;&quot;<br />\nrepeat with i from 1 to (number_of_search_words - minus_num)<br />\n&nbsp;&nbsp;set search_site to search_site &amp; item i of url_for_search<br />\nend repeat<br />\ndisplay dialog &quot;Edit URI&quot; default answer search_site buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button 2<br />\ncopy the result as list to {text_returned, button_pressed}<br />\nmy replaceText(text_returned, &quot;/&quot;, &quot;%2F&quot;)<br />\nset search_site to the result<br />\n--<br />\ndisplay dialog &quot;Enter search word(s)&quot; default answer &quot;&quot; buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button 2<br />\ncopy the result as list to {text_returned, button_pressed}<br />\nset word_num to the number of words of text_returned<br />\nrepeat with i from 1 to word_num<br />\n&nbsp;&nbsp;if i is 1 then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set search_word to word 1 of text_returned<br />\n&nbsp;&nbsp;else<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set search_word to search_word &amp; &quot;%20&quot; &amp; word i of text_returned<br />\n&nbsp;&nbsp;end if<br />\nend repeat<br />\n--<br />\nset the_uri to &quot;http://www.google.com/search?q=&quot; &amp; search_word &amp; &quot;+site%3A&quot; &amp; search_site<br />\n--<br />\nif browser_name is &quot;Safari&quot; then<br />\n&nbsp;&nbsp;tell application &quot;Safari&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;-- set the_uri to the_uri &amp; &quot;&amp;btnG=Google+検索&amp;lr=&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;open location the_uri<br />\n&nbsp;&nbsp;end tell<br />\nelse<br />\n&nbsp;&nbsp;tell application &quot;Firefox&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;activate<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the_uri to the_uri &amp; &quot;&amp;start=0&amp;start=0&amp;hl=ja&amp;lr=lang_ja&amp;ie=utf-8&amp;oe=utf-8&amp;client=firefox-a&amp;rls=org.mozilla:ja-JP:official&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set the clipboard to the_uri<br />\n&nbsp;&nbsp;&nbsp;&nbsp;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;tell application &quot;System Events&quot;<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delay 0.5<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keystroke &quot;t&quot; using command down<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delay 0.5<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keystroke &quot;v&quot; using command down<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keystroke return<br />\n&nbsp;&nbsp;&nbsp;&nbsp;end tell<br />\n&nbsp;&nbsp;end tell<br />\nend if<br />\n--<br />\non replaceText(targetStr, pre, pro)<br />\n&nbsp;&nbsp;set CurDelim to AppleScript\'s text item delimiters<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to pre<br />\n&nbsp;&nbsp;set targetStr to text items of targetStr<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to pro<br />\n&nbsp;&nbsp;set targetStr to targetStr as string<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to CurDelim<br />\n&nbsp;&nbsp;return targetStr<br />\nend replaceText</div>\n';

EntryBody['E20050619074651'] = '<div><br /><p class="firstParagraph">\n<a href="http://idisk.mac.com/kaoru_ari/Public/Google_Site_Search.bz2"> ダウンロード：Google_Site_Search.bz2 </a>\n</p>\n<p>\n＜使い方＞\n</p>\n<ol>\n<li>解凍してできあがった Google_Site_Search.scpt をホームフォルダ内のライブラリ/Scripts またはその中のサブフォルダ内に入れます。</li>\n<li>Safari でサイト内検索をしたいページを開いた状態で、スクリプトメニューから実行します。たとえばブログの場合、エントリページからスタートしても OK です。</li>\n<li>サイト内検索の対象にする URI がダイアログで示されますので、必要に応じて編集してください。</li>\n<li>２番目のダイアログに検索語を入れます。複数の検索ワードを使う場合は、スペース区切りです。ただ、複数の検索語をクオーテイションマークでくくっておこなう「フレーズ検索」には対応していません。複数語の「and 検索」になってしまいます。</li>\n</ol>\n<p>\n3. で示される URI は、たとえばこのブログ内のエントリページの場合、<br />\nhomepage.mac.com/kaoru_ari/iblog/C1308878031/E495390368<br />\nです。このまま実行すれば、エントリページ内での検索になります。意味がありませんね…<br />\nこれを編集して<br />\nhomepage.mac.com/kaoru_ari/iblog/C1308878031<br />\nとすればカテゴリ内検索に。<br />\nhomepage.mac.com/kaoru_ari/iblog<br />\nとすればブログ内検索に。<br />\nhomepage.mac.com/kaoru_ari<br />\nとすれば私のドメイン内での検索に。<br />\nhomepage.mac.com<br />\nとすれば、homepage.mac.com 全体での検索になるというわけです。\n</p>\n<p>\nスクリプトの中身はこうです。興味のある方は、読んでみてください。\n</p>\ntell application &quot;Safari&quot;<br />\n&nbsp;&nbsp;set the_url to the URL of document 1 as text<br />\n&nbsp;&nbsp;my replaceText(the_url, &quot;http://&quot;, &quot;&quot;)<br />\n&nbsp;&nbsp;set the_url to the result<br />\n&nbsp;&nbsp;set the_num to number of items of the_url<br />\n&nbsp;&nbsp;repeat with i from 1 to the_num<br />\n&nbsp;&nbsp;&nbsp;&nbsp;if item -i of the_url is &quot;/&quot; then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set the the_minus_num to i<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit repeat<br />\n&nbsp;&nbsp;&nbsp;&nbsp;end if<br />\n&nbsp;&nbsp;end repeat<br />\n&nbsp;&nbsp;set search_site to &quot;&quot;<br />\n&nbsp;&nbsp;repeat with i from 1 to (the_num - the_minus_num)<br />\n&nbsp;&nbsp;&nbsp;&nbsp;set search_site to search_site &amp; item i of the_url<br />\n&nbsp;&nbsp;end repeat<br />\n&nbsp;&nbsp;display dialog &quot;Edit URI&quot; default answer search_site buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button 2<br />\n&nbsp;&nbsp;copy the result as list to {text_returned, button_pressed}<br />\n&nbsp;&nbsp;my replaceText(text_returned, &quot;/&quot;, &quot;%2F&quot;)<br />\n&nbsp;&nbsp;set search_site to the result<br />\n&nbsp;&nbsp;--<br />\n&nbsp;&nbsp;display dialog &quot;Enter search word(s)&quot; default answer &quot;&quot; buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button 2<br />\n&nbsp;&nbsp;copy the result as list to {text_returned, button_pressed}<br />\n&nbsp;&nbsp;set word_num to the number of words of text_returned<br />\n&nbsp;&nbsp;repeat with i from 1 to word_num<br />\n&nbsp;&nbsp;&nbsp;&nbsp;if i is 1 then<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set search_word to word 1 of text_returned<br />\n&nbsp;&nbsp;&nbsp;&nbsp;else<br />\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set search_word to search_word &amp; &quot;%20&quot; &amp; word i of text_returned<br />\n&nbsp;&nbsp;&nbsp;&nbsp;end if<br />\n&nbsp;&nbsp;end repeat<br />\n&nbsp;&nbsp;--<br />\n&nbsp;&nbsp;open location (&quot;http://www.google.com/search?q=&quot; &amp; search_word &amp; &quot;+site%3A&quot; &amp; search_site)<br />\nend tell<br />\non replaceText(targetStr, pre, pro)<br />\n&nbsp;&nbsp;set CurDelim to AppleScript\'s text item delimiters<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to pre<br />\n&nbsp;&nbsp;set targetStr to text items of targetStr<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to pro<br />\n&nbsp;&nbsp;set targetStr to targetStr as string<br />\n&nbsp;&nbsp;set AppleScript\'s text item delimiters to CurDelim<br />\n&nbsp;&nbsp;return targetStr<br />\nend replaceText</div>\n';

EntryBody['E19955991'] = '<div><br /><p class="firstParagraph">\n参考にさせていただいたのは以下のページです。\n</p>\n<p>\n<a href=\'http://bbs.applescript.net/viewtopic.php?p=36947\' title=\'リンクをこのウインドウで開く\'>MacScripter BBS | Applescript Forums :: View topic - Firefox window title</a>\n</p>\n<p>\nで、できたスクリプトがこれ。\n</p>\n<blockquote>\ntell application &quot;Firefox&quot;<br />\n&nbsp;set the_title to «class pTit» of window 1<br />\n&nbsp;set the_uri to «class curl» of window 1<br />\n&nbsp;set the clipboard to &quot;&lt;<span style="display: none;">*</span>a href=¥&quot;&quot; &amp; the_uri &amp; &quot;¥&quot; title=¥&quot;『&quot; &amp; the_title &amp; &quot;』へのリンクをこのウインドウで開く¥&quot;&gt;&quot; &amp; the_title &amp; &quot;&lt;/a&gt;&quot;<br />\nend tell\n</blockquote>\n<p>\n『«』『»』はそれぞれ、『option + ]』『option + shift + ]』で入力できます。\n</p>\n<p>\nFirefox で開いているページのタイトルと URI が\n</p>\n<blockquote>\n&lt;<span style="display: none;">*</span>a href=&quot;{URI}&quot; title=&quot;『{タイトル}』へのリンクをこのウインドウで開く&quot;&gt;{タイトル}&lt;/a&gt;\n</blockquote>\n<p>\nのかたちでクリップボードに納められますので、そのまま iBlog にペーストできます。\n</p>\n<p>\n私は文章全体を &lt;HTMLCode&gt;~&lt;/HTMLCode&gt; でくくっていますので、上記のスクリプトでいいのですが、アンカータグ部分だけに &lt;HTMLCode&gt;~&lt;/HTMLCode&gt; 使いたい場合は４行目を\n</p>\n<blockquote>\n&nbsp;set the clipboard to &quot;&lt;HTMLCode&gt;&lt;<span style="display: none;">*</span>a href=¥&quot;&quot; &amp; the_uri &amp; &quot;¥&quot; title=¥&quot;『&quot; &amp; the_title &amp; &quot;』へのリンクをこのウインドウで開く¥&quot;&gt;&quot; &amp; the_title &amp; &quot;&lt;/a&gt;&lt;/HTMLCode&gt;&quot;<br />\n</blockquote>\nとするといいでしょう。</div>\n';

EntryBody['E845238686'] = '<div><br /><p style=\'margin-top: -2em;\'>\nこの問題に関しては、以前から賛否を耳にしていました。あらためてこの問題を考えるきっかけとなったのは、<a href="http://homepage.mac.com/travellers/blog/index.html" title="『Travellers Tale』をこのウインドウで開く">Hiro さん</a>の『<a href="http://homepage.mac.com/travellers/blog/C1910009118/E266876881/index.html" title="『Travellers Tale: リンクを新規ウインドウ／タブに開かない方法』をこのウインドウで開く">リンクを新規ウインドウ／タブに開かない方法</a>』というエントリと、そのエントリにトラックバックされた<a href="http://anonym.jp/appleshop/" title="『林檎はいかがですか？』をこのウインドウで開く">林檎はいかがですか？ さん</a>の『<a href="http://anonym.jp/appleshop/log/eid133.html" title="『林檎はいかがですか？ | リンクを新規ウインドウ／タブに開くのはいやですか？』をこのウインドウで開く">リンクを新規ウインドウ／タブに開くのはいやですか？</a>』というエントリでした。とくに、後者のコメント欄への書き込みには、アンカータグに対してさまざまな考え方があることがわかり、興味深いものでした。\n</p>\n<p>\n「リンクを新しいウインドウで開く」ことを「避けるべき」とする意見は、「<a href="http://jp.fujitsu.com/webaccessibility/v2/" title="『富士通ウェブ・アクセシビリティ指針 日本語サイト向け 第2.0版 : 富士通』をこのウインドウで開く">富士通ウェブ・アクセシビリティ指針 日本語サイト向け 第2.0版</a>」の「<a href="http://jp.fujitsu.com/webaccessibility/v2/34.html" title="『富士通ウェブ・アクセシビリティ指針 指針34 : 富士通』をこのウインドウで開く">指針34</a>」に集約されています。\n</p>\n<blockquote>\n必要以上に多くのウィンドウを開くと、サイトを表示している機器に負担がかかるため、コンテンツの表示速度が遅くなることがあります。<br />\nまた、視覚に障害のある利用者や高齢者など、多くの利用者は、新しいウィンドウが開いたことに気づかないか、または、その変化に戸惑う場合があります。このため、前のページを表示するなどの操作が困難になります。<br />\nさらに、多くのウィンドウが開いた場合、多くの不要なウィンドウを閉じなければならず、上肢に障害のある利用者を含む、多くの利用者は、操作が困難になります。\n</blockquote>\n<p>\n私の子供たちのウエブ閲覧スタイルを見ていると、\n</p>\n<ol>\n<li>新規ウインドウを開くアンカーをクリック</li>\n<li>新しく開いたウインドウ内の「ホームページに戻る」ボタンをクリック</li>\n<li>そこからまた新しいウインドウを開く</li>\n</ol>\n<p>\nという行為を繰り返して、いくつも同じページを開いていることがあります。これを見ると「新しいウインドウで開く」ことへの弊害を感じます。\n</p>\n<p>\n一方、「リンクを新しいウインドウで開く」ことに利便性を感じている人の多くは、「本流としてのページがあり、リンク先はその参照として開く」ということにあるように思います。<br />\nたしかに、新規ウインドウ（タブ）で開いた場合、スタートとなったページに戻りやすく、複数のページを行き来しながら閲覧するスタイルに向いています。\n</p>\n私自身、リンクを開く場合には新規タブでという閲覧スタイルなので、「target="_blank"」を多用してきました。多くのブラウザがステータスバーに「"〜" を新規ウインドウで開く」「"〜" を開く」と表示して、リンクの扱いを明示してくれるので、「後は閲覧者の判断にまかせよう」という考えもありました。\nしかし、最近使いだした Firefox では、そのような表示がありません。（私の設定のせい？）\nこれでは、閲覧者が事前にリンクの target を知ることができないので、唐突に新しいウインドウで開く事態が頻発してしまいます。\nそれならば、いっそのこと「（フォーム関係をのぞく）すべてのリンクを同じウインドウで開く」こととして、新規ウインドウ／タブを使うかどうかは閲覧者の判断に一任することにした方がすっきりしそうです。\n<p>\n現在、ページの更新をするたびに、少しずつ「target="_blank"」を減らしています。と同時に、 アンカータグの title 属性に「"〜をこのウインドウで開く"」という表現を盛り込んで、同一ウインドウ内でリンクが展開されることを少しでも明示しようとしています。ただ、このエントリ内で使っているような、title 属性とリンク先のテキストが重複する方法は、読み上げブラウザを使った場合に同じ文言が繰り返されてくどいそうなので、悩むところです。\n</p>\n<p>\n<a href="http://homepage.mac.com/kaoru_ari/iblog/index.html" title="『dark side of the moon』をこのウインドウで開く">dark side of the moon</a><br />\nマウスオーバ−してみてください。くどいですか？\n</p>\n<p>\nちなみに、上記のアンカータグは、AppleScript で自動生成しています。Safari 専用ですが。\n</p>\n<p>\ntell application &quot;Safari&quot;<br />\n&nbsp;set the_url to the URL of document 1<br />\n&nbsp;set the_title to the name of document 1<br />\n&nbsp;set the clipboard to &quot;&lt;<span style="display: none;">*</span>a href=¥&quot;&quot; &amp; the_url &amp; &quot;¥&quot; title=¥&quot;『&quot; &amp; the_title &amp; &quot;』をこのウインドウで開く¥&quot;&gt;&quot; &amp; the_title &amp; &quot;&lt;/a&gt;&quot;<br />\nend tell\n</p></div>\n';

EntryBody['E1564771797'] = '<div><br /><p style=\'margin-top: -2em;\'>\nこれはおもしろそうだ、ということでさっそく「<a href="http://homepage.mac.com/hitsu/iblog/C1032384277/E472356749/index.html" title="Gmailへ招待します " target="_blank">Gmailへ招待します </a>」というエントリを上げておられた <a href="http://homepage.mac.com/hitsu/iblog/" title="Hiro\'s Weblog" target="_blank">hitsu さん</a>に招待をお願いしました。\n</p>\n<p>\nファイルバックアップを簡単に実行する AppleScript は、上記の記事からさらにジャンプしたところで見つけた <a href="http://forums.macosxhints.com/index.php?" title="The macosxhints Forums - For discussing everything OS X..." target="_blank">The macosxhints Forums</a> の <a href="http://forums.macosxhints.com/showthread.php?t=31163" title="The macosxhints Forums - Mini-Hint: Automate backups to gmail using applescript" target="_blank">「Mini-Hint: Automate backups to gmail using applescript」</a>というスレッドの２番目の記事にある『G-mail Backup.scpt.zip』というものを使いました。こちらはファイルやフォルダのドロップに対応しています。\n</p>\n<p>\nまず、Gmail にメール送信するために Mail.app にGmail 用の POP アカウントを作成して設定をおこないます。このとき、アップロードしたファイルを自動的にダウンロードしてはいけないので『新規メールを自動的に受信するときに含める』のチェックは外しておきます。\n</p>\n<p>\nつぎに、G-mail Backup.scpt をスクリプトエディタで開いて<br />\nproperty username : "username" --gmail username<br />\nという行の "username" を自分の Gmail ユーザネームに書き換えます。私の場合なら<br />\nproperty username : "kaoru.arimura" --gmail username<br />\nです。\n</p>\n<p>\nこのスクリプトでは読みやすくするため、途中に改行マークが入ってしまっています。これは日本語環境では使えないので取り除く必要があります。面倒だという人は、以下のスクリプトを使ってください。\n</p>\n<p>\n<a href="applescript://com.apple.scripteditor?action=new&script=%28%2A%0DAuthor%3A%20Jayson%20Kempinger%0DE%2Dmail%3A%20EvilGlowingApple%40gmail%2Ecom%0DDate%20created%3A%207%20December%202004%0D%0DGmail%20backup%20script%0DDrop%20files%2Ffolders%20onto%20this%20as%20an%20application%2E%20%20This%20script%20will%20send%20the%20files%20as%20attachments%20in%20an%20e%2Dmail%0Dto%20the%20gmail%20address%20specified%20by%20the%20property%20username%2E%0D%0DCode%20to%20send%20message%20and%20set%20the%20subject%2Fbody%20found%20at%20http%3A%2F%2Fforums%2Emacosxhints%2Ecom%2Fshowthread%2Ephp%3Ft%3D31163%0Dmodified%20to%20support%20dropping%20of%20files%20and%20multiple%20files%2E%0D%2A%29%0D%0Dproperty%20username%20%3A%20%22username%22%20%2D%2Dgmail%20username%0Dproperty%20newline%20%3A%20%28ASCII%20character%2010%29%20%2D%2Dcharacter%20for%20new%20line%0D%0Don%20open%20of%20these_items%0D%09%2D%2Dcalls%20send_message%20with%20the%20list%20of%20files%20gotten%20as%20a%20droplet%0D%09send_message%28these_items%29%0Dend%20open%0D%0D%2D%2Daccepts%20a%20list%20of%20files%0Don%20send_message%28target_files%29%0D%09tell%20application%20%22Mail%22%0D%09%09%0D%09%09%2D%2Dcombine%20filenames%20of%20all%20files%20into%20one%20string%20for%20subject%0D%09%09set%20n%20to%201%0D%09%09set%20filenames%20to%20%22%22%0D%09%09repeat%20until%20n%20is%20the%20%28%28length%20of%20target_files%29%20%2B%201%29%0D%09%09%09set%20n_file%20to%20item%20n%20of%20target_files%0D%09%09%09if%20n%20is%20less%20than%20%28length%20of%20target_files%29%20then%0D%09%09%09%09set%20filenames%20to%20filenames%20%26%20POSIX%20path%20of%20n_file%20%26%20%22%2C%20%22%0D%09%09%09else%0D%09%09%09%09set%20filenames%20to%20filenames%20%26%20POSIX%20path%20of%20n_file%0D%09%09%09end%20if%0D%09%09%09set%20n%20to%20n%20%2B%201%0D%09%09end%20repeat%0D%09%09%0D%09%09%2D%2Dset%20message%20properties%0D%09%09set%20newMessage%20to%20make%20new%20outgoing%20message%20with%20properties%20%7Bsubject%3A%22File%3A%20%22%20%26%20filenames%2C%20content%3A%22This%20e%2Dmail%20is%20meant%20mearly%20as%20a%20backup%20of%20the%20following%20files%2E%22%20%26%20newline%7D%0D%09%09%0D%09%09tell%20newMessage%0D%09%09%09%2D%2Dmessage%20should%20be%20sent%20to%20self%0D%09%09%09make%20new%20to%20recipient%20at%20beginning%20of%20to%20recipients%20with%20properties%20%7Baddress%3Ausername%20%26%20%22%40gmail%2Ecom%22%7D%0D%09%09%09%0D%09%09%09%2D%2Dadd%20attachments%20from%20the%20list%09%09%0D%09%09%09set%20n%20to%201%0D%09%09%09tell%20content%0D%09%09%09%09repeat%20until%20n%20is%20the%20%28%28length%20of%20target_files%29%20%2B%201%29%0D%09%09%09%09%09set%20n_file%20to%20item%20n%20of%20target_files%0D%09%09%09%09%09set%20filepath%20to%20POSIX%20path%20of%20n_file%0D%09%09%09%09%09make%20new%20attachment%20with%20properties%20%7Bfile%20name%3Afilepath%7D%20at%20after%20the%20last%20word%20of%20the%20last%20paragraph%0D%09%09%09%09%09set%20n%20to%20n%20%2B%201%0D%09%09%09%09end%20repeat%0D%09%09%09end%20tell%0D%09%09end%20tell%0D%09%09%0D%09%09%2D%2Dsend%20the%20message%0D%09%09send%20newMessage%0D%09%09%0D%09end%20tell%0Dend%20send_message">G-mail Backup.scpt 自動生成</a>\n</p>\n<p>\nこのスクリプトを『別名で保存』（『フォーマット：アプリケーション』『オプション：すべてのチェックを外しておく』）で保存します。Dock に登録するなどドロップしやすいところに置いたら、あとはバックアップしたいファイルやフォルダをドロップするだけです。自動的に Mail.app が起動して、対象を送信してくれます。もちろん、フォルダをドロップした場合は Mail.app が ZIP アーカイブにしてくれます。\n</p>\n<p>\nGmail の添付ファイルのサイズ制限は１件あたり 10MB ですし、トータル１GB まで使えるのですから、大切なファイルをがんがん送信できますね。\n</p></div>\n';

EntryBody['E278140575'] = '<div> <br /><p style=\'margin-top: -2em;\'>\n出張の空き時間を使って iBlog Spy の精度を上げようと、AppleScript の研究をしてました。\n参考資料もないし、ウェブ上の記事も閲覧できない（仕事場が地下７階くらいなので、携帯の電波が届かない）ので、記憶をもとにトライ＆エラーの繰り返しです。\n</p>\n<p>\nFinder で選択したファイルへのパス取得の方法を思い出そうと思っていろいろと試してみましたが、いっこうにうまくいきません。ホームフォルダ以外にあるファイルならうまくいくのですが、ホームフォルダ内のファイルではエラーになってしまいます。\n</p>\n<p>\n解決策は簡単、FileVault をオフにすることでした。セキュリティのためには有効な FileVault ですが、それゆえに方法によってはホームフォルダの中身にアクセスできない場合があるようです。\n</p></div>\n';

EntryBody['E235447630'] = '<div> <br /><p style=\'margin-top: -2em;\'>\n<a href="http://www.piyosystems.com/kuki/B1356262698/index.html" title="my cheep blog" target="_blank">くきさん</a>の <a href="http://www.piyosystems.com/kuki/B1356262698/C1168111347/E426575652/index.html" title="iBlogTagAssist v1.2" target="_blank">iBlogTagAssist v1.2</a> のスクリプトを拝見していて、iBlog に処理させる部分、\n</p>\n<blockquote>\ntell application "iBlog" to activate\n</blockquote>\n<p style=\'margin-top: 1em;\'>\nでふとわいた疑問。<br />\n『スクリプトを実行する時点で最前面にあるアプリケーションは iBlog のはず。なぜ activate する必要があるのか？』（くきさんのスクリプトにケチをつけているのではありません。この処理がないと動作しないのです）\n</p>\n<p style=\'margin-top: 1em;\'>\nさきのエントリ『<a href="http://homepage.mac.com/kaoru_ari/iblog/C1308878031/E1045207578/index.html" title="iBlogTagAssist v1.2を使ってみる" target="_blank">iBlogTagAssist v1.2を使ってみる</a>』でも書いたように、私は <a href="http://www.mimikaki.net/" title="mi" target="_blank">mi</a> を使ってエントリを書くことがあるので、iBlogTagAssist が iBlog 以外のアプリケーションでも動作するようにすればどうしたらいいのかを考えました。\n</p>\n<p style=\'margin-top: 1em;\'>\n試しに tell application "iBlog" to activate をコメントアウトしてみると動作しません。おや？　と思いサンプルスクリプトを作ってみました。\n</p>\n<blockquote>\ntell application "System Events"<br />\n	set theFrontApp to (name of processes whose frontmost is true)<br />\n	theFrontApp<br />\nend tell<br />\n<a href="applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22System%20Events%22%0D%09set%20theFrontApp%20to%20%28name%20of%20processes%20whose%20frontmost%20is%20true%29%0D%09theFrontApp%0Dend%20tell">リスト１自動生成</a>\n</blockquote>\n<p style=\'margin-top: 1em;\'>\nスクリプトエディタの実行ボタンを押すと、結果は<br />\n{"Script Editor"}<br />\nが得られます。これでは次の処理に渡しづらいので、\n</p>\n<blockquote>\ntell application "System Events"<br />\n	set theFrontApp to (name of processes whose frontmost is true) as text<br />\nend tell<br />\n<a href="applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22System%20Events%22%0D%09set%20theFrontApp%20to%20%28name%20of%20processes%20whose%20frontmost%20is%20true%29%20as%20text%0Dend%20tell">リスト２自動生成</a>\n</blockquote>\n<p style=\'margin-top: 1em;\'>\nとします。すると<br />\n"Script Editor"<br />\nが得られます。で、もう一度サンプルを作ってみました。\n</p>\n<blockquote>\ntell application "System Events"<br />\n	set theFrontApp to (name of processes whose frontmost is true) as text<br />\n	display dialog theFrontApp &amp; " is formt most"<br />\nend tell<br />\n<a href="applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22System%20Events%22%0D%09set%20theFrontApp%20to%20%28name%20of%20processes%20whose%20frontmost%20is%20true%29%20as%20text%0D%09display%20dialog%20theFrontApp%20%26%20%22%20is%20formt%20most%22%0Dend%20tell">リスト３自動生成</a>\n</blockquote>\n<p style=\'margin-top: 1em;\'>\nこれをスクリプトメニューから実行すると、あれ？<br />\nSystem Events is front most<br />\nと表示されてしまいます。どうやら、スクリプトメニューからスクリプトを実行した場合、最前面のプロセスは System Events に固定されてしまうようです。これでは使い道がありません。\n</p>\n<p style=\'margin-top: 1em;\'>\nでは、スクリプトが実行された段階で最前面のプロセス、つまり System Events を隠してしまってはどうでしょう？\n</p>\n<blockquote>\ntell application "System Events"<br />\n	set visible of processes whose frontmost is true to false<br />\n	set theFrontApp to (name of processes whose frontmost is true) as text<br />\n	display dialog theFrontApp &amp; " is front most"<br />\nend tell<br />\n<a href="applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22System%20Events%22%0D%09set%20visible%20of%20processes%20whose%20frontmost%20is%20true%20to%20false%0D%09set%20theFrontApp%20to%20%28name%20of%20processes%20whose%20frontmost%20is%20true%29%20as%20text%0D%09display%20dialog%20theFrontApp%20%26%20%22%20is%20front%20most%22%0Dend%20tell">リスト４自動生成</a>\n</blockquote>\n<p style=\'margin-top: 1em;\'>\nスクリプトエディタの実行ボタンから実行すると、スクリプトエディタが隠れた上で、その時点で最前面にあるアプリケーションが最前面と表示されるのですが、スクリプトメニューから実行すると、やはり『System Events is front most』と表示されます。\n</p>\n<p style=\'margin-top: 1em;\'>\nう〜ん、『不特定の最前面にあるアプリケーションに処理を実行させる』スクリプトは無理なのかなぁ。\n</p>\n<div style=\'margin-top: 1em;\'>\n（覚え書き　（10/30/2004　追記））<br />\n<p>\n最前面のアプリケーションへのパス\n</p>\n<blockquote>\npath to frontmost application<br />\n→alias "HardDisk1:Applications:AppleScript:Script Editor.app:"\n</blockquote>\n<p>\n最前面のアプリケーション名\n</p>\n<blockquote>\ntell application "System Events"<br />\n	name of (path to frontmost application)<br />\nend tell<br />\n→"Script Editor.app"\n</blockquote>\n<p>\n最前面のアプリケーションの表示名\n</p>\n<blockquote>\ntell application "System Events"<br />\n	displayed name of (path to frontmost application)<br />\nend tell<br />\n→"スクリプトエディタ"\n</blockquote>\n<p>\nこれらをふまえて…<br />\n最前面のプロセスに System Event を送る\n</p>\n<blockquote>\ntell application "System Events"<br />\n	set theFrontApp to name of (path to frontmost application)<br />\nend tell<br />\ntell application theFrontApp to activate<br />\ntell application "System Events"<br />\n	key down {command}<br />\n	keystroke "v"<br />\n	key up {command}<br />\nend tell\n</blockquote>\n<p>\nこれなら、スクリプトメニューからも実行できます。<br />\nつまり、iBlogTagAssist v1.2 の\n</p>\n<blockquote>\ntell application "iBlog" to activate\n</blockquote>\n<p>\nとなっている箇所（各ファイル１カ所）を\n</p>\n<blockquote>\ntell application "System Events"<br />\nset theFrontApp to name of (path to frontmost application)<br />\nend tell<br />\ntell application theFrontApp to activate<br />\n<a href="applescript://com.apple.scripteditor?action=new&script=tell%20application%20%22System%20Events%22%0D%09set%20theFrontApp%20to%20name%20of%20%28path%20to%20frontmost%20application%29%0Dend%20tell%0Dtell%20application%20theFrontApp%20to%20activate">リスト５自動生成</a>\n</blockquote>\n<p>\nと置き換えれば、mi など iBlog 以外のアプリケーションでも動作します。\n</p>\n</div></div>\n';

