本文只針對(duì)于在AppleScript中的一些常用方法或操作進(jìn)行記錄沦童,適合對(duì)于AppleScript有一定了解的開發(fā)人員。
一展氓、將進(jìn)程置于第一窗口
tell application "System Events"
set frontmost of process "進(jìn)程名" to true
keystroke "1" using command down
delay 0.2
end tell
鍵盤輸入的“1”可以隨意替換成代替鍵盤按鍵的數(shù)字申钩,鍵盤對(duì)應(yīng)數(shù)字請(qǐng)查看該網(wǎng)頁颂碧。
二塑煎、遍歷某個(gè)文件夾下的所有文件夾名稱
請(qǐng)保證你的文件夾路徑為該例子中的格式 例:"XXX:User:UserName:Desktop:xxx"
tell application "System Events"
set path_list to POSIX path of every disk item of "路徑"
end tell
三沫换、獲取所有進(jìn)程名稱
tell application "System Events"
set processList to name of every process
end tell
后續(xù)遇到比較常用的再更新