/Commands/Run Simulator.tmCommand
http://github.com/osadchuk/Corona-SDK.tmbundle · Unknown · 79 lines · 70 code · 9 blank · 0 comment · 0 complexity · 094b97cea8468c1032238bba4451b18e MD5 · raw file
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>beforeRunningCommand</key>
- <string>saveModifiedFiles</string>
- <key>command</key>
- <string>#!/bin/bash
- if [[ ${#SKIN} < 1 ]] ; then
- SKIN="iPhone"
- fi
- if [[ ${#SDK_PATH} > 0 ]] ; then
- CORONA_SIM_PATH=$SDK_PATH"/Corona Terminal"
- else
- CORONA_SIM_PATH="/Applications/CoronaSDK/Corona Terminal"
- fi
- if [[ ${#TM_PROJECT_DIRECTORY} > 0 ]] ; then
- TARGET_DIR=$TM_PROJECT_DIRECTORY
- else
- TARGET_DIR=$TM_DIRECTORY
- fi
- # In order for the simulator relaunch to work, "Enable access for assistive devices" must be selected in System Preferences > Universal Access.
- osascript <<- APPLESCRIPT
- on appIsRunning(appName)
- tell application "System Events" to (name of processes) contains appName
- end appIsRunning
- on selectAppMenuItem(app_name, menu_name, menu_item)
- try
- -- bring the target application to the front
- tell application app_name
- activate
- end tell
- tell application "System Events"
- tell process app_name
- tell menu bar 1
- tell menu bar item menu_name
- tell menu menu_name
- click menu item menu_item
- end tell
- end tell
- end tell
- end tell
- end tell
- return true
- on error error_message
- return false
- end try
- end selectAppMenuItem
- if appIsRunning("Corona Simulator") then
- selectAppMenuItem("Corona Simulator","File","Relaunch")
- else
- tell application "Terminal"
- do script "'$CORONA_SIM_PATH' -project $TM_PROJECT_DIRECTORY -skin $SKIN"
- end tell
- end if
- APPLESCRIPT</string>
- <key>input</key>
- <string>none</string>
- <key>keyEquivalent</key>
- <string>@r</string>
- <key>name</key>
- <string>Run Simulator</string>
- <key>output</key>
- <string>discard</string>
- <key>scope</key>
- <string>source.lua</string>
- <key>uuid</key>
- <string>1831E774-8AF9-4EF0-BE93-11B077CC4DC2</string>
- </dict>
- </plist>