[Safari]AppleScriptを使ってTwitterへメッセージを送る(bookmarkletもどき)
set theTabNo to ""
set theTwitterTitle to ""
set theTwitterURL to ""
set GoogleUrlShortener to ""
set theShorturl to ""
set theBodytext to ""
tell application "Safari"
activate
try
tell document 1
set theTwitterTitle to name
end tell
end try
tell window 1
tell current tab
---try
---set theTwitterTitle to name
---end try
try
set theTwitterURL to URL
end try
end tell
end tell
end tell
set GoogleUrlShortener to "curl https://www.googleapis.com/urlshortener/v1/url? -H 'Content-Type: application/json' -d '{\"longUrl\": \"" & theTwitterURL & "\"}'" & "| grep 'goo.gl' | awk '{print($2)}' | sed -e \"s/\\\",//\" | sed -e \"s/\\\"//\" " as Unicode text
set theShorturl to do shell script GoogleUrlShortener
set theTwitter to "http://twitter.com/intent/tweet?url=" & theShorturl & "%0ASource:【" & theTwitterTitle & "】" & "" as Unicode text
set theNewWindowURL to "http://www.goo.gl/" as Unicode text
tell application "Safari"
make new document
tell document 1
tell current tab
open location theTwitter
end tell
end tell
end tell
| 固定リンク
« [Safari]AppleScriptでタブのタイトルを取得する | トップページ | [Safari]AppleScriptを使ってTwitterへメッセージを送る(bookmarkletもどき)その2 »
「AppleScript」カテゴリの記事
- 濁音 半濁音 置換用レコード(2023.08.21)
- [AppleScript]キーノートの書類サイズを指定して作成(2022.01.09)
- [awk]行頭のスペースを削除する(subで置き換え)(2021.11.16)
- [SpotLight]選択範囲でSpotLight検索(2021.11.03)
- [AppleScript]リソースフォーク(カスタムアイコン)削除(2021.10.12)