Skip to content

Commit

Permalink
Use applescript to type text, for better compatibility with non-US la…
Browse files Browse the repository at this point in the history
…youts

Use tm_open_file instead of tm_get_url
  • Loading branch information
topfunky committed Sep 11, 2008
1 parent 590aefd commit 831e0af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/castanaut/movie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,19 @@ def drag(*options)
automatically "mousedrag #{options[:to][:left]} #{options[:to][:top]}"
end

##
# Sends the characters into the active control in the active window.
#

def type(str)
automatically "type #{str}"
execute_applescript(%Q'
tell application "System Events"
set frontApp to name of first item of (processes whose frontmost is true)
tell application frontApp
keystroke "#{str}"
end
end tell
')
pause 1
end

# Sends the keycode (a hex value) to the active control in the active
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/textmate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def tm_insert_text(text, as_snippet=false)
##
# Open a file, optionally at a specific line and column.

def tm_get_url(file_path, line=0, column=0)
def tm_open_file(file_path, line=0, column=0)
full_url = "txmt://open?url=file://#{file_path}&line=#{line}&column=#{column}"
execute_applescript(%Q`
tell application "TextMate"
Expand Down

0 comments on commit 831e0af

Please sign in to comment.