0

AppleScriptで最新のツイートを取得したい。ただし、「ステータス」の変数は保存できません。ツイートステータスオブジェクトを保存するにはどうすればよいですか?

それは働いています:

tell application "Twitter"
  set tw to text of item 1 of statuses of home timeline of current account
end tell

動作していません:

tell application "Twitter"
  set tw to item 1 of statuses of home timeline of current account
  set txt to text of tw
end tell
4

2 に答える 2

1

Twitter.appのAppleScriptサポートには奇妙なことがありますが、複数のプロパティを取得するだけでよい場合は、tellブロックまたは並列割り当てを使用できます。

tell application "Twitter"
    tell item 1 of statuses of home timeline of current account
        set t to text
        set u to url
        properties
    end tell
    -- set {t, u} to {text, url} of item 1 of statuses of home timeline of current account
end tell

または、代わりにAPIを使用できますか?これは、 dev.twitter.comでアプリケーションを実行sudo gem install twitterして登録する場合に機能するはずです。

require 'rubygems'
require 'twitter'

Twitter.configure { |config|
    config.consumer_key = ""
    config.consumer_secret = ""
    config.oauth_token = ""
    config.oauth_token_secret = ""
}

p Twitter.home_timeline.first.text
p Twitter.home_timeline.first.inspect
于 2013-03-10T09:52:47.660 に答える
1

少し遅れて言及しますが、MacAppStoreで無料で入手できる私のアプリ「TwitterScripter」を見てください。

これは、AppleScriptからTwitterAPIに簡単にアクセスできるように設計された顔のないバックグラウンドアプリケーションです。OS X(10.8+)のネイティブTwitterサポートに便乗しているため、認証を自分で処理する必要はありません。構造化されたAppleScriptレコードとしてTwitterAPIから応答を取得できます。

例えば:

tell app "Twitter Scripter"
  set myTwitterAccount to item 1 of (available accounts) as string
  -- User timeline: This function retrieves the Tweets for a given user name
  fetch user timeline for username "mousedownsoft" using account myTwitterAccount with excluding replies and including retweets
end
于 2014-01-26T11:23:12.017 に答える