
|
MacOSX10.3.xでインストールされるAppleScriptには、スクリプトをアプリケーション形式で保存すると日本語が通らないという 重大なバグがあります。アプリケーション形式で保存する場合は、以下の手順で日本語に対応させてください。 (1) 保存時の「フォーマット」を「アプリケーションバンドル」に。 (2) Finderで「Japanese.lproj」という名前の空フォルダを作っておく。 (3) Finderで(1)で保存したアプリを選択し、 情報を見る=>言語=>追加で、(2)のJapanese.lprojを選ぶ。 (4) 情報を見る=>言語で、「Japanese」にチェックがついていることを確認。 |
|
MacOS9.2.2でインストールされるAppleScript1.7にはファイルパスをテキスト型に変換できないという重大なバグがあるので、 1.6か1.8以上をインストールしておくことをおすすめします。当ページで紹介している一部のスクリプトは1.7では動作しません。 |
(Safari用) --tasuketegates tell application "Safari" set curl to URL of document 1 tell application "Internet Explorer" Activate OpenURL curl end tell end tell (iCab用) --tasuketegates tell application "iCab" set currenturl to URL of window 1 tell application "Internet Explorer" Activate OpenURL currenturl end tell end tell
(Safari用) --tasuketekitune tell application "Safari" set curl to URL of document 1 end tell tell application "Firefox" OpenURL curl activate end tell
(Safari用) --ページをexciteで英日翻訳 tell application "Safari" set currenturl to URL of document 1 set hon to "http://www.excite.co.jp/world/url/body/?wb_url=" set hon2 to "&wb_lp=ENJA" open location (hon & currenturl & hon2) end tell (IE用) --ページをexciteで英日翻訳 tell application "Internet Explorer" set currenturl to item 1 of (GetWindowInfo (item 1 of (ListWindows))) set hon to "http://www.excite.co.jp/world/url/body/?body=" set hon2 to "&trans_type=enja-ATL" OpenURL (hon & currenturl & hon2) toWindow 0 end tell (iCab用) --ページをexciteで英日翻訳 tell application "iCab" set currenturl to URL of window 1 set hon to "http://www.excite.co.jp/world/url/body/?body=" set hon2 to "&trans_type=enja-ATL" OpenURL (hon & currenturl & hon2) toWindow 0 end tell
(Safari用) --選択した住所をYahoo地図で検索 set cb to the clipboard as record tell application "System Events" tell application process "Safari" tell application "Safari" to activate delay 0.5 keystroke "c" using command down delay 0.5 set address to the clipboard end tell end tell set the clipboard to cb if address contains return then set address to do shell script "echo " & quoted form of address & " | sed s/" & return & "//g" set escaddress to do shell script "echo " & quoted form of address & "| iconv -f UTF-8-MAC -t EUC-JP | perl -pe '~s/([^?w ])/¥"%¥".unpack(¥"H2¥", $1)/eg;'" set escaddress to characters 1 thru -4 of escaddress as Unicode text tell application "Safari" open location "http://search.map.yahoo.co.jp/search?p=" & escaddress & "&pref=&skind=" end tell
(Safari用) --Yahoo地図⇔Googleマップ 2009年8月のYahoo地図リニューアルに対応 set convurl to "" tell application "Safari" set clp to do JavaScript "var slct = escape(window.getSelection()); unescape(slct);" in document 1 if clp contains "map.yahoo" then set AppleScript's text item delimiters to "&lat=" set clp to text item 2 of clp set AppleScript's text item delimiters to "&lon=" set ido to text item 1 of clp set clp to text item 2 of clp set AppleScript's text item delimiters to "&z=" set keido to text item 1 of clp set clp to text item 2 of clp set AppleScript's text item delimiters to "&mode=" set syuku to (text item 1 of clp) as number set syuku to syuku - 1 set convurl to "http://maps.google.co.jp/maps?ie=UTF8&ll=" & ido & "," & keido & "&spn=0.0,0.0&z=" & syuku set AppleScript's text item delimiters to "" end if if clp contains "maps.google" then set AppleScript's text item delimiters to "&ll=" set clp to text item 2 of clp set AppleScript's text item delimiters to "," set ido to text item 1 of clp set clp to text items 2 thru 3 of clp as Unicode text set AppleScript's text item delimiters to "&spn=" set keido to text item 1 of clp set clp to text item 2 of clp set AppleScript's text item delimiters to "&z=" set syuku to (word 1 of text item 2 of clp) as number set syuku to syuku + 1 set convurl to "http://map.yahoo.co.jp/pl?type=scroll&lat=" & ido & "&lon=" & keido & "&z=" & syuku & "&mode=map&pointer=on&datum=wgs" set AppleScript's text item delimiters to "" end if if convurl is "" then display dialog "Yahoo地図では地図右上の「この地図のURL」をクリックし、表示されたURLをクリックしてからスクリプトを実行します。" & return & "Googleマップでは地図右上の「リンク」をクリックしてからスクリプトを実行します。" giving up after 10 return end if open location convurl end tell
(Safari用) --選択した単語をexciteの英和・和英辞典で調べる set cb to the clipboard as record tell application "System Events" tell application process "Safari" tell application "Safari" to activate delay 0.5 keystroke "c" using command down delay 0.5 set surl to the clipboard end tell end tell set the clipboard to cb if surl contains return then set surl to do shell script "echo " & quoted form of surl & " | sed s/" & return & "//g" set surl to "http://www.excite.co.jp/dictionary/japanese_english/?submit=+検+索+&match=beginswith&search=" & surl tell application "Safari" open location surl end tell
(Safari用 ・・・通常のコンテクストメニューではリンク文字を検索できないので)
--選択した語句でgoogle検索
set cb to the clipboard as record
tell application "System Events"
tell application process "Safari"
tell application "Safari" to activate
delay 0.5
keystroke "c" using command down
delay 0.5
set surl to the clipboard
end tell
end tell
set the clipboard to cb
if surl contains return then set surl to do shell script "echo " & quoted form of surl & " | sed s/" & return & "//g"
if surl contains " " then set surl to do shell script "echo " & quoted form of surl & " | sed s/" & quoted form of " " & "/" & quoted form of "+" & "/g"
tell application "Safari"
open location "http://www.google.com/search?client=safari&rls=ja-jp&q=" & surl & "&ie=UTF-8&oe=UTF-8"
end tell
(IE用)
--選択した語句でgoogle検索
tell application "Internet Explorer"
set google to "http://www.google.com/search?num=30&hl=ja&lr=lang_ja&safe=off&q="
try
set surl to selected text
if (surl is false) or (surl is "") then
try
set {text returned:surl, button returned:btn} to ツ
(display dialog "Search Google" default answer "" buttons {"キャンセル", "全言語", "日本語"} default button "日本語")
if btn is "全言語" then
set google to "http://www.google.com/search?num=30&hl=ja&lr=&safe=off&q="
end if
end try
end if
set AppleScript's text item delimiters to " "
set surl to every text item of surl
set AppleScript's text item delimiters to "+"
set surl to surl as text
set AppleScript's text item delimiters to return
set surl to every text item of surl
set AppleScript's text item delimiters to ""
set surl to surl as text
OpenURL (google & surl) toWindow 0
end try
end tell
(iCab用)
--選択した語句でgoogle検索
tell application "iCab"
set google to "http://www.google.com/search?num=30&hl=ja&lr=lang_ja&safe=off&q="
tell window 1
try
set surl to selection
if (surl is false) or (surl is "") then
try
set {text returned:surl, button returned:btn} to ツ
(display dialog "Search Google" default answer "" buttons {"キャンセル", "全言語", "日本語"} default button "日本語")
if btn is "全言語" then
set google to "http://www.google.com/search?num=30&hl=ja&lr=&safe=off&q="
end if
end try
end if
set AppleScript's text item delimiters to " "
set surl to every text item of surl
set AppleScript's text item delimiters to "+"
set surl to surl as text
set AppleScript's text item delimiters to return
set surl to every text item of surl
set AppleScript's text item delimiters to ""
set surl to surl as text
OpenURL (google & surl) toWindow 0
end try
end tell
end tell
(Safari用) --選択したURLを開く set cb to the clipboard as record tell application "System Events" tell application process "Safari" tell application "Safari" to activate delay 0.5 keystroke "c" using command down delay 0.5 set surl to the clipboard end tell end tell set the clipboard to cb if surl contains return then set surl to do shell script "echo " & quoted form of surl & " | sed s/" & return & "//g" if surl contains " " then set surl to do shell script "echo " & quoted form of surl & " | sed s/" & quoted form of " " & "//g" if surl contains "://" then set AppleScript's text item delimiters to "://" set surl to "http://" & text item 2 of surl else set surl to "http://" & surl end if tell application "Safari" open location surl end tell (IE用) --選択したURLを開く tell application "Internet Explorer" set surl to selected text if surl contains "://" then set AppleScript's text item delimiters to "://" set surl to text item 2 of surl end if OpenURL surl toWindow 0 end tell (iCab用) --選択したURLを開く tell application "iCab" tell window 1 set surl to selection if surl contains "ttp://" then set AppleScript's text item delimiters to "ttp://" set surl to text item 2 of surl end if OpenURL surl toWindow 0 end tell end tell
(Safari用)
set cb to the clipboard as record
tell application "System Events"
tell application process "Safari"
tell application "Safari" to activate
delay 0.5
keystroke "c" using command down
delay 0.5
set zenurl to the clipboard
end tell
end tell
set the clipboard to cb
set zentext to zenurl
set zentable to " !?#$¥%&@.,:;()[]{}/\_|^`〜’”+−<=>*0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
set hantable to " !?#$\¥%&@.,:;()[]{}/\\_|^`~'\"+-<=>*0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
set hantext to ""
considering case
repeat with x in zentext
set y to 1
set convtext to x as string
repeat 96 times
if convtext contains (item y of zentable) then
set convtext to (item y of hantable) as string
exit repeat
end if
set y to y + 1
end repeat
set hantext to hantext & convtext
end repeat
end considering
set hanurl to hantext
tell application "Safari"
open location hanurl
end tell
(Safari用)
--ウインドウの位置を揃える
tell application "Safari"
set {hida, ue, migi, shita} to {0, 22, 800, 740}
set mado to number of window
repeat while mado > 0
if miniaturizable of window mado is false then
set mado to mado - 1
else
if name of window mado is "Downloads" then
set bounds of window "Downloads" to {0, 600, 300, 750}
set mado to mado - 1
set {hida, ue, migi, shita} to {hida + 0, ue + 0, migi + 0, shita + 0}
else
set bounds of window mado to {hida, ue, migi, shita}
set mado to mado - 1
set {hida, ue, migi, shita} to {hida + 0, ue + 0, migi + 0, shita + 0}
end if
end if
end repeat
end tell
(IE用)
--ウインドウの位置を揃える
tell application "Internet Explorer"
set wlist to ListWindows
set ct to 0
repeat with i in wlist
considering application responses
Activate -i
do script "window.resizeTo(800,560),window.moveTo(" & ct & "," & ct & ");"
set ct to ct + 2
end considering
end repeat
end tell
(iCab用)
--ウインドウの位置を揃える
tell application "iCab"
set {hida, ue, migi, shita} to {6, 42, 820, 620}
set mado to number of window
repeat while mado > 0
set bounds of window mado to {hida, ue, migi, shita}
set mado to mado - 1
set {hida, ue, migi, shita} to {hida + 5, ue + 0, migi + 5, shita + 0}
end repeat
end tell
--AS proxy changer 1.1 property proxylist : "" chooseproxylist() on chooseproxylist() if proxylist is "" then set proxylist to (choose file with prompt "proxy list はどこですか?" of type "TEXT") end if end chooseproxylist try set plist to read proxylist using delimiter return as text on error chooseproxylist() end try set newproxy to (choose from list (plist) with prompt "proxy 選択" without multiple selections allowed) if result is not false then set AppleScript's text item delimiters to tab set newproxy to text item 1 of (newproxy as text) tell application "ICScriptor" SetICPreference HTTP proxy host to newproxy SetICPreference use HTTP proxy with to quit end tell end if
tell application "ICScriptor"
if (GetICPreference Web helper) is {fileCreator:"iCAB", fileName:"iCab"} then
SetICPreference Web helper to {fileCreator:"MSIE", fileName:"Internet Explorer"}
(display dialog "標準ブラウザがIEに変わりました" giving up after 1)
else if (GetICPreference Web helper) is {fileCreator:"MSIE", fileName:"Internet Explorer"} then
SetICPreference Web helper to {fileCreator:"iCAB", fileName:"iCab"}
(display dialog "標準ブラウザがiCabに変わりました" giving up after 1)
end if
quit
end tell
(IE用) --dat化されたファイルを読む tell application "Internet Explorer" set currenturl to item 1 of (GetWindowInfo (item 1 of (ListWindows))) set AppleScript's text item delimiters to "read.cgi" OpenURL (text item 1 of currenturl & "offlaw.cgi" & text item 2 of currenturl & "?raw=1") end tell (iCab用) --dat化されたファイルを読む tell application "iCab" set currenturl to URL of window 1 set AppleScript's text item delimiters to "read.cgi" OpenURL (text item 1 of currenturl & "offlaw.cgi" & text item 2 of currenturl & "?raw=1") end tell

| xx | 最新レスxx個 | 何も入力しないと最新レス50個 |
| xx. | レスxx番表示 | [.xx]でも可 |
| xx-yy | レスxx番からyy番 | [xx-]でレスxx番から最新レス |
| xx+yy | レスxx番からyy個 | [xx+]でレスxx番から50個 |
| +xx | 次レスxx個 | [+]のみで更新分を同じウインドウで開く(実況向け) |
| +-xx | 前レスxx個 | [+-]のみで前レス50個 |
| / | スレ一覧(imode用)に戻る | スレ一覧(imode用)表示中は通常版(index.html)を表示 |
| // | 過去ログ | subback.htmlを表示 |
| * | 同じウインドウで開く | 上記コマンドに " * " を追加 |