desertcolt Posted August 17, 2005 Posted August 17, 2005 I am writing a code to copy a file from source to destination . I am grabing the PID of process . The following code will work if ProcessExists . How if I want that "if process does not exists" and I want to do copy in that scenario without using ELSE condition, If (ProcessExists($pid)) Then $pid = Run($CPY & " " & $SRC & " " & $DST) EndIf
w0uter Posted August 17, 2005 Posted August 17, 2005 if NOT processExist ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
ElwoodB Posted January 27, 2022 Posted January 27, 2022 Hum, according to the documentation, ProcessExists($pid) should not work as this function expects a process name and not a PID. Or is the documentation wrong? PhilippeAmiga user
Developers Jos Posted January 27, 2022 Developers Posted January 27, 2022 Why post a not really related question in a 16 years old thread? ... and why not first open the helpfile to check as you would have found that either will work? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ElwoodB Posted January 27, 2022 Posted January 27, 2022 1 hour ago, Jos said: Why post a not really related question in a 16 years old thread? ... and why not first open the helpfile to check as you would have found that either will work? 1) because it's still wrong from my point of view. 2) Quote Parameters process The name or PID of the process to check. Source : https://www.autoitscript.com/autoit3/docs/functions/ProcessExists.htm 3) It's nowhere mentioned that using the PID as as argument works. 4) in my very small test, it doesn't work 4 good reasons to update this thread, IMO. PhilippeAmiga user
Developers Jos Posted January 27, 2022 Developers Posted January 27, 2022 2 minutes ago, ElwoodB said: 3) It's nowhere mentioned that using the PID as as argument works. Seriously? You sure you read the whole line in the right hand box? Quote The name or PID of the process to check ElwoodB 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ElwoodB Posted January 27, 2022 Posted January 27, 2022 4 minutes ago, Jos said: Seriously? You sure you read the whole line in the right hand box? Arghh, I read that many times. Sorry 😞 As I have a problem in my code (which seems related to passing arguments to a Func), I thought the manual could be wrong. I need to sleep. 🙂 Thanks for highlithing the "or". PhilippeAmiga user
Developers Jos Posted January 27, 2022 Developers Posted January 27, 2022 Check whether the PID you are checking is running at the same Credentials level as your script as it might be you need Adminlevel access for it to check. ElwoodB 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ElwoodB Posted February 5, 2022 Posted February 5, 2022 Thanks for your time, Jos. I was Run-ing "mstsc.exe" and I found out that it spawns a new process immediately so the new process had a new PID and ProcessExists() could not find it obviously. So I had to rely on WinWait() to catch the window opened by Mstsc. So in the end I was fooled by MS, again 😛 PhilippeAmiga user
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