Page 1 of 1

Copying variable values to clipboard

Posted: Tue Jul 14, 2020 2:14 am
by JackieBlue1970
Hi Folks.

When debugging, is there some way to copy the value stored when you break or step through code? I can see the value in the watch tab (or whatever the official name is) but you cannot highlight and copy it. I can think of some ways to get around it such as putting a text box and populate but this seems a silly way to do this. TIA

Re: Copying variable values to clipboard

Posted: Tue Jul 14, 2020 4:31 am
by dunbarx
Hi.

If I understand what you are asking, when execution has halted during debugging, if you double click on a variable in the variable pane, that variable and its contents will be presented in a small stack window. From there, you can select and copy either the contents of that variable, or, in fact the variable itself. The clipboard will hold what you select.

This works as well for array variables.

Craig

Re: Copying variable values to clipboard

Posted: Tue Jul 14, 2020 1:16 pm
by bogs
As Craig says, or you can click on the box with the pen (2. edit), you can also search for specific variables using 1. the search box.
aPic_copyVariables.png
Copy, get your copy here...

Re: Copying variable values to clipboard

Posted: Tue Jul 14, 2020 4:50 pm
by JackieBlue1970
Thanks folks. Not sure why you have to enable an additional edit action, instead of just making it eligible to copy right off though.

Re: Copying variable values to clipboard

Posted: Tue Jul 14, 2020 5:27 pm
by dunbarx
Wee, I guess what you are asking is to be able to select the value of a variable right in the variable pane. Currently, if you have:

Code: Select all

on mouseUp
put "aaa" & return & "bbb" & return & "ccc" into temp
breakpoint
you will see that temp contains three lines, which is visible (AND EDITABLE) in the small window I mentioned. But in order to access those three lines directly from the variable pane might be a, er, pain. Could be done, but isn't.

For arrays:

Code: Select all

on mouseUp
   put "aaa" into temp["a"]
   put "bbb" into temp["b"]
   breakpoint
end mouseUp
The variable pane deconstructs the array variable (a very convenient tool), and you can see what is in that small window. But you might agree that it is now a bit more complicated to be able to simply copy a value from one of the elements of that array.

You can always build your own, using the "variableNames" function. A wordy example:

Code: Select all

on mouseUp
   put "XXX" & return & "ZZZ"  into var1
   put "YYY" & return & "JJJ" into var2
   put the variableNames into tNames
   
   put item 2 of line 2 of tNames into temp --this is where var1 lives
   do "put " && temp && "into qqq"
   breakpoint
end mouseUp
"qqq" contains the contents of var1

Craig