Can someone give me blocks that can import and start download of files?

I have seen people using these in projects (or, at least, they could import files, I saw one that opened a window, and one that got dropped files, but in both cases I couldn't find the block that would do it nice and easily, but I haven't actually seen a start download of using project), and I'm sure they could be done with Javascript just I don't know exactly how myself.

How about the URL block?

How would I need to use it?
I just need a script basically, and preferably a link to a project where I can export the three custom blocks that I need:
[scratchblocks]
ask for files of types ()<::#000>::grey
[/scratchblocks]

[scratchblocks]
(dropped files::grey)
[/scratchblocks]

[scratchblocks]
start download of file()::grey
[/scratchblocks]

well i made some basic file import blocks which would suit your need of

[scratchblocks]
ask for files of types [ ] @delInput @addInput :: sensing // click on me to open the project
[/scratchblocks]


(it doesn't automatically read the files though there is a separate block for that)

but I did not make a way for users to drop files onto the project to import it, and you cannot download files from it. i have only once made a file drop import in like 2018 so i don't remember how to do it but i can search it up. and i know how to make download files so i could probably help you with that.

Thanks!
That is really helpful.

I made a project a while ago with some file blocks you might find useful
The download block is a little broken, but the rest work fine.

Oh, can you also do something that exports costumes and sounds?

Where is that block? Does it turn them into costumes and sounds?

That block is in both projects that have been linked, it looks like

[scratchblocks](read file [] as [text v]::grey)[/scratchblocks]

and yes, it does have an option for costumes and sounds.

Costume export project by pumpkinhead
i dont know about sounds I tried the same method and it didnt work for some reason

Like it - just one problem - it color shifts colors - so orange is blue - and can you make it work for sounds too?
EDIT: I just saw that you wrote you tried to make it work for sounds and it didn't work

that's probably because you ran the script that inverts the colors of the costume before saving it

Ah, I thought you were meant to use the bottom script I ysed the top script and it worked

Okay I made one that saves sounds. The code is actually very simple, it does the usual create a link download element and clicks it, and this time it simply sets the href to the source of the html audio element referred by a sound.


Good thing the browser (or at least Chrome (and Firefox)) automatically appends the correct file extension if you don't provide one. So I didn't have to worry about detecting what file format the sound was. (I know how you can do: that there's some text in the beginning of the sound data URL that says something like "mpeg" or "wav")

(side note how do i get it to open the file dialog like it does in firefox in chrome because sometimes i just want to open the file)

did you make sure when you put the sound name it got the correct sound object?

(i can't think of any other reason how it wouldn't work)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.