How to copy simple Text control contents including variables? - Forum

Forum Navigation
You need to log in to create posts and topics.

How to copy simple Text control contents including variables?

I am displaying the current mouse position (with a timer) in a simple text (Text1) control. The user can also copy the current mouse position with a button:

SetVar "[Clipboard]" "[POST_X] [POST_Y]"

That works. But what I actually want is to copy the total contents of the simple text control including the descriptive text and the two mouse position variables), like so:

Your X mouse coordinate is: [POST_X]
Your Y mouse coordinate is: [POST_Y]

Depending on the actual mouse pointer position the results should then be something like:

Your X mouse coordinate is: 727
Your Y mouse coordinate is: 418

I tried it with SetVar "[Clipboard]" "[Text1]"

but this does not seem to copy anything...

What am I doing wrong?

@talker

At design time, In the TextEntry Box shown within the General section, type in [Text1].

Then populate this variable like so ...

SetVar "[Text1]" "Your X mouse coordinate is: [POST_X][#13][#10]"
SetVar "[Text1]" "[Text1]Your Y mouse coordinate is: [POST_Y]"

... and then ...

SetVar "[Clipboard]" "[Text1]"

... will work as expected

Note: [#13][#10] is the new line control code (in a Windows system)

Vadim and proforma.guyot have reacted to this post.
Vadimproforma.guyot

@Gaev

That works a treat :-).

Thank you so much!