[TxMt] AppleScript template not working

Rasmus Malver rasmus at malver.dk
Tue Jul 12 20:37:38 UTC 2016


Since templates were discontinued I've been using this AppleScript to
make a quick HTML doc:

	#!/usr/bin/osascript
	tell application "System Events"
		keystroke "p"
 using {control down, option down, shift down}
		keystroke "4"
	"<!DOCTYPE html> <html lang=\"da\"> <head> <meta charset=\"utf-8\">
<title>$1</title> <meta name=\"description\" content=\"\"> <style
type=\"text/css\" media=\"screen\"> *{margin:0;padding:0;} $2 </style>
</head> <body> $0 </body> </html>"
	end tell

It’s been working fine until now. I’m on beta.11.8, and I’m very sorry,
but I don’t know if the problem arose with this update or one of the
ones from last week.

The problem is rather unusual. It appears that System Events is
reversing the order of the commands.

Instead of simulating the keyboard shortcut for selecting PHP, all of
the template is inserted via keyboard simulation, then 4 for PHP is
pressed and only THEN the shortcut is pressed. But it doesn’t go back to
working, if I reverse the sequence in the command code.

This is what it looks like:

Resultat

Here are the settings for the command:

Settings

Rasmus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160712/2934e929/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-07-12 at 22.09.54.png
Type: image/png
Size: 55470 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20160712/2934e929/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-07-12 at 22.24.13.png
Type: image/png
Size: 51316 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20160712/2934e929/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-07-12 at 22.24.13.png
Type: image/png
Size: 51316 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20160712/2934e929/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-07-12 at 22.09.54.png
Type: image/png
Size: 55470 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20160712/2934e929/attachment-0007.png>


More information about the textmate mailing list