Skip to main content
1-Visitor
December 10, 2010
Question

Last picked line is left selected after macro is run

  • December 10, 2010
  • 2 replies
  • 3964 views

I've done a few macros that ask the user to select a couple of points on a drawing and then the macro draws something based on the position of the points.

The problem is that despite adding 'select none' into the macro, a line at one of the selected points always remains selected after the macro has finished.

I've done a minimalist version below to illustrate the point.

macro test_select
message "Pick a point on your drawing"
define me as MouseEvent
define start_x as point
define start_y as point
me = Wait MouseClick
start_x = me.ptMMGrid.x
start_y = me.ptMMGrid.y
create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
select none

end macro

Theres no problem if you just pick an empty point on the drawing, but if the cursor snaps to a line or ellipse, that line or ellipse becomes selected and remains so after the macro finishes.

Is there a way to stop this?

    2 replies

    12-Amethyst
    December 10, 2010

    A quick, untested suggestion, is to insert another select none before creating the line.

    TimSharp1-VisitorAuthor
    1-Visitor
    December 10, 2010

    Thanks Trevor

    I originally had a select none both before and after creating the line but as it didn't work, I took one of them out!

    1-Visitor
    March 24, 2011

    Hi

    macro test_select
    message "Pick a point on your drawing"
    define me as MouseEvent
    define start_x as point
    define start_y as point
    me = Wait MouseClick
    start_x = me.ptMMGrid.x
    start_y = me.ptMMGrid.y
    create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
    select none

    "write macro for selecting any text - just to divert selection"

    select none

    end macro

    This is an untested answer.

    I hope this works

    TimSharp1-VisitorAuthor
    1-Visitor
    March 24, 2011

    Thanks Vaduga (or is it Nathan?) and welcome to the forums.

    I'll have a try using your suggestion of adding a bit to the macro to select again before exiting and see if it works

    1-Visitor
    July 1, 2011

    Hello Tim,

    macro test_select
    message "Pick a point on your drawing"
    define me as MouseEvent
    define start_x as point
    define start_y as point
    me = Wait MouseClick
    start_x = me.ptMMGrid.x
    start_y = me.ptMMGrid.y
    create line (start_x + 10) (start_y + 10) (start_x + 25) (start_y + 25)
    select none

    CUT

    Paste_samePosition

    Select none

    end macro

    Thanks & Regards

    Vaduga