Hi,
I am new to Textmate. Great tool!
I love the persistent includes in the html-bundle. However I miss a method to update all files of a project at once. This topic was discussed earlier on this mailing list in 2007, but I could not find any follow up.
To work around this, I whipped up an apple script like this:
-- Update all persistent includes in Textmate
-- allow Apple Script to execute keystrokes tell application "System Events" to set UI elements enabled to true
-- choose the textmate-project-file set ProjectFile to (choose file with prompt "please choose Textmate-Project") -- TODO: check, if a valid projectfile was chosen
tell application "TextMate" to open ProjectFile tell application "TextMate" to activate
tell application "Finder" to set sourceFolder to folder of ProjectFile as alias tell application "Finder" to set Subfolders to every folder of folder sourceFolder
-- TODO: iterate through root folder and sub-sub-folders
repeat with EachSubDir in Subfolders tell application "Finder" to set filesList to (every file in EachSubDir whose name ends with ".html") repeat with htmldatei in filesList tell application "TextMate" to open htmldatei as text -- Wait one second to make sure the file is loaded delay 1 tell application "System Events" to keystroke "u" using {command down, control down} -- Wait one second to make sure the update is finished delay 1 end repeat end repeat
-- End of Apple Script
When you run it, it prompts you for the tmproject-file and opens all html-Files in the subfolders.
Has anyone a less ugly solution or any suggestion?
Thanks
Jan
Hi Jan,
Hard to believe that I wrote that little bundle 5 years ago now. Glad to see some people still find it useful! I've committed a new "Update Project / Selected Files" command for it. It doesn't use AppleScript, so hopefully that will make it a little faster. And it only processes files that has the "tminclude" tag in them. Hopefully it will make it's way to the core TextMate bundle soonish. Until then, if you want to pull from my fork to try it out, you'll find it here:
https://github.com/bradchoate/html.tmbundle
-Brad
On Sep 16, 2011, at 2:59 AM, Jan Lübke wrote:
Hi,
I am new to Textmate. Great tool!
I love the persistent includes in the html-bundle. However I miss a method to update all files of a project at once. This topic was discussed earlier on this mailing list in 2007, but I could not find any follow up.
To work around this, I whipped up an apple script like this:
-- Update all persistent includes in Textmate
-- allow Apple Script to execute keystrokes tell application "System Events" to set UI elements enabled to true
-- choose the textmate-project-file set ProjectFile to (choose file with prompt "please choose Textmate-Project") -- TODO: check, if a valid projectfile was chosen
tell application "TextMate" to open ProjectFile tell application "TextMate" to activate
tell application "Finder" to set sourceFolder to folder of ProjectFile as alias tell application "Finder" to set Subfolders to every folder of folder sourceFolder
-- TODO: iterate through root folder and sub-sub-folders
repeat with EachSubDir in Subfolders tell application "Finder" to set filesList to (every file in EachSubDir whose name ends with ".html") repeat with htmldatei in filesList tell application "TextMate" to open htmldatei as text -- Wait one second to make sure the file is loaded delay 1 tell application "System Events" to keystroke "u" using {command down, control down} -- Wait one second to make sure the update is finished delay 1 end repeat end repeat
-- End of Apple Script
When you run it, it prompts you for the tmproject-file and opens all html-Files in the subfolders.
Has anyone a less ugly solution or any suggestion?
Thanks
Jan
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate