Jump to content

Shut Down Certain Programs


Recommended Posts

Hi all, new to the script thing so please bare with me... I needed a script to run in the back ground to shut off certian apps after a certain time of day. a friend helped me, and wrote this script. It worked great to monitor 1 app such as msn messenger.... but when I added a second app such as iexplorier.exe and or msmng.exe ( windos messenger) it seemed to stop shutting down the apps, stopped working. any ideas??? should I set a diff scritp to monitor each app I want shut down at a given time????

; Script Start

;Monday - Friday restricted 18:00-21:00

;Saturday and Sunday unrestricted

#notrayicon

;Name of the process to monitor.

$proc="iexplore.exe"

$proc="msnmsgr.exe"

;$proc="gaim.exe"

;Start Time Restriction

$S=18

;End Time Restriction

$E=21

while 1

if @wday <> 1 or @wday<>7 then

if ProcessExists($proc) and @hour < $S Or @hour >= $E then

processclose($proc)

EndIf

sleep(2000)

wend

Link to comment
Share on other sites

I think this might work.

; Script Start

;Monday - Friday restricted 18:00-21:00
;Saturday and Sunday unrestricted

#notrayicon

;Name of the process to monitor.
$proc="iexplore.exe"
$proc1="msnmsgr.exe"
$proc2="gaim.exe"

;Start Time Restriction
$S=18

;End Time Restriction
$E=21


while 1
if @wday <> 1 or @wday<>7 then
if ProcessExists($proc) and @hour < $S Or @hour >= $E then
processclose($proc)
EndIf
sleep(2000)

if @wday <> 1 or @wday<>7 then
if ProcessExists($proc1) and @hour < $S Or @hour >= $E then
processclose($proc1)
EndIf
sleep(2000)

if @wday <> 1 or @wday<>7 then
if ProcessExists($proc2) and @hour < $S Or @hour >= $E then
processclose($proc)
EndIf
sleep(2000)
wend

Let me know if it doesn't

Link to comment
Share on other sites

Hi,

try soemthing like this:

; Script Start

;Monday - Friday restricted 18:00-21:00
;Saturday and Sunday unrestricted

#notrayicon

;Name of the process to monitor.

Dim $procArray = StringSplit('iexplore.exe,msnmsgr.exe,gaim.exe', ',')

;Start Time Restriction
$S = 18

;End Time Restriction
$E = 21


While 1
    If @WDAY <> 1 Or @WDAY <> 7 Then
        For $i = 1 To UBound($procArray) -1
            If ProcessExists($procArray[$i]) And @HOUR < $S Or @HOUR >= $E Then
                ProcessClose($procArray[$i])
            EndIf
        Next
    EndIf
    Sleep(5000)
WEnd

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...