Is it possible to create a condition that returns true based on the mouse position on the screen (for example if the mouse is on the bottom half of the screen) or if the cursor has changed to all-scroll (Tryit Editor v3.7)?
So my goal is to have one of these true:
Either the mouse is on the bottom half of the screen or
The cursor has changed to all-scroll
If one of them is true, then it goes to the next action
As you know, the first is (relatively!) easy -- we used pointer positioning in the "move window to top to resize" macro.
For the second -- it depends on what app you are using. The fact that it's a CSS property (unless you are just using that page to show what the cursor looks like?) implies a web browser, so you should be able to JavaScript query the current cursor property. If anything else you'll be better off looking for something else that changes when the cursor does -- maybe the availability of a particular menu item.
@noisneil
Question: if I wanted to set a particular location, instead of just half of the screen, let's say "639px" as my divider, how would that change the calculation?
I tried this calculation and I see that it no longer defines the middle as the divider:
MOUSEY() < SCREEN(Main,MidY)+300
Is this how to do it or is there a way to set the exact value?
Then unless there's a way to query the application itself (eg AppleScript), I think you're stuffed. For example, KM's Image Detection would only stand a chance if the pointer image was a square/rectangle and had a solid, unchanging, background.
If you want to use absolute coordinates for the mouse positioning, just type them in: MOUSEY() > 639 -- the function @noisneil used to determine the middle of the screen is so you can use the middle whatever size your main screen is at that moment, so you can easily use the macro on different machines or monitor configurations.
I have no clue about that and AppleScript is not my strength at all...
I wish KM would detect images with transparency, because that would make everything easier.
Will save this info in case I need this type of calculation. Thanks!
Yes, in this case I need a divider. So it's not that I need it to do something at exactly 639px. I want that to be a divider so if the mouse is above that number it does one thing, if it's below, it does another thing. That way I will be able to work around some of the issues, because when the cursor changes, it's always a little bit below the middle of the screen.
Ok so you're saying that the calculation I shared, is how you would do it?
I saw in the Wiki documents that instead of MidY we can use Height, but I don't know how to add a specific value to that. When I tried to add numbers, the calculation turned red. Is it possible to set a specific number instead of the +39 (or whatever number I need)?
This is the bit you need to define more carefully -- KM has no concept of "a little bit"
So:
Screen coordinates start at (0,0) in the top-left corner and get bigger as you head right (the first number) and down (the second)
You can get the horizontal middle of your main screen with SCREEN(Main,MidY)
If "a little bit" below that is 15 screen coordinate units, you've now got SCREEN(Main,MidY) + 15 (numbers get bigger as you go downwards, which is why you are adding)
Now you have a number to compare the pointer position to: MOUSEY() > SCREEN(Main,MidY) + 15, which returns "true" if the pointer's Y coordinate is greater than the screen's horizontal middle plus another 15 units
In plainer English, "Is my pointer lower than 15 units below the middle of the screen?".
I hope I'm not belabouring the point. I'd be totally lost listening to you guys talking about "scrubbing high BPMs through a pitch-shift wow-wow", or whatever it is you get up to -- but, like most things, once you've got the fundamentals and some of the jargon you'll find things a lot easier to understand.
My bad, I thought that was something different when I looked at it, because I thought I needed to add that to the other calculation with the SCREEN sizes, etc.
It's working now.
Yes, I got that logic of the middle of the screen before, but I was looking for a fixed number. When you suggested the MOUSEY() > calculation, I thought it was something else. My bad. It's working now Thanks!
IIRC it refers to this thread and was about dragging a window to the top of the screen to trigger a resize -- the mouse position bit was to determine if the mouse was in the menu bar.
You can always get the current pointer coordinates with the %CurrentMouse% text token or the MOUSEX() and MOUSEY() functions. Comparing it with other UI elements is where it can get tricky.
If you're trying to do something in particular, start a new thread with an appropriate title -- there's plenty of people here who are willing to help.