pressing the spacebar

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
guyash2
Junior Coder
Posts: 40
Joined: Thu May 05, 2005 2:45 pm

pressing the spacebar

Post by guyash2 » Wed May 03, 2006 9:51 am

Hi! :lol:
I have asked that question before in another topic but noone could help me..
I need help in pressing the spacebar. I have told that I need to write the script like that: send> ---> there is a space there.
this script works and write space but when I want to use this space press in flash games it doesn't work.. for example look at this game: http://www.miniclip.com/spaceinvaders.htm

when the macro scheduler "send> " nothing happens... the flash game doesn't recognize the space press... What can I do?

Thank you.

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

Post by Marcus Tettmar » Wed May 03, 2006 10:33 am

I don't see why it would make any difference but you could try this:

Let>VK_SPACE=32
Let>ExtendedKey=1
Let>KeyUp=2

LibFunc>user32.dll,keybd_event,r,VK_SPACE,0,0,0
Wait>0.2
LibFunc>user32.dll,keybd_event,r,VK_SPACE,0,KeyUp,0

If you want to keep the space key pressed for any length of time increase the Wait statement between the key down and the key up.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

guyash2
Junior Coder
Posts: 40
Joined: Thu May 05, 2005 2:45 pm

...

Post by guyash2 » Wed May 03, 2006 1:35 pm

Thank you but it still doesn't work..
I don't know why but the "LibFunc>" isn't recognized and it isn't in green...
and I don't need to hold the spacebar for some time I just need to press it once, like "press enter" or something like that...

Thanks.

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

Post by Marcus Tettmar » Wed May 03, 2006 2:00 pm

Which version of Macro Scheduler are you running? LibFunc was introduced with version 7.3.10. To just press the space bar use the script as provided.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

guyash2
Junior Coder
Posts: 40
Joined: Thu May 05, 2005 2:45 pm

Version

Post by guyash2 » Wed May 03, 2006 8:56 pm

The version of my macro scheduler is 7.2.050e

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

Post by Marcus Tettmar » Wed May 03, 2006 9:44 pm

Then you don't have LibFunc. As I said you need 7.3.10 or later. If you have 7.2 you can upgrade to 7.4.009 freely at http://www.mjtnet.com/dldregd.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

guyash2
Junior Coder
Posts: 40
Joined: Thu May 05, 2005 2:45 pm

it works!!!

Post by guyash2 » Thu May 04, 2006 2:59 pm

it works!!!!!! (with 8.0.1e version)

thank you very very very much :lol:

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Tue Jun 13, 2006 1:44 pm

Is it possible to use LibFunc for mouse clicks like left, right and middle mouse button?
I've done some research but can't wrap my head around the LibFunc :oops:

Thanks

Rain

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

Post by Marcus Tettmar » Tue Jun 13, 2006 2:01 pm

Rain wrote:Is it possible to use LibFunc for mouse clicks like left, right and middle mouse button?
What is wrong with the built in mouse commands:

LDown
LUp
LClick
LDblClick

MDown
MUp
MClick
MDblClick

RDown
RUp
RClick
RDblClick

LDown and LUp map to the lowest level system mouse events. LDown followed by LUp is an LClick. Two LClicks is an LDblClick. But with LDown and LUp you can put a delay in between to signify how long the mouse button is held down.

Yes, you could call API functions directly with LibFunc but it would make NO difference since that is precisely what the above commands do anyway.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Tue Jun 13, 2006 2:31 pm

Thanks for the quick reply.
There is nothing wrong with ldo, lup, lcl, ldb etc. all those commands work great.
Playing around with your awesome example scripts helps me to learn and understand the libfinc command. However, when I try to do something on my own I get stuck every time, even searching Google is not helping me.
Maybe I’m visiting the wrong websites, is there one you can recommend?

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

Post by Marcus Tettmar » Tue Jun 13, 2006 2:38 pm

Microsoft.com - contains the entire Windows SDK documentation
This one I have mentioned before also has a list of API functions and some examples in VB:
http://www.mentalis.org/apilist/apilist.php

The function you want for mouse events is quite remarkably called Mouse_event:

The mouse_event function synthesizes mouse motion and button clicks.

VOID mouse_event(

DWORD dwFlags, // flags specifying various motion/click variants
DWORD dx, // horizontal mouse position or position change
DWORD dy, // vertical mouse position or position change
DWORD dwData, // amount of wheel movement
DWORD dwExtraInfo // 32 bits of application-defined information
);


Parameters

dwFlags

A set of flag bits that specify various aspects of mouse motion and button clicking. The bits in this parameter can be any reasonable combination of the following values:

Value Meaning
MOUSEEVENTF_ABSOLUTE Specifies that the dx and dy parameters contain normalized absolute coordinates. If not set, those parameters contain relative data: the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section.
MOUSEEVENTF_MOVE Specifies that movement occurred.
MOUSEEVENTF_LEFTDOWN Specifies that the left button changed to down.
MOUSEEVENTF_LEFTUP Specifies that the left button changed to up.
MOUSEEVENTF_RIGHTDOWN Specifies that the right button changed to down.
MOUSEEVENTF_RIGHTUP Specifies that the right button changed to up.
MOUSEEVENTF_MIDDLEDOWN Specifies that the middle button changed to down.
MOUSEEVENTF_MIDDLEUP Specifies that the middle button changed to up.
MOUSEEVENTF_WHEEL Windows NT only: Specifies that the wheel has been moved, if the mouse has a wheel. The amount of movement is given in dwData


The flag bits that specify mouse button status are set to indicate changes in status, not ongoing conditions. For example, if the left mouse button is pressed and held down, MOUSEEVENTF_LEFTDOWN is set when the left button is first pressed, but not for subsequent motions. Similarly, MOUSEEVENTF_LEFTUP is set only when the button is first released.

dx

Specifies the mouse's absolute position along the x-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse's actual x-coordinate; relative data is given as the number of mickeys moved.

dy

Specifies the mouse's absolute position along the y-axis or its amount of motion since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is given as the mouse's actual y-coordinate; relative data is given as the number of mickeys moved.

dwData

If dwFlags is MOUSEEVENTF_WHEEL, then dwData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120.
If dwFlags is not MOUSEEVENTF_WHEEL, then dwData should be zero.

dwExtraInfo

Specifies an additional 32-bit value associated with the mouse event. An application calls GetMessageExtraInfo to obtain this extra information.



Return Values

This function has no return value.

Remarks

If the mouse has moved, indicated by MOUSEEVENTF_MOVE being set, dx and dy hold information about that motion. The information is given as absolute or relative integer values.
If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner.

If the MOUSEEVENTF_ABSOLUTE value is not specified, dx and dy specify relative motions from when the last mouse event was generated (the last reported position). Positive values mean the mouse moved right (or down); negative values mean the mouse moved left (or up).
Relative mouse motion is subject to the effects of the mouse speed and the two mouse threshold values. In Windows NT, an end user sets these three values with the Mouse Tracking Speed slider of Control Panel's Mouse option; in Windows 95, an end user sets them with the Pointer Speed slider of the Control Panel's Mouse property sheet. An application obtains and sets these values with the SystemParametersInfo function.

The operating system applies two tests to the specified relative mouse motion. If the specified distance along either the x or y axis is greater than the first mouse threshold value, and the mouse speed is not zero, the operating system doubles the distance. If the specified distance along either the x or y axis is greater than the second mouse threshold value, and the mouse speed is equal to two, the operating system doubles the distance that resulted from applying the first threshold test. It is thus possible for the operating system to multiply relatively-specified mouse motion along the x or y axis by up to four times.

The mouse_event function is used to synthesize mouse events by applications that need to do so. It is also used by applications that need to obtain more information from the mouse than its position and button state. For example, if a tablet manufacturer wants to pass pen-based information to its own applications, it can write a dynamic-link library (DLL) that communicates directly to the tablet hardware, obtains the extra information, and saves it in a queue. The DLL then calls mouse_event with the standard button and x/y position data, along with, in the dwExtraInfo parameter, some pointer or index to the queued extra information. When the application needs the extra information, it calls the DLL with the pointer or index stored in dwExtraInfo, and the DLL returns the extra information.

See Also

GetMessageExtraInfo, SystemParametersInfo
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Tue Jun 13, 2006 3:03 pm

Thank you so much for taking the time to reply and to point me in the right direction, this is exactly what I was looking for. :)

FYI, I did use the forums search feature but find it kind of aggravating when every time I click the back button to go back to the search result list I get the “Page has Expiredâ€Â

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Jun 13, 2006 6:37 pm

Yeah, that is annoying, the work around is to right click and use "open in new window".

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

Post by Marcus Tettmar » Tue Jun 13, 2006 6:41 pm

Hmm. This doesn't happen in Firefox. Must be an issue with IE. I'll see if there's a fix.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Jun 13, 2006 7:08 pm

It's been in phpbb bug tracker but was written off as being an IE problem, so the workaround is SMF :lol:

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