473,395 Members | 1,987 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,395 software developers and data experts.

Newby question - need a script to stop another script

I have really surprised myself and written a script that actually works!
<grin>. As you will be able to tell, I'm really, really new to this
scripting stuff... My script does a task and then sleeps for 5 seconds, and
does it again (which is what I want). My trouble is that I can't find a way
to stop it without pulling up "task manager" and killing it using brute
force. I think I can use the Popup method with a nsecondstowait value so
that everytime thru the while loop, it pops up and gives me a chance to push
an "OK" button to send the script to an exit, otherwise it times out, and
runs thru the loop again. However, the popup wants to come up in the exact
middle of my screen... and the REAL task I'm doing is to capture parts of
the screen that's changing. When the popup comes up, it gets captured (bad).
So I need another way to kill this thing. Can I write another little script
that will kill this one?

Just for an example, I submit this script below (not the actual one I'm
doing, to save space here). If someone can tell me how to kill this one, I
can apply that to my real one... this really sounds like it should be
simple, but I just can't figure it out...

Example.js (just brings up Word, and sends the character "A" to it over
and over...)
==================================
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("Winword");
while(1)
{
WshShell.AppActivate("Winword");
WshShell.SendKeys("A");
WScript.Sleep(5000);
}

===================================

Steve Henderson
he*******@sbcglobal.net
Jul 20 '05 #1
2 2944
Why post this question in this javascript ng?

Regards,
Erwin Moller
Jul 20 '05 #2
What you have is an infinite loop, which is why it never quits. What you
need is some variable at the end of the loop that increases its value by
1 each time through the loop. Then, instead of while(1) you write

....
while(somevariable < x)
{
...
somevariable = somevariable + 1
}

where x is set to some number 1 greater than the number of times you
want the loop to run.

HTH,

Dave

"Steve Henderson" <he*******@sbcglobal.net> wrote in message
news:dr****************@newssvr24.news.prodigy.com ...
: I have really surprised myself and written a script that actually
works!
: <grin>. As you will be able to tell, I'm really, really new to this
: scripting stuff... My script does a task and then sleeps for 5
seconds, and
: does it again (which is what I want). My trouble is that I can't find
a way
: to stop it without pulling up "task manager" and killing it using
brute
: force. I think I can use the Popup method with a nsecondstowait value
so
: that everytime thru the while loop, it pops up and gives me a chance
to push
: an "OK" button to send the script to an exit, otherwise it times out,
and
: runs thru the loop again. However, the popup wants to come up in the
exact
: middle of my screen... and the REAL task I'm doing is to capture parts
of
: the screen that's changing. When the popup comes up, it gets captured
(bad).
: So I need another way to kill this thing. Can I write another little
script
: that will kill this one?
:
: Just for an example, I submit this script below (not the actual one
I'm
: doing, to save space here). If someone can tell me how to kill this
one, I
: can apply that to my real one... this really sounds like it should be
: simple, but I just can't figure it out...
:
: Example.js (just brings up Word, and sends the character "A" to it
over
: and over...)
: ==================================
: var WshShell = WScript.CreateObject("WScript.Shell");
: WshShell.Run("Winword");
: while(1)
: {
: WshShell.AppActivate("Winword");
: WshShell.SendKeys("A");
: WScript.Sleep(5000);
: }
:
: ===================================
:
: Steve Henderson
: he*******@sbcglobal.net
:
:
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/2003
Jul 20 '05 #3

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

Similar topics

7
by: WindAndWaves | last post by:
Hi Gurus I am keen to make a search page on a website, but I have absolutely zero experience with PHP. I am going to hire an expert, but I thought that it may pay to try it a bit first myself...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: marco | last post by:
I'm trying to parse a xml bookmarkpage with php. I found a very useful example script about how you can parse a xml document with php. The scriptworks really smooth. The xml test document (See...
4
by: Ricardo Garcia | last post by:
hi, i´m starting to use javascript in my web, and i have a quite simple question: how can i call to a function which is in another .js file, giving it some parameters and receiving some data?? i...
10
by: Fred Nelson | last post by:
Hi: I have programmed in VB.NET for about a year and I'm in the process of learing C#. I'm really stuck on this question - and I know it's a "newby" question: In VB.NET I have several...
6
by: Sam Carleton | last post by:
Ok, over the years I have read about doing web programing and I have done some real basic stuff. Now I am digging into some real ASP.Net 2.0 and am totally lost some things. I have a master...
10
by: Charles Russell | last post by:
Why does this work from the python prompt, but fail from a script? How does one make it work from a script? #! /usr/bin/python import glob # following line works from python prompt; why not in...
2
by: alxasa | last post by:
Hi, I have a setInterval which executes its command every 10 seconds in a infinite loop. I've got something real basic like: var processes=0; function startme(){ if(stopthisloop>1)
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.