苹果脚本。将脚本的结果保存在 var 中
Applescript. Save the results of a script in a var
我是 AppleScript 的新手。我想存储脚本的结果。
我先试试
tell application "TextEdit" to get the bounds of the window 1
脚本编辑器中的结果是:{1445, 366, 1920, 1095}
如何以单独的方式存储每个数字以便稍后在脚本中使用它?
我尝试过的:
-- set firstNumber to (1st item of the result)
-- set secondNumber to (2nd item of the result)
我想我可以存储其中一个数字,但不能存储所有数字。我每次都可以声明第一行,但看起来效率很低
您可以在一行中将列表分配给 4 个不同的变量
tell application "TextEdit" to set {xPosition, yPosition, width, height} to bounds of window 1
我是 AppleScript 的新手。我想存储脚本的结果。
我先试试
tell application "TextEdit" to get the bounds of the window 1
脚本编辑器中的结果是:{1445, 366, 1920, 1095}
如何以单独的方式存储每个数字以便稍后在脚本中使用它?
我尝试过的:
-- set firstNumber to (1st item of the result)
-- set secondNumber to (2nd item of the result)
我想我可以存储其中一个数字,但不能存储所有数字。我每次都可以声明第一行,但看起来效率很低
您可以在一行中将列表分配给 4 个不同的变量
tell application "TextEdit" to set {xPosition, yPosition, width, height} to bounds of window 1