Jump to content
phenomxx4

i have a problem with my autoit script

Recommended Posts

phenomxx4

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?

Share this post


Link to post
Share on other sites
RTFC
#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

 

  • Like 1

Share this post


Link to post
Share on other sites
phenomxx4

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"

 

Share this post


Link to post
Share on other sites
phenomxx4
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"

 

 

Share this post


Link to post
Share on other sites
Subz

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

 

  • Like 1

Share this post


Link to post
Share on other sites

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

×