Duplicates of this ticket: C767B8EF
|Status: closed, reported by adam.q.salter on 2008-05-16 (other)
Unable save document using Applescript
Following is a ruby script which should strip document of whitespace and save document.
I've been fiddling/mucking around with it for quite some time and come to the conclusion that it is failing because TextMate is mishandling Applescript 'tell document to save in alias' commands.
Note: requires 'rb-appscript' gem
#!/usr/bin/env ruby -rjcode -KU
doc = Application.by_name('TextMate').documents
doc_alias = MacTypes::Alias.path(doc.path.get)
doc.save(:in => doc_alias)
doc_text = STDIN.read
puts doc_text.gsub(/[\t ]+$/, '')
|Note added by Allan Odgaard on 2008-05-16 19:05:29|
Sorry, but current version of TextMate does not support AppleScript beyond _very_ few commands.