Permalink
Browse files

Use bundle id rather than application name.

Fixes #7 when both Coda 1 and Coda 2 are installed on the same system.
  • Loading branch information...
1 parent d2a5d60 commit 61fedd4064d97dc4c67527c1d5a15dc48bde343b @bobthecow committed May 27, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 coda
View
10 coda
@@ -94,10 +94,10 @@ def open_tabs():
scpt = """
set AppleScript's text item delimiters to "\n"
- tell application "Coda"
+ tell application id "%s"
%s
end tell
- """ % guts
+ """ % (bundle_id, guts)
if coda_is_running():
return [os.path.realpath(tab) for tab in filter(lambda a: a != "missing value", osascript(scpt).rstrip("\n").split("\n"))]
@@ -106,15 +106,15 @@ def open_tabs():
def new_tab_with_contents(text):
scpt = """
- tell application "Coda"
+ tell application id "%s"
activate
tell first document
make new tab
tell current editor to set contents to "%s"
end tell
end tell
"""
- osascript(scpt % (text or "").replace('\\', '\\\\').replace('"', '\\"'))
+ osascript(scpt % (bundle_id, (text or "").replace('\\', '\\\\').replace('"', '\\"')))
def read_stdin():
if sys.stdin.isatty(): # not a pipe, wait for more stdin
@@ -132,7 +132,7 @@ if options.lstabs:
exit()
if options.new_window and coda_is_running():
- osascript("tell application \"Coda\" to make new document")
+ osascript("tell application id \"%s\" to make new document" % bundle_id)
# solve the `ls | xargs coda` fake stdin issue...
stdin_text = None

0 comments on commit 61fedd4

Please sign in to comment.