Does anyone know if it is possible to change TextMate's display font via Applescript. I'd like to do this so that I can work in one font size, and print in another.
Advance thanks for any help.
-Brandon
Brandon Farr wrote:
Does anyone know if it is possible to change TextMate's display font via Applescript. I'd like to do this so that I can work in one font size, and print in another.
Should be possible with GUI scripting: http://www.apple.com/applescript/uiscripting/
So you'd either have AppleScript navigate the menus (View > Font > Bigger/Smaller) or fake keypresses ⌘+, ⌘-.
That said, there might be a better solution than AppleScript/GUI scripting, but I'm not aware of it.
On 28-mars-07, at 17:39, Henrik Nyh wrote:
Brandon Farr wrote:
Does anyone know if it is possible to change TextMate's display font via Applescript. I'd like to do this so that I can work in one font size, and print in another.
Should be possible with GUI scripting: http://www.apple.com/ applescript/uiscripting/
So you'd either have AppleScript navigate the menus (View > Font > Bigger/Smaller) or fake keypresses ⌘+, ⌘-.
That said, there might be a better solution than AppleScript/GUI scripting, but I'm not aware of it.
Applescript for "cmd +":[^1]
tell application "System Events" key code 69 using command down end tell
And for "cmd -"
tell application "System Events" key code 78 using command down end tell
You can duplicate the "key code..." lines if you need.
To make a TM command:
osascript <<-APPLESCRIPT tell application "System Events" key code 69 using command down end tell APPLESCRIPT
[^1]: I used the Numpad's + and - codes (69 and 78) as I don't have a + key on my french kb (it's "shift ="). Most apps accept "cmd =" instead of "cmd +", but not TM, so I have this command triggered by "cmd =". ;)
-- FredB http://geekthang.com