Jump to content

Recommended Posts

Posted

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?

Posted
#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

 

Posted

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"

 

Posted
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"

 

 

Posted

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

 

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...