Hello. I know this was requested many times, but i’ll bump it again. In Pythonista they have access to clipboard text. So you can just copy a gist adress in the forum, then open pyhthonista, run a script and TaDa! The script is here ready to run! (no paste into the script needed). This is just 1 of the many usage i would use this functionnality for… Thank you for considering my request, please. It shouldnt be that difficult? Text only?
+1 for Simeon proposal. Hey guys, please dont ask for too much too soon, otherwise we will get all this… later. Simeon proposal would already be a fantastic step for mankind. Oops, i mean for us.
@Simeon - Looks great!
@toadkick local contents = pasteboard.contents, for loop and type all the contents. I think that would be a real help to hold a table in the pasteboard
I like @Simeon’s proposal. I definitely think this needs it’s own namespace…
copy is too common and ambiguous to be global. Also, it’s important to have the separate
image fields, or else some other method of telling what kind of data is on the clipboard, otherwise…how else would we know how to treat the data?
A pasteboard can handle several different types of data at once (strings, images, URLs, colors). If you just did copy & paste, you’d be limiting the pasteboard’s ability to handle more than one item.
It’s as easy as
[UIPasteboard generalPasteboard].string. It’s just that Codea is backed up with v2 and requests, so I don’t think it’s coming soon.
I agree with @Jmv38, but for this, all you basically have to do is register the Obj-C functions and convert the Codea Image datatype of UIImage for the image copying.
why not just “copy” and “paste”?
Also (unless the pasteboard can hold more than one type of info) Codea could determine what type of data it was, I’m guessing, so I don’t see the need for separate commands for text and images.
Why don’t we use this thread to design and propose a Codea API for clipboard access?
I’m thinking along the lines of:
-- Copy text to global pasteboard pasteboard.copy( text ) -- Copy image to global pasteboard pasteboard.copy( image ) -- Get text from pasteboard -- (nil if no text) local txt = pasteboard.text -- Get image from pasteboard -- (nil if no image) local img = pasteboard.image ``` "Pasteboard" is what it's called in iOS, we could go with the more standard "clipboard" name.
@Ignatz I thought about using a global
copy function to get data into the pasteboard, but I didn’t like the naming of
paste to get stuff back out. (Paste feels very in-place, where what we want to do is read the data.)
The separate image and text fields were intended to make the code using pasteboard a bit more readable (you only have to check for
nil, not the data type).
+1 @Simeon +1 for pasteboard
@Simeon Slightly off-topic, related to keyboards, but is there any way that keyboard(BACKSPACE) could be called while you hold it down rather than the first time you press it? Or a way to set and clear the keyboardBuffer()? This would be very useful in text boxes and what I would want to make. Thanks!
@SkyTheCoder +1 if this would be implemented I might rebegin my textbox project and actually finish it ^^
Also, maybe a way for detecting if an inputed char is an emoji or a multi-char input…?
edit: i just realised this wouldn’t be needed if we can set the buffer…
@SkyTheCoder yes! Exactly that. I couldn’t stand using my textbox without a proper letter to word deletion, just one letter… At a time.
@Simeon Also, haven’t tested it yet, but calling keyboard(" ") while the space key is pressed would be nice too.
Or maybe having more data about the key press… like key.state as BEGAN or ENDED and key.value for what key is now. That way we could program it ourselves to add the space while you’re holding space down, too. And then, I saw somewhere a while ago, someone made a game example with the keyboard where you could use WASD to move a circle around, if we had information about when the key was pressed and released that could be actually useful.
2 backers so far. Say @SkyTheCoder +1 if you agree with this!
@SkyTheCoder if you make a text box, you can do special things with special buttons that you design yourself. Then you can make a delete button that behaves exactly as you want. Or a space " " button too… Without Simeon having to work on that. Personnally, I wouldnt ask TLL for functionnalities we can easily implement ourselves, there are so many that still need to be added, and for which we cant create a workaround… Like the clipboard.
@SkyTheCoder we’re pretty limited with regards to what information we get about key presses. iOS 7 vastly improves the situation in this regard (you can finally get modifier keys).
Well I don’t think all of that is needed, tho would it be possible to set/clear the keyboard buffer ourselves? @Simeon