我将使用什么 applescript 数据类型?
我有这个 applescript 代码:
tell application "TextEdit"
set test to the bounds of window 1
end tell
display dialog test
但我收到以下错误:
error "Can’t make {10, 22, 400, 1003} into type string." number -1700
from {10, 22, 400, 1003} to string
我需要为此使用哪种数据类型?
顺便说一句,我不希望它像将其设置为某些数据类型时那样显示 10224001003
。
I have got this applescript code:
tell application "TextEdit"
set test to the bounds of window 1
end tell
display dialog test
but I am getting the following error:
error "Can’t make {10, 22, 400, 1003} into type string." number -1700
from {10, 22, 400, 1003} to string
Which data type would I need to use for this?
BTW, I don't want it to display 10224001003
as it does when you set it to some data types.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显示对话框语句只能显示字符串。窗口边界将以数字列表的形式返回给您。因此,您必须根据该信息创建一个字符串,以便可以显示它。有多种方法可以做到这一点,但这里有一种简单的方法,我们只需创建一个新字符串并将边界数字插入到该字符串中即可。您可以看到我使新字符串看起来像数字列表......但它确实是一个字符串。
A display dialog statement can only display a string. The window bounds is returned to you as a list of numbers. As such you have to create a string out of that information so you can display it. There's several ways to do that but here's a simple way where we just create a new string and insert the bounds numbers into that string however we want. You can see that I made the new string look like the list of numbers... but it really is a string.