【发布时间】:2012-09-30 00:13:48
【问题描述】:
我正在尝试使用 AppleScript 设置 Messages.app 聊天窗口的位置。
tell application "System Events"
set position of window 1 of application "Messages" to {100, 100}
end tell
使用此代码我得到一个错误:
error "Messages got an error: Can’t set «class posn» of window 1 to {100, 100}."
number -10006 from «class posn» of window 1
这是什么意思?
如果我使用 Finder 尝试相同的代码,它会起作用。但是大多数其他应用程序都不起作用。
【问题讨论】:
-
脚本不起作用,因为应用程序“消息”的 AppleScript 字典中没有
position属性。只需将of application "Messages"替换为of process "Messages"。
标签: macos cocoa applescript finder appleevents