[TxMt] Re: HTML output window: JavaScrip alert() and confirm()

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Sep 25 13:16:48 UTC 2008


And, hoepfully, finally I fixed the issue if you do this

try{...} catch(e) {alert(e)}

and e is an object

then this will work in a browser but for "$DIALOG" one has to write  
"e.toString()" that's why:


<script type="text/javascript" charset="utf-8">
     try {
         if (TextMate.system("", function (task) { })) {
             var __TM_confirm_Status;
             alert = function(s){TextMate.system("\"$DIALOG\" -e -p  
'{messageTitle=\"JavaScript\";informativeText= 
\""+s.toString().replace(/\x27/g,"’").replace(/\"/g,'\\\"') 
+"\";}'",null);};
             confirm = function(s){TextMate.system("\"$DIALOG\" -e -p  
'{messageTitle=\"JavaScript\";informativeText= 
\""+s.toString().replace(/\x27/g,"’").replace(/\"/g,'\\\"') 
+"\";buttonTitles=(\"OK\",\"Cancel 
\");}'",null).onreadoutput=function(s){if(s==1) 
{__TM_confirm_Status 
=false}else{__TM_confirm_Status=true}};return(__TM_confirm_Status)};
         }
     } catch(e) {}
</script>


Puuuh,

--Hans




More information about the textmate mailing list