Jump to content
Macro Express Forums

Detecting a pane border?


Recommended Posts



Could someone point me to a macro that will let me size two panes in an application window please? I've attached a screenshot.




I can get the full window to its desired size and position using a program I have called Sizer. But the only way I can resize those two sections on the left is by dragging the mouse cursor. FWIW, when the mouse reaches the left border of the two it changes to something like this: <-||->. And when it reaches the one to the right, it becomes like this: <->.


Presumably I need a subroutine (section?) to drag the mouse rightwards from say x=100 px and detect when it reaches the first border. Then drag this border to a point at say x=500. Then do something similar with the second pane.


I'm hoping in particular that there is a well-tried macro for the detecting aspect?


Any suggestions will be appreciated please.



Terry, East Grinstead, UK

Link to comment
Share on other sites

Sorted thanks. It was easier than I expected. For anyone else who ends up here with a similar query, here's the basic routine:


// Drags mouse rightwards until cursor changes to colour 13160660
Repeat Start (Repeat 800 times)
 Mouse Move Position 1, 0
 Delay 4 Milliseconds
 Get Pixel: Under Mouse into %N1%
 If Variable %N1% = 13160660
   Text Box Display: Cursor change 1
 End If
Repeat End
Macro Return


If there's a neater way, I'd appreciate seeing it please.


Incidentally, I first experimented with using the Wait for Mouse Cursor command, set to <-||->. (MacroExpress calls that 'Horizontal Split'. Surely it should be 'Vertical Split'?) Anyway, that just didn't work. Even with the changed cursor showing for several seconds. Yet it did work with the other cursor, <->.



Terry, East Grinstead, UK

Link to comment
Share on other sites

I like your idea of using the mouse cursor for edge detection. Usually I use colors but colors are often different from machine to machine so the cursor idea is brilliant.


I don't think you can't use "Wait for Mouse Cursor" because the macro is moving the mouse and it would have already changed by the time it got the to the "Wait For". Generally all Wait Fors must rely on external action to activate them, not something from within the macro. Instead if I were you I would do incremental mouse moves at something like 4 pixels each step (just to save loops)(Needs to be something less than the actual width of the edge) and in that loop break If Cursor is the resize arrows.


Link to comment
Share on other sites

  • 2 weeks later...



I fiddled with your idea and the only thing that I can think of is to use the "capture" feature to drag the mouse after it detects the vsplit/hsplit. You would have to subtract/add to your N variable(which I'm sure you know and get the mouse to drag it for that long until it get to where you want it to go.







The only problem I am having for myself is the hsplit I am experimenting with is a BLACK SOLID LINE rather that <-||-> with that space in the middle. It's not detecting the solid line hsplit.


Why is there NO solid line hsplit/vsplit available?


Can any moderator venture to guess?



Link to comment
Share on other sites

Mouse cursor styles come from two different sources. Some are defined by Windows itself. However, an application may define one or more unique cursor styles. Macro Express supports all of the cursor styles supported by Windows but, due to technical limitations, it cannot support the unique styles from applications.


Wait for Mouse Cursor: Wait for Cursor Change was recently added to allow macros to detect that the cursor changed. This can be used as a work-around in some situations.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...