Little Pete wrote:
I use a simple .js script to shuffle files on my computer to which I'd
like to add alert and confirmation boxes. Unfortunately I haven't been
able to figure out what object I need to create that has these methods.
What is missing from this .js script:
var source = "source.txt";
var destination = "destination.txt";
if (confirm("Make Changes?"))
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFile(source, destination, true);
alert("Changes made.");
}
else
{
alert("No changes made.");
WScript.Echo("No changes made.")
will display on the console (when the script is run with cscript) or as
an alert dialog (when the script is run with wscript).
To have a confirm dialog you can use the WScript.Popup method, see the
documentation
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsoriWindowsScriptHost.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsMthPopup.asp>
You can also download that documentation and then you have the help on
your pc.
--
Martin Honnen
http://JavaScript.FAQTs.com/