Copying variable values to clipboard

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Copying variable values to clipboard

Post by JackieBlue1970 » Tue Jul 14, 2020 2:14 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Copying variable values to clipboard

Post by dunbarx » Tue Jul 14, 2020 4:31 am

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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Copying variable values to clipboard

Post by bogs » Tue Jul 14, 2020 1:16 pm

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...
Image

JackieBlue1970
Posts: 64
Joined: Thu Jan 16, 2020 10:28 pm
Location: Max Meadows, VA USA

Re: Copying variable values to clipboard

Post by JackieBlue1970 » Tue Jul 14, 2020 4:50 pm

Thanks folks. Not sure why you have to enable an additional edit action, instead of just making it eligible to copy right off though.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Copying variable values to clipboard

Post by dunbarx » Tue Jul 14, 2020 5:27 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”