最近, 気になったこと…: さいたくんの関連記事作成スクリプトを改造した |
ただし、 TextExpander を使う主な理由はできるだけキーボードで事を済ませたいからなので、その観点で少し仕様を変えています。
Google検索用スニペット
まずは自分のサイトをGoogleで検索するスニペット前回の AppleScript ではクリップボードの文字を検索していましたが、クリップボードだと検索したい文字をわざわざ入力してからスニペットを起動しなければならなかったので Fillin にを使うように変えてみました。
![Fillin.png Fillin](http://lh3.ggpht.com/-LleYWVUe51Y/T8Aa3n_4eEI/AAAAAAAAEXQ/QTXGQJcQPZ4/Fillin.png?imgmax=800)
Fillin だと実行時に値を入れられるので検索する文字はスニペットを起動した後に入れられるのでこの方が良いかも。
これを ..google に割り当てています。
1 2 3 4 5 6 |
set queryString to "%fill:name%" tell application "Safari" search the web for "site:azur256.blogspot.com " & queryString end tell return "" |
関連リンク作成用スニペット
もう一つは関連リンクを作るためのスニペットSafari に表示されているタブをリストにします。以下はそのうちの一部。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
tell application "Safari" if (count of document) is greater than 0 then tell window 1 set related_entries to "<ul>" & return repeat with handle_document in tabs set site_title to name of handle_document set site_title to replace_string_action(site_title, "最近, 気になったこと...: ", "") of me set site_title to replace_html_entity(site_title) of me set site_url to URL of handle_document set related_entries to related_entries & "<li><a href=\"" & site_url & "\" target=\"_blank\">" & site_title & "</a>" & make_tweetbuzz_url(site_url) of me & make_hateb_url(site_url) of me & "</li>" & return end repeat set related_entries to related_entries & "</ul>" & return end tell end if end tell return related_entries |
このスニペットは ..relate に割り当てています。挙動は先に紹介した AppleScript と同じです。
TextExpander の方が書く事に集中できて良いですね。
このスニペットは ここ からダウンロードして Add Group from file で読み込んでください(ダブルクリックでも読み込むみたいです)。
これと同じことが iPhone で出来るといいんですけど。Mac 環境がどんどん整ってきてモブログへの道がどんどん遠のいてしまいます
![](http://a4.mzstatic.com/us/r1000/113/Purple/v4/b4/fa/e2/b4fae252-c6f9-f488-1f97-86dfbedbd828/SMTEIcon.75x75-65.png)
![App](http://azur256.com/images/itunes.png)
販売元: SmileOnMyMac, LLC – SmileOnMyMac, LLC(サイズ: 5.2 MB)
![](http://a1.mzstatic.com/us/r1000/101/Purple/v4/c8/f4/63/c8f46388-6e27-67cb-d39d-8b6ebf9ad8e1/mzl.xtwntewo.75x75-65.png)
![App](http://azur256.com/images/itunes.png)
販売元: SmileOnMyMac, LLC – SmileOnMyMac, LLC(サイズ: 3.2 MB)
![](http://a3.mzstatic.com/us/r1000/106/Purple/v4/dd/1a/d5/dd1ad5ff-4a74-3a35-8db3-6832aabef505/appicon_marsedit.75x75-65.png)
![App](http://azur256.com/images/itunes.png)
販売元: Red Sweater Software – Red Sweater Software(サイズ: 6.2 MB)
関連するエントリ
最後まで読んでいただきありがとうございます。
![follow us in feedly](http://s3.feedly.com/img/follows/feedly-follow-rectangle-flat-big_2x.png)
Facebook ページでも情報を発信していますのでよろしかったら「いいね!」をお願いします
RSSリーダへの登録は こちら からどうぞ。
コメントを残す