0

我正在尝试从 Mac Twitter 应用程序中的推文中获取作者 ID。

tell application "Twitter"
properties of item 3 of status of (home timeline of account 1)
end tell

在此处输入图像描述

tell application "Twitter"
author of item 3 of status of (home timeline of account 1)
end tell

在此处输入图像描述

如何隔离“128938832”?

解决方案:AppleScript-Users 邮件列表中的 Chris 刚刚回答了我的问题。author 属性有一个 user id 属性。user id of author of item 3 of status of (home timeline of account 1)返回“128938832”。

4

1 回答 1

1

我没有 Twitter,但如果没有获取作者 ID 的条款,您可能会通过强制错误并从错误消息中提取数字来作弊,例如:

tell application "Twitter" to try
    (author of item 3 of status of (home timeline of account 1)) as number -- force error
on error errmess -- extract info from the error message
    set here to (offset of quote in errmess) + 1 -- first quote
    set there to here + (offset of quote in (text here thru -1 of errmess)) - 2 -- second quote
    set authorID to text here thru there of errmess
end try
于 2012-06-05T18:00:05.950 回答