aa2zz6

What function should I use?

4 posts in this topic

#1 ·  Posted

What's the difference between ProcessExists and WinExists. Which is more beneficial to use? I've used both of these in several scripts but they seem pretty similar as far as functionality goes. 

Share this post


Link to post
Share on other sites



#2 ·  Posted

WinExists = Window Exists
ProcessExists = Process Exists

If a process doesn't include a window how would you detect?

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted

When you use Ctrl Alt Delete to bring up the TaskManager, you can view processes that are runnng on your machine, many don't have windows, and WinExists can't see them.

So basically there is a Big Difference Between a program without a Window, and those that have them.

1 person likes this

Share this post


Link to post
Share on other sites

#4 ·  Posted

To clarify a bit more, ProcessExists() can use a PID (a unique Process ID) or a process name (ex. notepad.exe) to identify the program. WinExists can use a handle (unique hex value of a window, like the AutoIt SciTe editor), the window title, or class. You can have multiple processes with the same name (i.e., you can run however many notepad.exe programs as you want) and windows can have the same title and class (i.e., if you open 10 notepads all of them will start out with the title Untitled - Notepad).

It all depends on what you're trying to make your script do. It would be more beneficial to use ProcessExists if you're trying to monitor programs you started in your script using Run or ShellExecute, as they both return the PID of the process it starts (So no need to look for the handle). On the other hand most programs have their own unique titles so you don't need to worry about the handles if you don't start them. I've used process exists in a program, I started a while back, where I was downloading lots of files. Instead of having the main script download them I had it split all the urls into batches (so if I had 30 things to download, make 3 strings with 10 urls in each) and then start a script that takes the long string of urls as a parameter, splits them, and downloads them for me. My main script doesn't get interrupted waiting for InetGet to download everything and it just monitored the PID returned from Run.

1 person likes this

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