Hello,

So I created the following macro:

/*\
title: $:/macros/runProgram
type: application/javascript
module-type: macro

<<runProgram program parameters>>

Example:
<<runProgram '\"C:\\Program Files (x86)\\PuTTY\\putty.exe\"' >>
<<runProgram '\"C:\\Program Files (x86)\\PuTTY\\putty.exe\"' '-ssh -X'>>

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Information about this macro
This is written to have a javascript run a windows program  
*/

exports.name = "runProgram";

exports.params = [
{ name: "program" },
{ name: "parameters" }
];

/*
Run the macro
*/
exports.run = function(program, parameters) {
   alert(program + " " + parameters);
if( !program) return false;
if( !parameters) parameters = "";
    var shell = new ActiveXObject("WScript.Shell");                 
    var cmd = program + " " + parameters;
    shell.Run(cmd);
return true;
};

})();

I added the tag $:/tags/Macro and have it defined as $:/macros/runProgram 
(actual link 
file:///H:/PRAQUILONE/TiddlyWiki/PatCave.html#%24%3A%2Fmacros/runProgram).

Now this, if it would actually work inside of TW, would call out to shell 
and run an external windows program.  As an example, I would pass it the 
path and executeable to PuTTy and the IP address I want it to connect too.

I would like to have this where on another Tiddler, I have a link that 
calls this macro and passes it the program and the parameters (like Putty 
and "10.0.0.1" or whatever) and have it launch putty.  This javascript code 
will work if I make it a function inside an HTLM script tag and call in in 
from the anchor link as the href and launches the program.  I am hoping I 
can do the same.  But whenever I try to use this macro nothing happens. 
 Not sure if I messed up making or missed a step or what.

Would appreciate any help.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/31b1dab0-97e5-40d0-bd06-f839aa8856ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to