Skip to content

Commit

Permalink
changed run.vbs file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-cool08 authored Jul 30, 2022
1 parent 9524bf8 commit b03ad20
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions run.vbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
Set objShell = Wscript.CreateObject ("Wscript.shell")
do
dim islocked


call checklock



'=================================
'Functions
'=================================

function checklock
Dim computer : computer = "."

If WScript.Arguments.Count = 1 Then
computer = WScript.Arguments(0)
End If

If locked(computer) Then
Wscript.Quit
Else
do
WScript.Sleep(600000)
objShell.Run "python C:\users\%username%\usercheck\check.py"
loop
loop
wscript.sleep 3000 'for debugging - allow time to enter lock screen
End If
end function


Function locked(computer)
Dim wmi : Set wmi = GetObject("winmgmts://" & computer & "/root/cimv2")
Dim lockapp_count : lockapp_count = wmi.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'lockapp.exe'").Count
Dim explorer_count : explorer_count = wmi.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'explorer.exe'").Count
locked = (lockapp_count >= explorer_count)
End Function

0 comments on commit b03ad20

Please sign in to comment.