(Re-)Launching CPM from within BBEdit

For those of us who go back and forth between editing the code with CPM and BBEdit, the following bash-file can be used as a unix-script in BBEdit to (re)launch whatever project is currently active in CPM. I’ve bound it also to cmd-R, and it seems to work well.

It allows you to deploy CPM for what it currently is brilliant for (asset management, file-gathering and Corona launching), while using BBedit for code editing (until maybe the next CPM release ;-)).

[bash]
#!/bin/bash

CPM_PATH="/Applications/Corona Project Manager"

In order for the simulator relaunch to work, “Enable access for assistive devices” must be selected in System Preferences > Universal Access.

osascript <
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 Project Manager”) then
selectAppMenuItem(“Corona Project Manager”,“Project”,“Launch”)
else
tell application “Terminal”
do script “$CPM_SIM_PATH $BB_DOC_PATH”
end tell
end if

APPLESCRIPT
[/bash]

Looking forward to the next CPM release.
-FrankS.
[import]uid: 8093 topic_id: 7951 reply_id: 307951[/import]

Hey FrankS.

Any chance you would make something like this for Fraise (formerly known as smultron) ? [import]uid: 6981 topic_id: 7951 reply_id: 28302[/import]

Sorry - no can do…

However, that script may also work with TextWrangler (free BBedit “lite”)… but I haven’t tried.

Cheers, FrankS.
[import]uid: 8093 topic_id: 7951 reply_id: 28304[/import]

Heh no probs, was worth asking :slight_smile:

Keep up the good work, you are certainly coming up with some great stuff here. [import]uid: 6981 topic_id: 7951 reply_id: 28310[/import]

The script works fine in TextWrangler

Thank you [import]uid: 8366 topic_id: 7951 reply_id: 28312[/import]