Jump to content
Sign in to follow this  
jweir2022

Auto Close a process if idle

Recommended Posts

jweir2022

Hi All,

 

Hoping someone can help with this.

I found a script that closes an app based on its name in the applications tab in task manager:

Opt("WinTitleMatchMode", 3) ;3 = exact title match
Opt("TrayIconDebug", 1)

$S_running = "check-4-app" ;name the script
If WinExists($S_running) Then Exit
AutoItWinSetTitle($S_running)

$title = "KCML Client"
$count = 0
While 1
    $state = WinGetState($title)
    $count += 1

    If $state = 15 or $state = 0 Then $count = 0

    If $count > 6 Then WinClose($title)

   ToolTip("count = " & $count, 0, 0, "state = " & $state)
    Sleep(1000)
WEnd

The problem is the name changes when a user navigates to a different screen in the app. 

I have tried to modify it so that it looks at the process. The problem i then had was the count stayed at -1 and would kill the program straight away.

 

Can anyone help?

 

Thanks in advance

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.