[TxMt] Find All?
Allan Odgaard
allan at macromates.com
Thu Sep 8 05:08:51 UTC 2005
On 08/09/2005, at 4.26, Gavin Kistner wrote:
>> I think Allan's asking for an HTML-based Find dialog. The TextMate
>> command would simply spit out the HTML form, and the embedded
>> JavaScript would implement the actual find operation.
> I suppose the part that's confusing me is how the JS performs a
> find operation...does the JS have access to run system commands?
Yes -- from the release notes:
For HTML output a 'TextMate' javascript object is now exposed
(property of window) with a system method that replicates the
dashboard system method (in the 'widget' object). The method is
documented here:
http://developer.apple.com/documentation/AppleApplications/
Conceptual/Dashboard_Tutorial/Scripts/chapter_12_section_1.html.
In addition it also has an “isBusy” property which you can set to
true/false to get the progress indicator. Here's a somewhat small
example of a clock (using “date”) which needs you to start it first
(for a version that allows you to stop the clock as well, see:
http://macromates.com:3000/read/chapter/2#page13):
cat <<'EOF'
<html><head><script>
function start () {
var cmd = "while true; do date; sleep 1; done";
var process = TextMate.system(cmd, function (task) { });
process.onreadoutput = function (str) {
document.getElementById("date").innerText = str;
};
}
</script></head>
<body><span id="start">
<a onClick="start()" href="#">Start</a></span>
<div id="date"></div></body></html>
EOF
More information about the textmate
mailing list