-
July 1st, 2003, 03:09 AM
#1
Starting and stopping Apps with a script
I'm puzzled with this problem:
I downloaded and installed a nice spam filter, called "email express!"
It seems to meet my needs, but I need a way to start and stop it when I start
and stop my dial up connection. If I leave the filter running when I'm off line, it
becomes unresponsive the next time I check the mail.
I copied and pasted and modified some VBScript code from the net:
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("%windir%\RUNDLL32.EXE RNAUI.DLL,RnaDial Internet")
WshShell.Run("C:\Progra~1\Emaile~1\EmailExpress!.exe")
ReturnCode = WshShell.Run("%windir%\RUNDLL32.EXE RNAUI.DLL,RnaDial Internet", 1, True)
So far, this script will start the connection, and the filter, but I've been unable to
discover a way to shut down the processes from a VBScript.
Am I barking up the wrong tree? My system is win98, and I also have perl on
the system, but don't know any perl either.
I came in to the world with nothing. I still have most of it.
-
July 1st, 2003, 03:24 AM
#2
The unix kill command has been ported to Win32..... you could use some *nix commands together.... ps x | grep <app name>, kill <yada>..... something along those lines.. I'll include a zip with the files... you can play around with them...
[EDIT]
I have also added the cut command, so you can cut the process id from the line you grep from the ps command... if you need assistance setting up the exact commands just let me know... I'm just too lazy to think that hard atm without prompting.
[/EDIT]
OK I got bored..... so here's some commands for ya..
ps x | grep <process name> | cut -f 2 will return the process number
and you can kill process number so then at the end I suppose you could just add | kill dunno if it accepts stdin tho... but i'm sure you can figure it out..
-
July 1st, 2003, 06:50 AM
#3
or you could download pstools from systernals.com run 'pslist -t' to get a tree view of processes running and in your script shell out to 'pskill processesname'
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
-
July 1st, 2003, 05:59 PM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|