Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Freeze Process if mouse is active, if inactive for 25 seconds then Resume Process

$
0
0

Having a bit of trouble. I went over the code so many times, I thought it out while I was half asleep and wrote it on my Note 2.. Everything seems right but it is not working. from start it just freezes, and stays froze . Please help!!

AutoIt         
DIM $MousePos Dim $MousePosChange Global $processtoSuspend = "notepad.exe" While 1     $MousePos = MouseGetPos()     sleep (1000)     $MousePosChange = MouseGetPos ()                 if $MousePos <> $MousePosChange then                     if ProcessExists ($processtoSuspend) Then _ProcessSuspend(ProcessExists ($processtoSuspend))                 Else                     $MousePos = MouseGetPos()                     sleep(25000)                     $MousePosChange = MouseGetPos()                         if $MousePos <> $MousePosChange then                                 if ProcessExists ($processtoSuspend) Then _ProcessSuspend(ProcessExists ($processtoSuspend))                         Else                                 if ProcessExists ($processtoSuspend) Then _ProcessResume(ProcessExists ($processtoSuspend))                         EndIf                 EndIf WEnd Func _ProcessSuspend($process) $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $process) $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) EndFunc Func _ProcessResume($process) $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $process) $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles