Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Anyone know of a utility or way to make another .exe load/close when triggered by a program opening/closing on windows 7
New Posts  All Forums:Forum Nav:

Anyone know of a utility or way to make another .exe load/close when triggered by a program opening/closing on windows 7

post #1 of 11
Thread Starter 
Looking for a script, variable or utility that can make a designated program .exe auto load upon opening the trigger application .exe and then terminate after the trigger application is closed, and if possible, have it terminate after say one minute after trigger application has been terminated.

Example: I want peerblock to auto load when I start utorrent, and when I close utorrent, I want peerblock to terminate after 1 minute.

I would prefer a utility or scheduler task, so that when I put this on my family systems, no one has to click any special .bat file to do it. Just start utorrent with the regular shortcut and have it automatically run the task. Is it possible?
Edited by porschedrifter - 5/9/13 at 3:37pm
    
CPUMotherboardGraphicsRAM
x8 AMD FX 9590 Crosshair Formula V Z Asus R9 390 Strix 8GB G.SKILL DDR3 2400 16GB 
Hard DriveCoolingOSMonitor
Enough XSPC CPU block - Phobya pump - Lightech Water T... W 10 Pro 64 Samsung 22'' 2253BW - LG 23'' IPS 
KeyboardPowerCaseMouse
Microsoft Natural OCZ Gold z1000 Fatality Thermaltake  Logi MX518 
Mouse PadAudio
Aluminum Dell XPS Behringer 192 USB mixer to Presonus Eris E5 stu... 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
x8 AMD FX 9590 Crosshair Formula V Z Asus R9 390 Strix 8GB G.SKILL DDR3 2400 16GB 
Hard DriveCoolingOSMonitor
Enough XSPC CPU block - Phobya pump - Lightech Water T... W 10 Pro 64 Samsung 22'' 2253BW - LG 23'' IPS 
KeyboardPowerCaseMouse
Microsoft Natural OCZ Gold z1000 Fatality Thermaltake  Logi MX518 
Mouse PadAudio
Aluminum Dell XPS Behringer 192 USB mixer to Presonus Eris E5 stu... 
  hide details  
Reply
post #2 of 11
Quote:
Originally Posted by porschedrifter View Post

Looking for a script, variable or utility that can make a designated program .exe auto load upon opening the trigger application .exe and then terminate after the trigger application is closed, and if possible, have it terminate after say one minute after trigger application has been terminated.

Example: I want peerblock to auto load when I start utorrent, and when I close utorrent, I want peerblock to terminate after 1 minute.

I would prefer a utility or scheduler task, so that when I put this on my family systems, no one has to click any special .bat file to do it. Just start utorrent with the regular shortcut and have it automatically run the task. Is it possible?

Yes but it will consume resources. You're better off just creating a batch file (it's simpler and would be just as effective).

Also, if you must download copyrighted content then I'd avoid using torrents as even peerblock is effectively useless against your activities being recorded:
http://torrentfreak.com/anti-piracy-blocklists-dont-keep-bittorrent-spies-out-120904/

and what's more, you'll be logged in around 3 hours - regardless of whether you're on a public track or most of the more popular private trackers:
http://dottech.org/79700/people-who-torrent-are-monitored-recorded-within-3-hours-of-download-study/

(and before anyone says "you can use torrents without being a pirate" - I fully agree. I have a torrent server that seeds creative commons works and open source ISO's. However programs like Peerblock are utterly pointless unless you're intending to keep spies out - and even then they're still useless)
post #3 of 11
I recommend autohotkey or autoit or some kind of macro.
Bandaids
(15 items)
 
  
MotherboardGraphicsHard DriveOptical Drive
Asrock Z77 Extreme 6 GTX 580 WD 10EALX ASUS DRW 
CoolingOSMonitorMonitor
Havik 140 Windows 7 Ultimate ASUS VH228T Toshiba 32RV600A 
MonitorKeyboardPowerCase
Compaq S2021a Microsoft Wired Keyboard 600 Aero Cool Strike X 1100w Asus Antec 
MouseMouse PadAudio
Logitech MX518 Mionix Ensis 320 Creative 2.1 
  hide details  
Reply
Bandaids
(15 items)
 
  
MotherboardGraphicsHard DriveOptical Drive
Asrock Z77 Extreme 6 GTX 580 WD 10EALX ASUS DRW 
CoolingOSMonitorMonitor
Havik 140 Windows 7 Ultimate ASUS VH228T Toshiba 32RV600A 
MonitorKeyboardPowerCase
Compaq S2021a Microsoft Wired Keyboard 600 Aero Cool Strike X 1100w Asus Antec 
MouseMouse PadAudio
Logitech MX518 Mionix Ensis 320 Creative 2.1 
  hide details  
Reply
post #4 of 11
You could use a python script similar to this one.
Code:
import os, subprocess, time

while True:
        p = subprocess.Popen("F:\\app")
        time.sleep(75)
        p.terminate()
        p = subprocess.Popen(""F:\\app")
        time.sleep(75)
        p.terminate()
        p = subprocess.Popen(""F:\\app")
        time.sleep(75)
        p.terminate()
        p = subprocess.Popen(""F:\\appf")
        time.sleep(75)
        p.terminate()
        p = subprocess.Popen(""F:\\app")
        time.sleep(75)
        p.terminate()

you could remove the while statement and you could remove the p.terminate() and the time.sleep(). But yea that probably would do something for you.
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #5 of 11
Sure.

First, make a special shortcut that runs this program (in C#, compile it with csc):
Code:
using System;
using System.Diagnostics;
using System.Threading;
class A
{
        static void Main()
        {
                using (Process proc = Process.Start("peerblock.exe"))
                {
                        Process procs = Process.Start("utorrent.exe");
                        procs.WaitForExit();
                        procs.Dispose();
                        Thread.Sleep(1000 * 60);
                        proc.Kill();
                }
        }
}
That'll open uTorrent + peerblock, and kill peerblock a minute after uTorrent finishes.
Edited by 3930K - 6/9/13 at 11:56pm
post #6 of 11
Quote:
Originally Posted by 3930K View Post

Sure.

First, make a special shortcut that runs this program (in C#, compile it with csc):
Code:
using System;
using System.Diagnostics;
using System.Threading;
class A
{
        static void Main()
        {
                using (Process proc = Process.Start("peerblock.exe"))
                {
                        Process procs = Process.Start("utorrent.exe");
                        procs.WaitForExit();
                        procs.Dispose();
                        Thread.Sleep(1000 * 60);
                        proc.Kill();
                }
        }
}
That'll open uTorrent + peerblock, and kill peerblock a minute after uTorrent finishes.
....or you could just have a text file name "torrent.bat" that has 3 lines in it:
Code:
start peerblock.exe
utorrent.exe
taskkill /im peerblock.exe
post #7 of 11
Quote:
Originally Posted by Plan9 View Post

Quote:
Originally Posted by 3930K View Post

Sure.

First, make a special shortcut that runs this program (in C#, compile it with csc):
Code:
using System;
using System.Diagnostics;
using System.Threading;
class A
{
        static void Main()
        {
                using (Process proc = Process.Start("peerblock.exe"))
                {
                        Process procs = Process.Start("utorrent.exe");
                        procs.WaitForExit();
                        procs.Dispose();
                        Thread.Sleep(1000 * 60);
                        proc.Kill();
                }
        }
}
That'll open uTorrent + peerblock, and kill peerblock a minute after uTorrent finishes.
....or you could just have a text file name "torrent.bat" that has 3 lines in it:
Code:
start peerblock.exe
utorrent.exe
taskkill /im peerblock.exe
Not quite, would actually be
Code:
start peerblock.exe
start /w utorrent.exe
TIMEOUT /T 60 /NOBREAKS
taskkill /im peerblock.exe
post #8 of 11
Quote:
Originally Posted by 3930K View Post

Not quite, would actually be
Code:
start peerblock.exe
start /w utorrent.exe
TIMEOUT /T 60 /NOBREAKS
taskkill /im peerblock.exe

You don't need "start" in batch programmes because they're run in a Windows command line rather than DOS emulator. The only reason I had "start" in the first line was to ensure that the process was forked. And the timeout is completely superfluous.
post #9 of 11
Quote:
Originally Posted by Plan9 View Post

Quote:
Originally Posted by 3930K View Post

Not quite, would actually be
Code:
start peerblock.exe
start /w utorrent.exe
TIMEOUT /T 60 /NOBREAKS
taskkill /im peerblock.exe

You don't need "start" in batch programmes because they're run in a Windows command line rather than DOS emulator. The only reason I had "start" in the first line was to ensure that the process was forked. And the timeout is completely superfluous.
He asked for the timeout, and also in Windows (at least on my version of Windows) you need to do start /w to wait for exit.
post #10 of 11
Quote:
Originally Posted by 3930K View Post

He asked for the timeout,
So he did. Though I'm not really sure why he wants a time out - it still seems superfluous to requirements. but you're right that he did request it.
Quote:
Originally Posted by 3930K View Post

and also in Windows (at least on my version of Windows) you need to do start /w to wait for exit.
Oh yeah. Sorry mate. redface.gif
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › Anyone know of a utility or way to make another .exe load/close when triggered by a program opening/closing on windows 7