Sign in to follow this  
Followers 0
GoogleDude

How to Make PID Active window?

7 posts in this topic

#1 ·  Posted (edited)

If I have more then 1 instance of a process how can I make one specific process the active windows. Like if I have 10 IEXPLORE.EXE process active but want to make 1 in paticular the active window. I can get the PID of said instance by using ProcessExsist but how can I make a PID the active window?

Thanks,

GoogleDude

Edited by GoogleDude

Share this post


Link to post
Share on other sites



If I have more then 1 instance of a process how can I make one specific process the active windows. Like if I have 10 IEXPLORE.EXE process active but want to make 1 in paticular the active window. I can get the PID of said instance by using ProcessExsist but how can I make a PID the active window?

Thanks,

GoogleDude

You're talking about processes but referring to active windows... that's a bucket of confusion... I'm going to assume you tried to "Google""Dude" and came up with nada as well.

If you need one Process to have priority over the others then look at ProcessSetPriority().

If you only want one instance of the process running, and you know the PID of the process you want to keep, then use:

ProcessList(ProcessName)

Loop

If PID <> myKeeperPID Then ProcessClose(PID)

Other than that, a bit more ... well... a lot more clarity is needed for me to help personally.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

OK.

I did check google but what I am after is more to AutoIt. Lets say I have 5 seperate IE windows open but minimized and I want to make one in paticular the active window and no longer minimized but rather maximized or just the Top window. How can I get the make one in paticular the activewindow so I can continue running my script in it.

Im trying to create a simple way to make Internet Explorer 7 be in a Single Windows mode by forcing to open new tabs rather than new IE Windows. I am using the below sloppy script just to get me started. I whipped up the below in like 5 mins. without getting carried away. The problem I am having is that if there is another non-IE window open that has the same text it makes that process the active one. I know there are 3rd part apps/dll that can make IE single window but I am tring to intigrate a few things into my script.

As I often do I might be way over-engineering the process/script.

Opt("WinTitleMatchMode", 2)
$InternetExplorerTitle = WinGetTitle("Internet Explorer", "")
If ProcessExists("iexplore.exe") Then
    WinActivate($InternetExplorerTitle)
    Send("{CTRLDOWN}t{CTRLUP}")
ElseIf Not ProcessExists("iexplore.exe") Then
    Run(@ProgramFilesDir & '\Internet Explorer' & '\iexplore.exe')
EndIf
Exit
Edited by GoogleDude

Share this post


Link to post
Share on other sites

Have you looked at the IE* functions? I believe you can keep working in the 1 instance (object handle) as you see fit.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Yeah I have but my wife keeps opening up second instance by clicking on the IE icon on the desktop. And yes I can remove the icon from the desktop but she is a little smarter than that. So in adittion to learning AutoIt a little more I figured I would give this Idea a shot. I am ultimatly trying to force IE to always operate in 1 window only by controlling it with AutoIt.

Thanks (yet again) for the feedback.

GoogleDude

Share this post


Link to post
Share on other sites

Yeah I have but my wife keeps opening up second instance by clicking on the IE icon on the desktop. And yes I can remove the icon from the desktop but she is a little smarter than that. So in adittion to learning AutoIt a little more I figured I would give this Idea a shot. I am ultimatly trying to force IE to always operate in 1 window only by controlling it with AutoIt.

Thanks (yet again) for the feedback.

GoogleDude

Then use the PID suggestion I gave in post 2

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Sorry but I just realized that I mixed up the situation in some of the above posts I made. In IE6 there was a new PID for ever IE window. Now in IE7 there is only 1 process for every window (at least for me). I was mearly trying to make IE only operate in Single Mode. So that if a new IE window was to open up (regardless of what opened the second window) then it will switch to the already opened window and create a new tab. Can a script sit and wait for any window to exsist even if its not the active window and when it detects a new non-active windows continue to run/loop? Or would that chew up CPU %/Cycles?

GoogleDude

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
Sign in to follow this  
Followers 0