Copy...duh...

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

Copy...duh...

Post by AlexAdams » Mon Sep 21, 2009 8:15 pm

It's redicuous how much time we spend in the simple stuff before we ask help.

I cannot get a command to copy the contents of a field to work. This is the code I'm using as per the dictionary:

copy word 1 to -1 of field "fldLabelAddress" of card "crdRecordSummary" of this stack

What am I missing?

Thanks,
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 21, 2009 10:02 pm

It is surprising how often people write "it doesn't work" and expect others to know what is going on. Please provide all information you can possibly provide. In cases like these, you really need to provide error messages, the result, and strange unexpected behaviour.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

What's going on, errors and such

Post by AlexAdams » Mon Sep 21, 2009 11:09 pm

button script that initiates the action:

on mouseUp
set blendLevel of me to 0
send copyAddressToClipboard to stack "stkAddressSummary"
end mouseUp

copyAddressToClipboard is a stack script in the same stack:

on copyAddressToClipboard
copy word 1 to -1 of field "fldLabelAddress" of card "crdRecordSummary" of stack "stkAddressSummary"
end copyAddressToClipboard

No syntax error is noted. No error is thrown during execution. It just doesn't put anything into the clipboard.
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 21, 2009 11:15 pm

Is the field available on the current card of the stack, AlexAdams?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

Field location

Post by AlexAdams » Mon Sep 21, 2009 11:26 pm

The field is on the same card as the button.
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Sep 22, 2009 8:20 am

Hi Laex,

you can set "the clipboarddata["XXX"] by yourself, which is much more reiliable that "copy"!
...
set the clipboarddata["text"] to word 1 to -1 of field "fldLabelAddress" of card "crdRecordSummary" of this stack
...

See "clipboarddata" in the docs (Rev Dictionary)


Best

Klaus

AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

Thanks Karl

Post by AlexAdams » Tue Sep 22, 2009 4:07 pm

set the clipboarddata["text"] works great. That is what I started out looking for, but I didn't understand the explanation in the dictionary, so passed over it.

Thanks for the clarification.
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Post Reply