2017-10-13 70 views
0

我想设置消息应用程序的文本。我使用了一些辅助工具来生成applescript代码。隐私/可访问性启用。仍然收到编译错误(“一个数字不能超过这个标识符。”)。 10.12.6Applescript - 设置消息inputTextArea错误

tell application "Messages"  
    set value of textarea 1 of scroll area 4 of splitter group 1 of window "Messages" to "Hello World!" 
end tell 

任何建议如何获得/设置值?

enter image description here

回答

1

这使用最新版本的塞拉利昂

activate application "Messages" 
delay 1 
tell application "System Events" 
    set value of text area 1 of scroll area 4 of splitter group 1 of window "Messages" of application process "Messages" to "Hello World" 
end tell 
+0

更改窗口中的“邮件”到窗口1对我的作品和它的作品。非常感谢! –

+0

@MarekH您的建议“更改窗口”消息“到窗口1并且工作正常”有问题“...如果消息窗口是唯一打开的窗口,您的解决方案将工作。但是,如果在消息应用程序(文件传输窗口,好友列表窗口等)中打开了其他窗口,并且这两个窗口中的任何一个都是最前面的......脚本会抛出错误,因为现在消息窗口不再“窗口1”。我的脚本版本不会引发错误。它会正确输入文字 – wch1zpink

+0

谢谢你让我知道。 –