royalmarine Posted February 23, 2012 Share Posted February 23, 2012 hi guys, this works, but not as well as id like. is there anyway i can improve it? I will be replacing the notepad.exe process with another program. While 1 Ping("192.168.1.2", 250) If @error = 0 And ProcessExists("notepad.exe") Then ProcessClose("notepad.exe") sleep(1000) ElseIf @error = 0 Then Sleep(1000) Else Run("notepad.exe") sleep(1000) EndIf sleep(1000) WEnd Link to comment Share on other sites More sharing options...
AlmarM Posted February 23, 2012 Share Posted February 23, 2012 This is how I would write it. While Sleep(1000) Ping("192.168.1.2", 250) If (Not @error And ProcessExists("notepad.exe")) Then ProcessClose("notepad.exe") Sleep(1000) ElseIf (Not @error) Then Sleep(1000) Else Run("notepad.exe") Sleep(1000) EndIf WEnd But, what do you want to improve? What's "but not as well as I'd like" ? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
royalmarine Posted February 23, 2012 Author Share Posted February 23, 2012 cheers almarM, using the not true statement makes more sense. ive modified it going on your alteration, and this seems to work a lot better. While Sleep(3000) Ping("192.168.1.2", 250) If (Not @error And ProcessExists("notepad.exe")) Then ProcessClose("notepad.exe") Sleep(3000) ElseIf (Not @error) Then Sleep(3000) Else If (Not ProcessExists("notepad.exe")) Then Run("notepad.exe") Else Sleep(500) EndIf Sleep(500) EndIf WEnd I think where I was going wrong and thus the "not as id like it to" remark was the final statement I added in which the program doesnt open multiple times, but closes once the condition is met. cheers for the help! 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