473,797 Members | 3,183 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateO bject("WScript. Shell");
WshShell.Run("W inword");
while(1)
{
WshShell.AppAct ivate("Winword" );
WshShell.SendKe ys("A");
WScript.Sleep(5 000);
}

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

Steve Henderson
he*******@sbcgl obal.net
Jul 20 '05 #1
2 2974
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(somevaria ble < 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*******@sbcg lobal.net> wrote in message
news:dr******** ********@newssv r24.news.prodig y.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.CreateO bject("WScript. Shell");
: WshShell.Run("W inword");
: while(1)
: {
: WshShell.AppAct ivate("Winword" );
: WshShell.SendKe ys("A");
: WScript.Sleep(5 000);
: }
:
: =============== =============== =====
:
: Steve Henderson
: he*******@sbcgl obal.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
2189
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 (I do want to learn how to do it). What I have is a search page (HTML) and an access database. Now, can someone give me some clues or links on where to start. I prefer not to install the whole PHP thing on my own computer, but just to
0
9876
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 ********************************** package Celcom.Client;
0
1593
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 ‘Testxml' beneath) is parsed correctly and with the php sniplet: $counting=count($xmlC->obj_data->DATA->IP_RECORD); //to find out the number of elements in the array I can figure out how much IP_RECORD elements (=2) there are in the DATA array....
4
1131
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 only knew <script type="text/javascript" src="file.js"></script> Thanks
10
2936
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 routines that upload and process images. I can't get past "square one" with images in C#: This statement:
6
2990
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 page setup and that is working great. On my contact page I would like to use Google Maps API Version 2 to show a map to my location. Below is the first Google example. I would like to add this to my aspx page that is using the master page. I...
10
11524
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 script? files=glob.glob('*.py') print files Traceback (most recent call last):
2
3293
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
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10469
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10246
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10209
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.