Discuss Scratch

Abitofevrything
Scratcher
24 posts

copy to clipboard/copy block

It would be nice if scratch had some block which would allow the code to "auto-copy something'. What I mean is if you could have a block resembling this : which, when triggered would perform the action of highliting the <text here> and performing ctrl+c / cmd+v, without the user having to manually copy it.
This could help in projects which can give a save code, so when you need the save code, you would not have to have a list with an item that you copy, but an automatically copied save code, that the user could the paste somewhere else.

TL;DR :adding a copy block is a good idea

Sorry for any mistakes, I'm writing this on mobile
-Accio-
Scratcher
1000+ posts

copy to clipboard/copy block

Weak Support

While this could be useful in the circumstance you said, that circumstance is pretty specific, and there aren't many other times when this would be useful. Also, this could have the (although small) possibility for private messaging, using something like the script below.

when green flag clicked
if <(username) = [-Accio-]> then
copy [Private Message] to clipboard::control
end
LuckyLucky7
Scratcher
1000+ posts

copy to clipboard/copy block

No support, you could just use another list as a clipboard. If that block was implemented and then a Scratcher wanted to paste something into another website(or the forums and comments sections that are in Scratch), they would see something that they did not copy to their clipboard, and that would make the Scratcher confused and disappointed at the fact that they will have to go back where what they wanted to copy was from, and then go back to that website.
C0nyc0n
Scratcher
100+ posts

copy to clipboard/copy block

copy [] to clipboard:: operators
(content of clipboard:: operators)
This would only work if the tab is open, there would be a warning before launching the project (like the ‘username’ block) and there would be a popup that would be toggleable in account settings (on by default).

Last edited by C0nyc0n (Nov. 9, 2019 16:30:48)

oxiti8
Scratcher
1000+ posts

copy to clipboard/copy block

The problem I see with that is what people could use it for… Say someone had an important thing on their clipboard: someone could just have that run in the background to delete that file.
Morimop
Scratcher
1000+ posts

copy to clipboard/copy block

No support.

You can do this:
delete (all v) of [copyboard v]
add [copy this: bla bla bla] to [ v]
show list [copyboard v]
C0nyc0n
Scratcher
100+ posts

copy to clipboard/copy block

This would only work if the tab is open, there would be a warning before launching the project (like the ‘username’ block) and there would be a popup that would be toggleable in account settings (on by default).
btw i'm adding this to the OP

Last edited by C0nyc0n (Nov. 9, 2019 16:31:46)

Morimop
Scratcher
1000+ posts

copy to clipboard/copy block

C0nyc0n wrote:

This would only work if the tab is open, there would be a warning before launching the project (like the ‘username’ block) and there would be a popup that would be toggleable in account settings (on by default).
About bold part: I think it's kinda impossible. Think if you make it: “copy everything to board without permission”
Maybe these can happen:

oxiti8 wrote:

The problem I see with that is what people could use it for… Say someone had an important thing on their clipboard: someone could just have that run in the background to delete that file.
Also inappropriate things. Maybe.

C0nyc0n
Scratcher
100+ posts

copy to clipboard/copy block

Morimop wrote:

C0nyc0n wrote:

This would only work if the tab is open, there would be a warning before launching the project (like the ‘username’ block) and there would be a popup that would be toggleable in account settings (on by default).
About bold part: I think it's kinda impossible. Think if you make it: “copy everything to board without permission”
Maybe these can happen:

oxiti8 wrote:

The problem I see with that is what people could use it for… Say someone had an important thing on their clipboard: someone could just have that run in the background to delete that file.
Also inappropriate things. Maybe.

Maybe not toggleable then,
there would also be a censorbot
apple502j
Scratcher
1000+ posts

copy to clipboard/copy block

Technically Impossible.

Clipboard access require either “user interactions” or “permissions”. Permissions aren't supported in some of Scratch's supported browser (like Firefox). So, we need to have user interactions (like having the user click the button). Considering Scratch projects can run without any user interactions (except for the first green flag but you can't copy there because the project is not running then!) this is also impossible.

Last edited by apple502j (Nov. 9, 2019 17:54:20)

C0nyc0n
Scratcher
100+ posts

copy to clipboard/copy block

apple502j wrote:

Technically Impossible.

Clipboard access require either “user interactions” or “permissions”. Permissions aren't supported in some of Scratch's supported browser (like Firefox). So, we need to have user interactions (like having the user click the button). Considering Scratch projects can run without any user interactions (except for the first green flag but you can't copy there because the project is not running then!) this is also impossible.

That's why you would have a popup warning.
apple502j
Scratcher
1000+ posts

copy to clipboard/copy block

No. The popup must be clicked each time before clipboard is used. You can't do that before green flag because project is not running.
coder2045
Scratcher
1000+ posts

copy to clipboard/copy block

How is this actually supposed to work again?
And what if someone has something important, but someone makes their clipboard
“hwerghwgfjwgfjw” or something?
C0nyc0n
Scratcher
100+ posts

copy to clipboard/copy block

apple502j wrote:

No. The popup must be clicked each time before clipboard is used. You can't do that before green flag because project is not running.
That's how the popup would work, it would appear every time the block runs
HpInkJet
Scratcher
83 posts

copy to clipboard/copy block

Morimop wrote:

C0nyc0n wrote:

This would only work if the tab is open, there would be a warning before launching the project (like the ‘username’ block) and there would be a popup that would be toggleable in account settings (on by default).
About bold part: I think it's kinda impossible. Think if you make it: “copy everything to board without permission”
Maybe these can happen:

oxiti8 wrote:

The problem I see with that is what people could use it for… Say someone had an important thing on their clipboard: someone could just have that run in the background to delete that file.
Also inappropriate things. Maybe.


I agree mate this could be used in some pretty harmful ways. I love the idea though.
apple502j
Scratcher
1000+ posts

copy to clipboard/copy block

C0nyc0n wrote:

apple502j wrote:

No. The popup must be clicked each time before clipboard is used. You can't do that before green flag because project is not running.
That's how the popup would work, it would appear every time the block runs
Then it would be used to make stop button unclickable y forever setting clipbard
Abitofevrything
Scratcher
24 posts

copy to clipboard/copy block

Maybe there cold be an alert "copy text to clipboard?" that way there would be user interaction

n.b for y'all coders out there, by an alert I mean a confirm();
apple502j
Scratcher
1000+ posts

copy to clipboard/copy block

confirm() does not give permission to use clipboard iirc.
DoNotFoIIowMe
Scratcher
100+ posts

copy to clipboard/copy block

Maybe I'm just stupid, but how do you connect Scratch programs with your local clipboard? I feel like there's no JS option for that.
apple502j
Scratcher
1000+ posts

copy to clipboard/copy block

There are a few ways, Clipboard API or document.execCommand. Both must be fired inside onclick event.

Powered by DjangoBB