How can I use InputBoxes in macros with JScript?
How can I use InputBoxes in macros with JScript ...
//according to: http://with-love-from-siberia.blogspot.de/2009/12/msgbox-inputbox-in-jscript.html //>>> var vb = {}; vb.Function = function(func) { return function() { return vb.Function.eval.call(this, func, arguments); }; }; vb.Function.eval = function(func) { var args = Array.prototype.slice.call(arguments[1]); for (var i = 0; i < args.length; i++) { if ( typeof args[i] != 'string' ) { continue; } args[i] = '"' + args[i].replace(/"/g, '" + Chr(34) + "') + '"'; } var vbe; vbe = new ActiveXObject('ScriptControl'); vbe.Language = 'VBScript'; return vbe.eval(func + '(' + args.join(', ') + ')'); }; /** InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context]) */ var InputBox = vb.Function('InputBox'); /** MsgBox(prompt[, buttons][, title][, helpfile, context]) */ var MsgBox = vb.Function('MsgBox'); //<<< function showMsgBox( ) { MsgBox("can you see this message box?", 4, "Answer the question!"); }