I'm new to javascript and Blockly. I am looking to save the code from executing a Blockly program to a text file. I have a blockly workspace with custom blocks and based on the program I create in blockly, I want to save that program from xml to a text file. What would be the easiest way to do that?
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/dde97961-225a-4787-bb05-4b0b6e0af5ado%40googlegroups.com.
Hello,This article looks like a good place to start for information about downloading. If you want to save stringified XML to the file I'd recommend using Blockly.Xml.domToText or Blockly.Xml.domToPrettyText. If you want to save generated code to the file, calling Blockly.WhateverGenerator.workspaceToCode(workspace) already results in stringified code, so you should be able to save that directly =)I hope that gives you a place to start!--Beka
On Tue, Aug 25, 2020 at 4:41 PM Varsha Koushik <vasr...@colorado.edu> wrote:
I'm new to javascript and Blockly. I am looking to save the code from executing a Blockly program to a text file. I have a blockly workspace with custom blocks and based on the program I create in blockly, I want to save that program from xml to a text file. What would be the easiest way to do that?--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blo...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/592aa5d4-82d1-47b6-8e6b-941e45158175o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/592aa5d4-82d1-47b6-8e6b-941e45158175o%40googlegroups.com.
Unfortunately, I don't think there is a quick and easy way to do this as you'll need to setup a server of some kind. However, I'm currently working on the same thing and can offer some of the options I'm considering:Option 1) Try the Cloud Storage tutorialPROS:- Probably the quickest methodCONS:- While setting up the tutorial may be quick, Google Cloud and App Engine themselves can be difficult to use and incorporate into your overall project (at least for me personally)Option 2) Setup a WordPress site which already has a database, user management system, JSON/REST API, and "Custom Post Types" framework to hold your users workspaces. To set up:- Install WordPress on a host (if you have the budget, I'd look into "Hosted WordPress solutions" and setup a site with one click)- Use CPT UI together with Advanced Custom Fields to build a workspace "custom post type". This will hold your workspace data, configurations, etc- Use the REST API to setup some endpoints to receive Blockly data and store into your workspace "custom post type"- Use the REST API to query for workspaces/data belonging to the userPROS:- If you know WordPress, you can prototype a fully working platform quickly (hours to a few days)- You can tap into the WordPress Plugin Repository to quickly add social features, forums, paid memberships/features, etc- Comes with Blogging, User management, etc baked in. If you use a hosted solution, you also get backup and tech support- Very easy to manage and easy to add editors/coworkers- One platform to run your entire project/business end-to-endCONS- This may not be a great long term solution, especially if you are expecting lots of realtime communication- High learning curve if you have no experience with WordPress- Sign up to a "Database As a Service" or "Database hosting" platform- Read their Quickstart Guides to see how to create a database, grab API keys, and learn how to hit a URL with a payload from your Blockly AppPROS:- Generous free tiers- Lower learning curve as you're only focused on learning how to send and receive data- Scales very well to high usage and realtime scenarios- Once you get how the workflow works, you can scale up features very quicklyCONS:- You'll still need to find a solution to host the actual non-app parts of your website (landing page, project gallery, documentation/blog, etc)- Harder to manage the databaseHope this helps! There are an infinite number of platforms and ways to do this, but I believe these options represent some of the faster approaches and lower learning curves. Let me know if you'd like some more clarification and I can help point you in the right direction.