Page 1 of 1

Attach Mode Send key problem

Posted: Wed Mar 11, 2009 3:38 am
by cokelat70
So I try something simple like this

Code: Select all

win = findWindow("Untitled - Notepad");
attach( win );
yrest(4000)
keyboardPress(key.VK_A);
detach()
it's look like doesn't working, but if I don't use attach it's working. I have try is using micromacro v0.9 or 1.0b. Any idea?

Re: Attach Mode Send key problem

Posted: Wed Mar 11, 2009 4:08 am
by Administrator
The key is being sent to the window, but not the correct widget. That is to say that it is working, just not in the way you had intended. It's just part of how the whole window-message system works.

Re: Attach Mode Send key problem

Posted: Wed Mar 11, 2009 7:38 am
by cokelat70
hmm, I see. So, is there a way to solve it?
because need it for chat channel in game, when I use shotcut key example 'S' using key.VK_S it's working, the problem when use key for chat it doesn't happen.

Re: Attach Mode Send key problem

Posted: Wed Mar 11, 2009 10:38 am
by Administrator
Not at this time, but it might be added very soon. The problem is going to be attaching input to different controls. Or, actually, knowing which control is which.

Edit: Actually, less work than I thought it would be. Download the latest 1.0 release here. Now, all you need to do is attach to the correct control. For example, to type stuff into Notepad, attach like this:

Code: Select all

attach( findWindow("Untitled - Notepad", "EDIT") );
It's up to you to figure out what the control name is for the object in the game you are trying to control is.

Re: Attach Mode Send key problem

Posted: Wed Mar 11, 2009 8:12 pm
by cokelat70
just 1 word "Awesome". :o

EDIT: there are something wrong it should be

Code: Select all

win = findWindow("Untitled - Notepad","EDIT");
right?

If that case, can you update for findWindowList too?

Re: Attach Mode Send key problem

Posted: Thu Mar 12, 2009 3:45 am
by Administrator
Oh, you're right. I've fixed my previous example in case anyone else reads this thread in the future. Other findWindow* functions will be updated after more testing.

Re: Attach Mode Send key problem

Posted: Fri Mar 13, 2009 4:50 am
by hlgnc
HI admin
i got same problem in metin2.
when i attach(win) , keyboardPress cant working.
I try findWindow("METIN2","contolID"); but there is no control in metin2

Re: Attach Mode Send key problem

Posted: Fri Mar 13, 2009 6:50 am
by Administrator
You don't need one for Metin. Last I checked, attached input worked just fine for it. Just attach as you normally would.

Re: Attach Mode Send key problem

Posted: Fri Mar 13, 2009 8:20 am
by hlgnc
THX for ADMIN`s reply.
the problem is when the game client on the top , the MicroMacro is working.
if not on the top. it will not work. something wrong with my code ?
the game METIN2 DE-SEVER.

Code: Select all

  
   attach(findWindow("METIN2"));
		while(true) do
		    yrest(200);
   keyboardPress( key.VK_SPACE);
   end
detach();

Re: Attach Mode Send key problem

Posted: Fri Mar 13, 2009 11:18 am
by Administrator
Post a copy of your log.txt found in the MicroMacro folder. I'm guessing that it's failing to attach input.

Re: Attach Mode Send key problem

Posted: Fri Mar 13, 2009 9:30 pm
by hlgnc
there is nothing in log.txt

Code: Select all

==================================================

Sat Mar 14 09:52:38 2009 : METIN2 Bot Version 0.10
Sat Mar 14 09:52:44 2009 : Execution success

Sat Mar 14 09:55:51 2009 : Executing script 'bot.lua'
==================================================
if i dont attach() , keysend is working . when attach() there is no log and
no key can be sent to game client.
there is no gamegurad or hackshield in the game METIN2 . :cry:

Re: Attach Mode Send key problem

Posted: Sat Mar 14, 2009 6:08 am
by Administrator
Make sure findWindow() isn't returning 0.

Code: Select all

win = findWindow("METIN2");
printf("Window: 0x%X\n", win);
attach(win);
See what it outputs for the window handle.

Re: Attach Mode Send key problem

Posted: Sat Mar 14, 2009 11:16 pm
by hlgnc
got the handle

Window: 0x50378

mabye something wrong with the attach(); or the game client nont allow to be attach();

Re: Attach Mode Send key problem

Posted: Sun Mar 15, 2009 12:05 am
by Administrator
Could be. Attached input doesn't work with every game. It really just depends on what input routines the game uses. I could have swore attached input worked with Metin, but perhaps I tested it with a different version than what you are playing.

Re: Attach Mode Send key problem

Posted: Sun Mar 15, 2009 3:59 am
by hlgnc
hi admin
the game i test : metin2 DE-sever. but u means just metin not metin2 :?:

Re: Attach Mode Send key problem

Posted: Sun Mar 15, 2009 7:39 am
by Administrator
I don't know what you just said, and I'm not even going to try to decipher it. If attached input doesn't work, just use 'normal' input. That's about all I can say.

Re: Attach Mode Send key problem

Posted: Sun Mar 15, 2009 8:39 am
by 3cmSailorfuku
hlgnc wrote:hi admin
the game i test : metin2 DE-sever. but u means just metin not metin2 :?:
Das ist nun völlig egal ob er ausversehen Metin oder Metin2 geschrieben hat.
Er wird sich auch nicht das Spiel runterladen um dir einen Kuchen zu backen, dass musst du schon selber machen.
Die controlID musst du selber herrausfinden.
Administrator wrote:I don't know what you just said, and I'm not even going to try to decipher it. If attached input doesn't work, just use 'normal' input. That's about all I can say.
He was confused because you had wrote Metin, instead of Metin2. Don't ask me, I didn't understood why he asked it too.
But I know that a few months ago, Attached input worked with Metin.