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.
-
zer0
- Posts: 213
- Joined: Sat Feb 16, 2008 11:55 pm
#1
Post
by zer0 » Thu Jun 26, 2008 11:56 pm
Hey, I'm using MicroMacro in Shaiya.
I'm trying to get it to run macro's in the message window with keyboardType() function:
an example:
Code: Select all
keyboardPress(key.VK_ENTER);
keyboardType("/partyinvite _someuser_");
keyboardPress(key.VK_ENTER);
The issue is that slashes "/", and "_" are not being entered. I took a look at micromacro's source, but I have no idea how to setup the project (I use CodeBlocks), and in the:
macro.cpp
void macro::keyboardType(std::string message)
There is some pretty low level coding going on which I don't really understand.
-
Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Fri Jun 27, 2008 1:23 am
Yeah, keyboardType() still needs to be fixed. The problem with it is that I can either make special cases for all symbols (which would probably break under different keyboard layouts), or need to rewrite the whole function. Actually, I'll work on that now.
-
zer0
- Posts: 213
- Joined: Sat Feb 16, 2008 11:55 pm
#3
Post
by zer0 » Fri Jun 27, 2008 1:46 am
That would be fantastic.
I tried compiling in CodeBlocks but I'm missing a bunch of libraries, and I can't b bothered figuring it out cause it takes a long time. To configure a development environment. Plus I'd be next to useless, cause at a quick glance I didn't understand ur code.
-
Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
#4
Post
by Administrator » Fri Jun 27, 2008 2:41 am
Not surprising. Sometimes, I don't even understand my code. But all joking aside, I do find it is harder to make sense of somebody elses code most of the time. And keyboardType() was a mess. Here's the new, revised keyboardType() that should work most of the time (although is kind of hackish).
Code: Select all
/* Function: keyboardType
Description:
Types the string passed to it, as if typed by the user.
*/
void macro::keyboardType(std::string message)
{
// http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx
for(unsigned int i = 0; i < message.length(); i++)
{
char thischar = message.at(i);
if( thischar == '\n' ) {
keyPress(VK_RETURN);
continue; }
char vk = VkKeyScan(thischar);
char keyscan = MapVirtualKey(vk, 0);
int capitol = ( thischar >= 'A' && thischar <= 'Z' );
int needshift = (thischar >= '!' && thischar <= '&') ||
(thischar >= '(' && thischar <= '+') ||
(thischar == ':') || (thischar == '<') || (thischar == '>') ||
(thischar == '?') || (thischar == '@') || (thischar == '^') ||
(thischar == '_') || (thischar >= '{' && thischar <= '~');
if( capitol || needshift )
keyHold(VK_SHIFT);
keybd_event(vk, keyscan, 0, 0);
rest(keyboardDelay);
keybd_event(vk, keyscan, KEYEVENTF_KEYUP, 0);
rest(keyboardDelay);
if( capitol || needshift )
keyRelease(VK_SHIFT);
}
}
I've just uploaded the fixed version to the server, so you can fetch it off the download page.
-
zer0
- Posts: 213
- Joined: Sat Feb 16, 2008 11:55 pm
#5
Post
by zer0 » Fri Jun 27, 2008 3:18 am
thanks allot.
I wasn't referring to ur coding style, just that I don't understand bitwise comparison/operators well. I'll test it now.
Who is online
Users browsing this forum: No registered users and 6 guests