Jump to content

Recommended Posts

Posted

Hey,

I'm quite new to autoIT though I like its simplicity of use.

I made a script that closes all windows after 60 seconds of no mouse movement, but this opens up a shutdown screen as well in windows 7. (Not in windows 10)

How to stop this?

 

#include <MsgBoxConstants.au3>
Opt("WinTitleMatchMode", 3) ;3 = exact title match
Opt("TrayIconDebug", 1)

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

AutoItWinSetTitle($S_running)

$count = 0
$mousePos = MouseGetPos()
while 1
   $count += 1
   $mousePosNow = mouseGetPos()

   If $mousePosNow[0] <> $mousePos[0] Or $mousePosNow[1] <> $mousePos[1] Then $count = 0

   $mousePos = MouseGetPos()

   ;ToolTip("count = " & $count, 0, 0)

   If $count > 60 Then
      $count = 0
      $var = WinList ()
      $length = UBound($var) - 2
      For $i = 1 to $length
         If BitAnd (WinGetState ($var[$i][1]), 2) And $var[$i][0] <> "" AND $var[$i][0] <> "Program Manager" Then WinClose ($var[$i][1], "")
         Next
   EndIf
   Sleep(1000)
WEnd

What to do?

I used the $var[$i][0] <> "Program Manager" comparison to check for this screen but like i said this is not working in w7.

 

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
  • Recently Browsing   0 members

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