1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

X,Y Coordinates

Discussion in 'Support' started by Rex Clark, Jun 21, 2008.

  1. Rex Clark

    Joined:
    May 30, 2008
    Messages:
    57
    Likes Received:
    0
    This would make an excellent plug-in feature anyone! or a built in function

    Having trouble finding Y axis don't really know where to look .. MSDN says something about point(ers) and structures if anybody can find a BTM script way to find the "Y" axis could mean a useful way to Draw without writing any btm code. using something like %@len[%@clip[]]

    DrawHline %y %x %@len[%@clip[]] 1 7 on 0

    The following script is able to find X axis with mouse movements

    cls
    setlocal
    *unset /q *
    setdos /s0:0 /x-678
    set xc=%@eval[%@winmetrics[0] \ %_columns]

    do forever
    set x=%@eval[%@unicode[%@winapi[user32.dll,GetCursorPos,BUFFER]] \ %xc]
    set xx=%@unicode[%@winapi[user32.dll,GetCursorPos,BUFFER]]
    set y=Unknown
    if %_kbhit == 1 leave
    screen %@eval[%_rows \ 3] 999 %@format[13,X_column=%X] %@format[13,X_Pixels=%xx]
    screen %@eval[(%_rows \ 3) + 2] 999 %@format[13,Y_row=%y] %@format[13,Y_Pixels=%y]

    enddo
    endlocal
    setdos /x0 /s100:10
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,056
    Likes Received:
    30
    On Sat, 21 Jun 2008 06:34:06 -0500, you wrote:


    This may help:

    ftp://lucky.syr.edu/4plugins/4sysutils.zip

    See _MOUSE.

    v:\> echo Mouse: X = %@word[0,%_MOUSE] and Y = %@word[1,%_mouse]
    Mouse: X = 1268 and Y = 1012

    Also see _MOUSEX and _MOUSEY in:

    ftp://lucky.syr.edu/4plugins/4conutils.zip

    v:\> echo Mouse: X = %_MOUSEX and Y = %_MOUSEY
    Mouse: X = 1268 and Y = 1012
     
  3. Rex Clark

    Joined:
    May 30, 2008
    Messages:
    57
    Likes Received:
    0
    ----- Original Message -----
    From: "vefatica" <>
    Sent: Sunday, June 22, 2008 4:44 AM
    Subject: RE: [Support-t-226] X,Y Coordinates


    : On Sat, 21 Jun 2008 06:34:06 -0500, you wrote:
    :
    :
    :
    : ---Quote---
    : > set x=%@eval[%@unicode[%@winapi[user32.dll,GetCursorPos,BUFFER]] \
    %xc]
    : > set xx=%@unicode[%@winapi[user32.dll,GetCursorPos,BUFFER]]
    : ---End Quote---
    : This may help:

    : Also see _MOUSEX and _MOUSEY in:
    :
    : ftp://lucky.syr.edu/4plugins/4conutils.zip
    :
    : v:\> echo Mouse: X = %_MOUSEX and Y = %_MOUSEY
    : Mouse: X = 1268 and Y = 1012

    It helped immensely or though 4conutils.zip doesn't exist, on the other hand
    4console.zip does
    Thank you very much

    If possible could I look at the source of the _mouseY function so I can
    better understand what @winapi[] function parameter(s) required
    I would still like away of finding Y coordinates in a btm fashion.

    Do you know if a MouseUp/Down/Left/Right button plugin exist.
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,056
    Likes Received:
    30
    On Sat, 21 Jun 2008 21:42:10 -0500, you wrote:


    SYSUTILS contains:

    v:\> click /?
    CLICK [/L(eft) | /M(iddle) | /R(ight)] [/2 (double) [x y]

    Defaults: single left click at current cursor position

    but it automatically does down/up.


    The source is below, but it's fairly easy to understand what's happening (if my
    guess is right). GetCursorPos(&pt) places the coordinates in a struct { LONG x;
    LONG y; } POINT. When you give the function BUFFER, it treats that buffer as a
    POINT struct and places two LONGs there. TCC treats that buffer as a string and
    unless pt.x is greater than 65535 it runs into a Unicode NUL (0x0000),
    terminating the string, before it gets to the y value.

    I just did _MOUSEX and _MOUSEY today, so they're not exactly robust.

    LONG GetMouse ( BOOL X )
    {
    POINT pt;
    GetCursorPos(&pt);
    return X ? pt.x : pt.y;
    }

    INT WINAPI _MOUSEX ( WCHAR * psz )
    {
    Sprintf(psz, L"%ld", GetMouse(TRUE));
    return 0;
    }

    INT WINAPI _MOUSEY ( WCHAR * psz )
    {
    Sprintf(psz, L"%ld", GetMouse(FALSE));
    return 0;
    }
     
  5. Rex Clark

    Joined:
    May 30, 2008
    Messages:
    57
    Likes Received:
    0
    ----- Original Message -----
    From: "vefatica" <>
    To: <rexxc@slingshot.co.nz>
    Sent: Sunday, June 22, 2008 3:53 PM
    Subject: RE: [Support-t-226] X,Y Coordinates


    : On Sat, 21 Jun 2008 21:42:10 -0500, you wrote:
    :
    : ---Quote---
    : >Do you know if a MouseUp/Down/Left/Right button plugin exist.
    : ---End Quote---
    : SYSUTILS contains:
    :
    : v:\> click /?
    : CLICK [/L(eft) | /M(iddle) | /R(ight)] [/2 (double) [x y]
    :
    : Defaults: single left click at current cursor position
    :
    : but it automatically does down/up.
    :
    CLICK RETURNS nothing .. at times it terminates console.

    I'm assuming that click by it self defaults to /left button ..according to
    inline help.
    It doesn't return click coordinates, tried @execstr[click] .. no results
    returned
    How do I use it
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,056
    Likes Received:
    30
    On Wed, 25 Jun 2008 02:54:39 -0500, you wrote:


    I think the only way it will terminate the console is if the click is a
    double-left on the console's system icon or a left on the console's "X" (just
    like the mouse).

    Quite simply, you use it as you would use the mouse. It's purpose is to push
    buttons (not to get information).

    Here's an example. Since FireFox automatically supplies my credentials, the
    command below logs me into the JPSoft forums, clicking on "Log in", and then, in
    my forum subscriptions, clicking on the Support forum. I used a script like
    yours to learn where the clicks should happen.

    v:\> start d:\FireFox\firefox.exe http://jpsoft.com/forums/usercp.php & delay 3
    & click 659 574 & delay 4 & click 382 451
     

Share This Page