从一个结果中获取多个变量(一个用于第一个字母,一个用于第二个字母,其余的来自其余字母)
在 applescript 中将一个变量作为从对话框返回的结果非常简单,但是是否可以使用第一个和第二个字母作为两个单独的变量,而从对话框返回的结果的其余部分作为第三个变量?下面有一个代码示例,其中包含我想要执行的操作以及我认为我想要执行此操作的大致位置。
tell application "Finder"
activate
display dialog "newNameOfFolderDialogue" default answer "x"
set categoryOne to [THE FIRST LETTER OF] (text returned of result)
set categoryTwo to [THE SECOND LETTER OF] (text returned of result)
set categoryThree to [THE REMAINING LETTERS OF] (text returned of result)
end tell
It's very straightforward to make one variable the result returned from a dialog in applescript, but is it possible to use the first and second letter as two separate variables and the rest of the result returned from the dialog as a third? Below there's a code example with what I want to do and approximately where I think I want to do it.
tell application "Finder"
activate
display dialog "newNameOfFolderDialogue" default answer "x"
set categoryOne to [THE FIRST LETTER OF] (text returned of result)
set categoryTwo to [THE SECOND LETTER OF] (text returned of result)
set categoryThree to [THE REMAINING LETTERS OF] (text returned of result)
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
再简单不过了:
Couldn't be simpler:
甚至可以更简单:D 包括检查用户的输入
Can even be simpler :D including a check for the user's input