AppleScript笔记
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

#获取输入框文本
set dialogString to "请输入"
set returnedString to display dialog dialogString default answer ""
set yourInputText to the text returned of returnedString

# 打印log
display dialog returnedNumber
log returnedNumber

#字符串链接
set str1 to "hello"
set str2 to "world"
set str3 to str1 & ", " & str1
display dialog str3

#选择打开文件夹
set FolderPath to (choose folder) -- sets file path to folder you select
display dialog FolderPath as text
#tell application "Finder" to open FolderPath--打开文件
tell application "Finder" to reveal FolderPath--在文件夹中显示

do shell script in AppleScript

https://developer.apple.com/library/content/technotes/tn2065/_index.html

系列参考教程

AppleScript学习笔记(一)初识AppleScript

1
2
3
display dialog "请输入" default answer linefeed

display dialog "What is your name?" default answer ""
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
set dialogString to "Input a number here"

set returnedString to display dialog dialogString default answer ""

set returnedNumber to the text returned of returnedString




try

set returnedNumber to returnedNumber as number

set calNumber to returnedNumber * 100

 display dialog calNumber

on error the error_message number the error_number

display dialog "Error:" & the error_number & " Details:" & the error_message

end try

beep

文章作者: kyren
文章链接: http://huluo666.github.io/2016/10/09/AppleScript笔记/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Kyren's Blog