Sign in to follow this  
Followers 0
namedrisk

ControlClick, WinActive()

6 posts in this topic

Hi,

i currently have some process using pid etc and i was wondering if it is possible to restrict some how the controlclick, controlsend and winactive to read the given pid window ?

Let's say i have a window called XXX and it has no handlers on it... so the only way i have to send information to it is ControlSend('XXX','','',"{j}") for example.

So if i have 2 windows with the same name, the program would not know to which window send the command ... or perhaps it would send the commands to one of the 2 windows instead of sending to the window i wanted it to send the command to.

So what i needed is some sort of way to send the command to the window that has the pid X only for example...

anyone have any advices or can help me on this ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What about getting the PID's, then on PID1 you change the title to something a little different. Allowing you to use ControlSend on the window with the edited title.

Local $hWnd = WinGetHandle("Window Name")

Local $sHWND = String($hWnd

_WinAPI_SetWindowText($hWnd, "New Window Name")

No handles yeah? If so this is of not use to you, I understand correctly.

http://www.autoitscript.com/forum/index.php?showtopic=102785

This might be though ;]

Edited by BitByteBit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

i currently have some process using pid etc and i was wondering if it is possible to restrict some how the controlclick, controlsend and winactive to read the given pid window ?

Let's say i have a window called XXX and it has no handlers on it... so the only way i have to send information to it is ControlSend('XXX','','',"{j}") for example.

So if i have 2 windows with the same name, the program would not know to which window send the command ... or perhaps it would send the commands to one of the 2 windows instead of sending to the window i wanted it to send the command to.

So what i needed is some sort of way to send the command to the window that has the pid X only for example...

anyone have any advices or can help me on this ?

If there is more than one instance of this process running, you didn't say how you knew which PID to use. But I'll assume you figured that out already.

Just create a list of all windows with that name using WinList(). Go through the array and compare the PID returned by WinGetProcess() to the one you want. Once you have the handle to the correct window, use that in place of the title for all your functions, because the title might change but the handle won't for the life of the window.

:)

Note: One process can have multiple windows - something to keep in mind.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks the thing is that the windown presents no handlers from what i saw in the autoit program to gather information.

Actually i wasnt thinking about how to verify the pids yet hehe i was just wondering the possibility to do this first.

Thanks a lot for the help both of u i will try it out and see how it goes but one thing that may scare me is if changing the window name could cause me any harm i mean ...

It is a game called Aion so if i alter the window does the game detects that or is it a virtual naming or so ?

Share this post


Link to post
Share on other sites

Thanks the thing is that the windown presents no handlers from what i saw in the autoit program to gather information.

Actually i wasnt thinking about how to verify the pids yet hehe i was just wondering the possibility to do this first.

Thanks a lot for the help both of u i will try it out and see how it goes but one thing that may scare me is if changing the window name could cause me any harm i mean ...

It is a game called Aion so if i alter the window does the game detects that or is it a virtual naming or so ?

A warning: This site does not support violating the Terms Of Service (TOS) at game sites by botting with AutoIt. Aion is a fantasy MMORPG which probably has such a TOS.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
:) sorry about that ... autoit is such a powerfull tool, can't hold myself.

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