473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

JS alert & confirm in Windows Scripts

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.");
}

Thanks, Pete.

Jul 23 '05 #1
2 2255


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/
Jul 23 '05 #2
Thanks, Martin, that looks like what I needed, especially the links to
the docs. Without already knowing the keywords, searching the msdn
library was a nightmare.

Pete.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andy Fish | last post by:
Hi, now I know what the alert() function does, but can anyone tell me where I can find the specification or standards for functions like alert() and confirm(). They don't seem to be part of...
9
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP...
7
by: Tasha's Dad | last post by:
A description of the problem: 1) Go to a page with various settings and a timeout (forces re-login if over 10 minutes) 2) Before the timeout, make some changes to settings. 3) Press a "reset to...
2
by: Hans | last post by:
Hi! I have an asp application where I use a lot of javascript for validations etc and as it is today I use alert, confirm and prompt dialogs. Now we are adding support for unicode and I have...
11
by: Alistair Saldanha | last post by:
I'm looking for the event that is fired by Internet Explorer to an "alert": <SCRIPT> Alert("You already have a session open") </SCRIPT> The event would be webBrowser.Document.???? Much...
4
by: sonu | last post by:
How can we use alert and confirm method in asp.net application. i am working with application where i want to use confirm box before going for any operation. and same for alert box Sonu
3
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if...
8
by: Guy Cohen | last post by:
Hi all How do I present questions/messages to the user while I am in a CLICK event of a button ? I was told to look for javascript/vbscript but could not make it work. Please advise Guy
2
by: Méta-MCI | last post by:
Hi! From long time, I have problems with strings return, in Windows, by subprocess.Popen / stdout.read() Last night, I found, by hazard, than if the second byte equal 0, it's, perhaps, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.