Solved

Application Shutdown after every 30 mins

Posted on 2016-08-09
9
48 Views
Last Modified: 2016-08-29
Hi All,

Is there a way to shutdown the application on windows after every 30 mins if open.
This requirement is basically for the application which has time limit subscription or license and user complete the work but forget to close or shutdown the application.

Thanks,
Shail
0
Comment
Question by:Shailesh Shinde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 36

Expert Comment

by:Kimputer
ID: 41748610
Wow, that's harsh, what if they're mid-entry of a big text field?

Anyway, you can have the start icon in only one place, and let it be VBscript (start program, start timer, end timer with killing the process).

If you are writing the program yourself, build in the timer yourself (have warning screens towards the end of the timer).
0
 
LVL 12

Expert Comment

by:Benjamin Voglar
ID: 41748613
I will give you a example for notepad.exe with powershell.

Get-Process -Name notepad | Stop-Process -Force

Open in new window


just save this line in a .ps1 file and schedule it that it will run every 30 min,

https://support.software.dell.com/appassure/kb/144451
0
 
LVL 5

Expert Comment

by:Manuel Flores
ID: 41748619
Maybe I would try some kind of macro recorder which after a given time will;

1. Focus the application.
2. Press the keyboard shortcut to quit the application (operating system dependent).

Once started again the application, run the macro again.  In fact you could launch the application by macro instruction.

I user this in my mac; https://www.keyboardmaestro.com/main/

Macro example;

Macro example
Will check if there are something similar por Windows.
0
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 
LVL 36

Expert Comment

by:Kimputer
ID: 41748620
Above is of course a solution. BUT IF you schedule it for every 30 minutes, you risk a person working on it for one minute already being kicked out. (for instance, every 7.00, 7.30, 8.00, 8.30 etc it will close the app, think about a person starting the app at 8.29)
1
 
LVL 12

Accepted Solution

by:
Benjamin Voglar earned 500 total points (awarded by participants)
ID: 41748635
OK,  I agree.

I wrote a little script that will kill "notepad" application if the application is running more then 30 min.

You can schedule the task to ran the script every minute,

$time = New-TimeSpan -Start (get-process notepad).StartTime

if ($tim.minutes -lt 30) {


Get-Process -Name notepad | Stop-Process -Force


}

Open in new window

0
 
LVL 3

Author Comment

by:Shailesh Shinde
ID: 41749972
Hi,
Yes, the concerned has been raised by the dept. for the issue of loosing the data if user were working.
Can this be possible to check if the application is idle than close it or no action required.
However, from where I will get this info of idle or busy application?

Thanks,
Shail
0
 
LVL 36

Expert Comment

by:Kimputer
ID: 41750011
You can't really get that information.
Alternative methods (both unreliable):

- check if window is active (doesnt mean it's idle or not, just if it's the window is the active one, can't check if the user typed in the active window or not)
- check cpu usage (totally unreliable for programs that use very little CPU, even when user is typing it in, or when program uses some CPU even if idle)
0
 
LVL 3

Author Comment

by:Shailesh Shinde
ID: 41769842
Hi,
I have tried these options with the help of system admin.

- check if window is active (doesnt mean it's idle or not, just if it's the window is the active one, can't check if the user typed in the active window or not)
- check cpu usage (totally unreliable for programs that use very little CPU, even when user is typing it in, or when program uses some CPU even if idle)

But it does not give the CPU usage correctly as mentioned above and can't depend on these values really.

Thanks,
Shail
0
 
LVL 12

Expert Comment

by:Benjamin Voglar
ID: 41774466
This is what user wanted.
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question