phenomxx4 Posted May 29, 2018 Share Posted May 29, 2018 hello guys,i have a problem with my autoit script,this is the original script: While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then Run("otherprocess.exe") EndIf WEnd my problem is when run this script,the script run milion of instances of "otherprocess.exe",this is not what i want. i want the script run "otherprocess.exe" and close after 1 second. Any help? Link to comment Share on other sites More sharing options...
RTFC Posted May 29, 2018 Share Posted May 29, 2018 #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then Run("otherprocess.exe") Sleep(1000) Exit EndIf WEnd phenomxx4 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
phenomxx4 Posted May 29, 2018 Author Share Posted May 29, 2018 no man for me it's not work,i explain my work so that you can understand my project #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then Run("otherprocess.exe") Sleep(1000) Exit EndIf WEnd with this i try to realize a app that run process.exe if the pc is in idle for 1 minute and stop process when pc is in activity,first i use this code: #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then ProcessClose("otherprocess.exe") EndIf WEnd and this script work perfectly but with this, the "otherprocess.exe" don't run if this script is in action,windows give me a error because the process is in use from script. so i want to run other process assembled with autoit when the pc is in idle which close the file "otherprocess.exe" Link to comment Share on other sites More sharing options...
phenomxx4 Posted May 29, 2018 Author Share Posted May 29, 2018 30 minutes ago, phenomxx4 said: no man for me it's not work,i explain my work so that you can understand my project #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then Run("otherprocess.exe") Sleep(1000) Exit EndIf WEnd with this i try to realize a app that run process.exe if the pc is in idle for 1 minute and stop process when pc is in activity,first i use this code: #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then Run("process.exe") ElseIf $idleTimer < 60001 Then ProcessClose("otherprocess.exe") EndIf WEnd and this script work perfectly but with this, the "otherprocess.exe" don't run if this script is in action,windows give me a error because the process is in use from script. so i want to run other process assembled with autoit when the pc is in use which close the file "otherprocess.exe" Link to comment Share on other sites More sharing options...
Subz Posted May 29, 2018 Share Posted May 29, 2018 Not sure if I understand but do you mean something like: #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 60000 And Not ProcessExists("process.exe") Then ProcessClose("otherprocess.exe") ProcessWaitClose("otherprocess.exe") Run("process.exe") ElseIf $idleTimer < 60001 And Not ProcessExists("otherprocess.exe" Then ProcessClose("process.exe") ProcessWaitClose("process.exe") Run("otherprocess.exe") EndIf WEnd phenomxx4 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now