[TxMt] Update all persistent includes

Jan Lübke jan.luebke at gmx.de
Fri Sep 16 09:59:51 UTC 2011


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110916/2a5b229f/attachment.html>


More information about the textmate mailing list