Skip to main content
1-Visitor
Dec 10, 2010 5:03 PM UTC
Question

Last picked line is left selected after macro is run

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?

    5 replies

    12-Amethyst
    Dec 10, 2010 5:10 PM UTC

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

    Translate
    TimSharp1-VisitorAuthor
    1-Visitor
    Dec 10, 2010 5:13 PM UTC

    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!

    Translate
    1-Visitor
    Mar 24, 2011 5:56 AM UTC

    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

    Translate
    TimSharp1-VisitorAuthor
    1-Visitor
    Mar 24, 2011 3:20 PM UTC

    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

    Translate
    1-Visitor
    Jul 1, 2011 4:56 AM UTC

    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

    Translate