Attach Mode Send key problem

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
cokelat70
Posts: 14
Joined: Mon Nov 17, 2008 7:37 am

Attach Mode Send key problem

#1 Post 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?
ImageImage
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#2 Post 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.
cokelat70
Posts: 14
Joined: Mon Nov 17, 2008 7:37 am

Re: Attach Mode Send key problem

#3 Post 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.
ImageImage
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#4 Post 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.
cokelat70
Posts: 14
Joined: Mon Nov 17, 2008 7:37 am

Re: Attach Mode Send key problem

#5 Post 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?
ImageImage
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#6 Post 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.
hlgnc
Posts: 6
Joined: Tue Feb 03, 2009 9:59 pm

Re: Attach Mode Send key problem

#7 Post 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
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#8 Post 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.
hlgnc
Posts: 6
Joined: Tue Feb 03, 2009 9:59 pm

Re: Attach Mode Send key problem

#9 Post 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();
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#10 Post by Administrator »

Post a copy of your log.txt found in the MicroMacro folder. I'm guessing that it's failing to attach input.
hlgnc
Posts: 6
Joined: Tue Feb 03, 2009 9:59 pm

Re: Attach Mode Send key problem

#11 Post 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:
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#12 Post 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.
hlgnc
Posts: 6
Joined: Tue Feb 03, 2009 9:59 pm

Re: Attach Mode Send key problem

#13 Post by hlgnc »

got the handle

Window: 0x50378

mabye something wrong with the attach(); or the game client nont allow to be attach();
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#14 Post 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.
hlgnc
Posts: 6
Joined: Tue Feb 03, 2009 9:59 pm

Re: Attach Mode Send key problem

#15 Post by hlgnc »

hi admin
the game i test : metin2 DE-sever. but u means just metin not metin2 :?:
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Attach Mode Send key problem

#16 Post 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.
User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: Attach Mode Send key problem

#17 Post 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.
Post Reply