• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need a way to open an application and then automatically close after some time.

LittleNemoNES

Diamond Member
There is an app that I want users to use but it should auto close after 30 seconds or so after they finish
Is there a way to do this via batch files, etc?

Thanks! ^_^
 
How could a separate program know when the users are done using this application? For that matter, how would the application itself know that the users are finished and aren't simply idle (or doing something else) for 30 seconds?

If you are having an issue where your users are not closing a program when they should, I recommend implementing a policy similar to what we use at my office. We use an office management program that locks client files open when the program is open so that those files cannot be backed up, even using shadow copies. The files remain locked if the program is forced to close by Task Manager or anything similar.

Some users frequently "forgot" to close it so the boss decided to make it policy that if someone does not close the program when they leave for the night (causing the backup to fail) they have to put a quarter in a jar. Those quarters are added to the budget to buy snacks at the weekly office meeting for everyone who did not have to "donate" that week. Quarters don't really buy much, of course, but it's enough to help people remember to close the program. People still forgot frequently for a while, but there have been very few failed backups lately. 😉


In short, don't try to solve a personnel/training problem with software...
 
Hey thanks a lot for your input.

The app is a timecard so they don't need more than 30 seconds to use it.
They leave it open and it causes problems. We've tried training but it isn't cutting it.
besides, there are a lot of people (80) who need to use it.

I wish I could work in a place that was as laid back about breaking backups to just require a quarter ;-)
IMO that's TOO lax.

So knowing the nature of the app, is there a way to make it auto close after opening it 120 seconds or so later?

Thanks!
 
You could do this with a vbs script.
Basically it would launch the app
Sleep 30 seconds
Kill app via either WMI or the taskkill command.

Relatively simple script.
 
You could do this with a vbs script.
Basically it would launch the app
Sleep 30 seconds
Kill app via either WMI or the taskkill command.

Relatively simple script.


sounds like what I want.
Can you give me an example, please. Like with calculator. Idea is to plug in the directory of the app I want to run -- which is actually a shortcut to an application on a network drive...
 
Set objShell = CreateObject("Wscript.Shell")
cmd = "calc"
objShell.Run cmd
Sleep 30000

cmd="taskkill /IM calc.exe /F"
objShell.Run cmd
 
Set objShell = CreateObject("Wscript.Shell")
cmd = "calc"
objShell.Run cmd
Sleep 30000

cmd="taskkill /IM calc.exe /F"
objShell.Run cmd


Many thanks!

This is the syntax that worked for me:
Code:
Set objShell = CreateObject("Wscript.Shell")
cmd = "C:\TEST.lnk"
objShell.Run cmd
WScript.Sleep 30000
cmd="taskkill /IM TEST.exe /F"
objShell.Run cmd

:thumbsup:
 
Last edited:
Question -- what if other users have the same program open? How do I make sure it only kills the instance that the user started? I imagine through PID but I want the process to be automatic
 
Last edited:
I do not understand the question. Is this being run on a terminal server or individual users desktops?
 
I do not understand the question. Is this being run on a terminal server or individual users desktops?

TS server -- that's what makes it a little touchy. Using my script would close everybody's intance of the app...

A colleague and I are going to use powershell for this because the task is a little more complicated than it initially seemed.
 
Back
Top