Attaching to Window with Wierd Name

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
eviltuna
Posts: 5
Joined: Wed Sep 24, 2008 9:34 pm

Attaching to Window with Wierd Name

#1 Post by eviltuna » Tue Mar 17, 2009 2:57 pm

I'm trying to make a bot in ESO http://eso.perfectworld.com/, but I'm having trouble getting getting micromacro to attach to the game window as it has a really wierd name in a chinese font. I've managed to make a list of all the windows but still haven't been able to attach to it. Is there a way to attach a window using an EXE?

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Attaching to Window with Wierd Name

#2 Post by 3cmSailorfuku » Tue Mar 17, 2009 6:55 pm

eviltuna wrote:I'm trying to make a bot in ESO http://eso.perfectworld.com/, but I'm having trouble getting getting micromacro to attach to the game window as it has a really wierd name in a chinese font. I've managed to make a list of all the windows but still haven't been able to attach to it. Is there a way to attach a window using an EXE?
http://solarimpact.servegame.com/wiki/i ... ocessByExe

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attaching to Window with Wierd Name

#3 Post by Administrator » Tue Mar 17, 2009 7:10 pm

Attached input doesn't work with this game. I've already got a (very) basic bot set up, but most of the input doesn't work when attached. Tabbing, for example, works, but pressing skill hotkeys doesn't.

eviltuna
Posts: 5
Joined: Wed Sep 24, 2008 9:34 pm

Re: Attaching to Window with Wierd Name

#4 Post by eviltuna » Tue Mar 17, 2009 7:54 pm

3cmSailorfuku wrote:
eviltuna wrote:I'm trying to make a bot in ESO http://eso.perfectworld.com/, but I'm having trouble getting getting micromacro to attach to the game window as it has a really wierd name in a chinese font. I've managed to make a list of all the windows but still haven't been able to attach to it. Is there a way to attach a window using an EXE?
http://solarimpact.servegame.com/wiki/i ... ocessByExe
I am talking about the attach() fuction, not the openProcessbyExe, I know about that. Thanks though.

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Attaching to Window with Wierd Name

#5 Post by 3cmSailorfuku » Wed Mar 18, 2009 8:20 am

eviltuna wrote:
3cmSailorfuku wrote:
eviltuna wrote:I'm trying to make a bot in ESO http://eso.perfectworld.com/, but I'm having trouble getting getting micromacro to attach to the game window as it has a really wierd name in a chinese font. I've managed to make a list of all the windows but still haven't been able to attach to it. Is there a way to attach a window using an EXE?
http://solarimpact.servegame.com/wiki/i ... ocessByExe
I am talking about the attach() fuction, not the openProcessbyExe, I know about that. Thanks though.
Actually I was talking about getting like that the Process ID, which can be used as far as I can remember.
Although it's important in what encoding you are saving your files if you use Strings that contain anything else than western standards.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attaching to Window with Wierd Name

#6 Post by Administrator » Wed Mar 18, 2009 11:01 am

I'm guessing you're looking for a function like findProcessByWindow() but in reverse (findWindowByProcess()). In that case, no. There is no such function at this time. You could still write a set of functions to find what you need.

First, just get a list of all windows (findWindowList("*") should work), then iterate through each element in the returned list and check it's paired process using findProcessByWindow(). Here's an example script using exactly this method:

Code: Select all

function findWindowByProcess(proc)
	local windowList = findWindowList("*");

	for i,v in pairs(windowList) do
		local thisProc = findProcessByWindow(v);
		if( thisProc == proc ) then
			return v;
		end
	end

	return nil; -- In case the process isn't found, return nil
end


function main()
	local notepadWin = findWindow("Untitled - Notepad");
	local notepadProc = findProcessByWindow(notepadWin);

	printf("win: 0x%X, proc: 0x%X\n", notepadWin, notepadProc);

	local foundWin = findWindowByProcess(notepadProc);
	printf("Found win: 0x%X\n", foundWin);
end
startMacro(main);
foundWin was exactly the same as notepadWin, which means it worked. Just copy/paste the findWindowByProcess() function into your script for now, as the function may be added to the core later. Since you should only be calling this once per execution, it shouldn't cause any slowdowns. Not that the code is overly heavy or anything.

eviltuna
Posts: 5
Joined: Wed Sep 24, 2008 9:34 pm

Re: Attaching to Window with Wierd Name

#7 Post by eviltuna » Wed Mar 18, 2009 2:18 pm

Thats exactly what I was thinking of doing, but since you did it already, thanks =D
Administrator wrote:I'm guessing you're looking for a function like findProcessByWindow() but in reverse (findWindowByProcess()). In that case, no. There is no such function at this time. You could still write a set of functions to find what you need.

First, just get a list of all windows (findWindowList("*") should work), then iterate through each element in the returned list and check it's paired process using findProcessByWindow(). Here's an example script using exactly this method:

Code: Select all

function findWindowByProcess(proc)
	local windowList = findWindowList("*");

	for i,v in pairs(windowList) do
		local thisProc = findProcessByWindow(v);
		if( thisProc == proc ) then
			return v;
		end
	end

	return nil; -- In case the process isn't found, return nil
end


function main()
	local notepadWin = findWindow("Untitled - Notepad");
	local notepadProc = findProcessByWindow(notepadWin);

	printf("win: 0x%X, proc: 0x%X\n", notepadWin, notepadProc);

	local foundWin = findWindowByProcess(notepadProc);
	printf("Found win: 0x%X\n", foundWin);
end
startMacro(main);
foundWin was exactly the same as notepadWin, which means it worked. Just copy/paste the findWindowByProcess() function into your script for now, as the function may be added to the core later. Since you should only be calling this once per execution, it shouldn't cause any slowdowns. Not that the code is overly heavy or anything.

eviltuna
Posts: 5
Joined: Wed Sep 24, 2008 9:34 pm

Re: Attaching to Window with Wierd Name

#8 Post by eviltuna » Wed Mar 18, 2009 2:19 pm

I've managed to attach to the window, but you are right, can't send any keys to it, except tab. I did try using AutoIt and was able to get keys sent using the Send() function, but ControlSend didn't work very well.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests