Repeat a keyboard command when a button is pressed

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Repeat a keyboard command when a button is pressed

Post by mafiarat » Thu Feb 18, 2010 4:45 am

I am trying to make a macro that will repeatedly hit CTRL X over and over when a button is held down, so far i took the macro i found in another post which works, however i cannot figure out where or how to make it so it will hold down ctrl when i press the key for the macro.

//Use Shift + Esc to close this macro
//F8 key = VK119
OnEvent>Key_Down,VK119,0,MainMacro

SRT>MainMacro
send>a
Wait>0.01
END>MainMacro

Label>IdleLoop
Wait>0.01
Goto>IdleLoop

mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Post by mafiarat » Thu Feb 18, 2010 4:46 am

also, on a side note, i cannot get macro scheduler to use the hotkeys for a running macro in any game, windowed or full screen, they only work when not in anything requiring my graphics card.

mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Post by mafiarat » Sun Feb 21, 2010 1:37 am

hmm must be a dead forum...

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Feb 21, 2010 2:11 am

Board is usually very active. But I have not seen this posting before. Don't understand the old date of original postings.

Cannot test now, but maybe modify SRT like this:

Code: Select all

SRT>MainMacro
SetFocus>WindowName*
MouseMove>x,y            //x,y is cursor position before doing CTL-X if needed.
Press CTRL
Send>x
Release CTRL
Wait>0.01
END>MainMacro
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Post by mafiarat » Sun Feb 21, 2010 11:16 pm

well, that macro is what i've been trying to do, except i wanted it to hold ctrl and press x repeatedly when i hold down a key, then release ctrl when i stop pressing the key, i can get it to repeatedly press x, but not hold down ctrl, either way the reason i wanted it for a game i'm playing, however macro's do not effect the game for some reason, they only work in windows, regardless of full screen or windowed mode on the game. guess i'll just press the keys myself, its just a pain.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Feb 22, 2010 10:41 am

Hi,

You posted a question on Thursday and got a response on Sunday. Not bad for a peer to peer board IMO.

Anyway, this question has been asked before - search the forums for "Keybd_Event".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Post by mafiarat » Tue Feb 23, 2010 10:02 pm

right so, i've managed this, i know it does something, however not in the game i'm trying to get it to work in...

Code: Select all

SetFocus>Mount&Blade
OnEvent>Key_Down,VK119,0,start

srt>start
Press CTRL
Wait>0.01
Send>x
Wait>0.01
Release CTRL
Wait>0.01
end>start

Label>IdleLoop
  Wait>0.01
Goto>IdleLoop


User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 24, 2010 10:11 am

Like I said. Search for "Keybd_Event".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mafiarat
Newbie
Posts: 6
Joined: Thu Feb 18, 2010 4:33 am

Post by mafiarat » Sun Feb 28, 2010 12:23 am

that's all well and good, however when i search for "Keybd_Event" i do not find anything that sounds even close to what i'm trying to do.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts