Jump to content

Process does not exists


Recommended Posts

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

Link to comment
Share on other sites

  • 16 years later...
  • Developers

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

Link to comment
Share on other sites

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.

Philippe
Amiga user

Link to comment
Share on other sites

  • Developers
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

 

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

Link to comment
Share on other sites

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

Philippe
Amiga user

Link to comment
Share on other sites

  • Developers

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

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

Link to comment
Share on other sites

  • 2 weeks later...

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 😛

Philippe
Amiga user

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...