Page 1 of 1

open file/url externally

Posted: Apr 7th, '18, 19:54
by Picochilla
Hi, is it posible to open a file (path/url) with GP? So GP would be able to open a website with the users standard browser or open a text file with the default editor. If not, it would be nice if you could add it to your task list. This would be very helpful.

Thank you very much.

Re: open file/url externally

Posted: Apr 8th, '18, 10:40
by MSandro
Nice idea, but I think I've already submitted a similar idea, which, to my knowledge, did not quite match the ideas of John. It was something like a "run code" block that would allow opening files / URLs and much more. I've already seen something like this in some scratch 1.4 modifications. An "open file / url" block would make it possible to execute written scripts, at least under Windows, under Linux and probably also Mac this is probably rather unfortunate to realize, because the files would have to be made executable.
Bildschirmfoto vom 2018-04-08 12-40-38.png
Bildschirmfoto vom 2018-04-08 12-40-38.png (4.57 KiB) Viewed 2420 times

Re: open file/url externally

Posted: Apr 10th, '18, 19:57
by JohnM
There is no way to do this in GP right now.

The general case of running an executable file is a big security hole that I'd rather not put into GP. That includes opening a file, too, since "opening" an exe or shell script file might execute it.

It might be worth considering a command that is limited to opening a browser on a given URL. I believe such a command could work in the browser version of GP, as well as in the stand-alone version (although it probably could not open local files for security reasons).

Are you more interested in opening local files or remote URL's?

Re: open file/url externally

Posted: Apr 11th, '18, 13:19
by Picochilla
Honestly both, but of course I can understand your concerns about safety. Opening files would greatly improve the interaction with the operating system and would give us many new opportunities. I do not know any reasonable programming language that does not allow the external opening of files.

Re: open file/url externally

Posted: Apr 11th, '18, 15:54
by MSandro
It would be very useful, but of course you should not neglect safety. Nevertheless, I support the statement of Picochilla because GP should be used as professionally as other programming languages, in contrast to Scratch and other block-based languages which are mostly aimed at learning. So you should not restrict the programming that the tool GP because of the security aspect. Many programming languages value security without sacrificing functions that restrict the programmer / user.