找不到文件iPhone模拟器

时间:2014-12-01 13:35:22

标签: applescript ios-simulator

我正在研究以下AppleScript,它可以在我的机器上正常工作

tell application "iPhone Simulator" to activate
tell application "System Events" to keystroke "h" using {command down, shift down}
tell application "System Events" to keystroke "h" using {command down, shift down}

tell application "System Events"
  set _position to position of window 1 of process "iOS Simulator"
  set _size to size of window 1 of process "iOS Simulator"
  set _x to item 1 of _position
  set _y to item 2 of _position
  set _width to item 1 of _size
  set _height to item 2 of _size
  set _coord_x to (_x + _width / 2) as integer
  set _coord_y to (_y + _height / 2) as integer
  do shell script "cliclick c:" & _coord_x & "," & _coord_y
end tell

不幸的是,当我在另一台机器上执行该脚本时,即使启动了iPhone模拟器,第一行也会抛出以下错误:

error "File iPhone Simulator wasn’t found." number -43 from current application

两台机器都运行相同版本的Xcode(6.1)和相同的模拟器(iPhone / iOS 7.1)

知道无法找到应用程序iPhone模拟器的原因吗?

1 个答案:

答案 0 :(得分:1)

现在称为“iOS模拟器”,而不是“iPhone模拟器”。我建议你把第一行改为:

tell application "iOS Simulator" to activate