Applescript 文件名为';找不到

Applescript 文件名为';找不到,applescript,ios-simulator,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

我正在编写以下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模拟器吗?

它现在被称为“iOS模拟器”,而不是“iPhone模拟器”。我建议您将第一行更改为:

tell application "iOS Simulator" to activate

好啊我会试试,然后再打给你。你知道这项改变是什么时候开始的吗?因为它在使用Xcode 6.1的mac电脑上与iPhone Simulator配合使用效果很好,但它在另一台设置几乎相同的机器上抛出了错误。该名称在Xcode 6.0中更改。如果它在使用Xcode 6.1的某个系统上工作,我怀疑它在某处找到了旧版本。您应该检查实际运行的是什么。