AppleScript脚本

来源:互联网 发布:网络招嫖判刑多久 编辑:程序博客网 时间:2024/05/16 05:30

1, 打开程序后, 模拟手键盘的输入(模拟tab键, 模拟依次按键, 以及按住Command+V键)

tell application "Mail"

activate

settheMessage to make newoutgoing message with properties {visible:true,subject:"mysubject"}

end tell


tell application "System Events"

tell process "Mail"

--repeat until focused of UI element 1 of scroll area 4 of window 1

--keystroke tab

--end repeat

keystroke "yiono"

--keystroke "v" using command down

end tell

end tell



2,  模拟菜单打开操作, 打开photo Booth应用,然后执行一个拍照的操作

tell application "Photo Booth"

activate

end tell


tell application "System Events"

tell process "Photo Booth"

delay 3

tell application "Finder"

set visible of process "Photo Booth"to false

end tell

tell menu bar 1

tell menu bar item "File"

tell menu "File"

clickmenu item "Take Photo"

end tell

end tell

end tell

end tell

end tell



0 0
原创粉丝点击