Now it does absolutely everything!

LucaMs

Expert
Licensed User
Longtime User
Thanks to Erel's JsonLayouts.jar 🙏, Copilot now does absolutely everything, including layout (in JSON format, converted to binary by JsonLayouts.jar)
B4X:
#Macro: After Save, Sync Layouts, ide://run?File=%ADDITIONAL%\..\B4X\JsonLayouts.jar&Args=%PROJECT%&Args=%PROJECT_NAME%

You can tell it: create a B4XPages project that does "this" and also generate the UI for each page, in JSON format.

All you have to do is... eat lunch 🍗
 

aeric

Expert
Licensed User
Longtime User
Is there a way to convert the JSON to .bal or .bil?
Yes, it is 2-way sync.
 

Lucas Siqueira

Active Member
Licensed User
Longtime User
Yes, it is 2-way sync.
As far as I know, it only converts from (.bal or .bil) to JSON, and not the other way around—from JSON to (.bal or .bil).
 

aeric

Expert
Licensed User
Longtime User
As far as I know, it only converts from (.bal or .bil) to JSON, and not the other way around—from JSON to (.bal or .bil).
If you have question, you can post a new question.

If you are working on B4A, the .bal layout you created will generated a .json in B4A json folder.
Then if your AI agent edited the json for you, when you click Save in B4A, the Macro will call the JsonLayouts.jar which converts the .json back to .bal.
You get an updated .bal "written" by the AI agent.
 

LucaMs

Expert
Licensed User
Longtime User
If you have question, you can post a new question.

If you are working on B4A, the .bal layout you created will generated a .json in B4A json folder.
Then if your AI agent edited the json for you, when you click Save in B4A, the Macro will call the JsonLayouts.jar which converts the .json back to .bal.
You get an updated .bal "written" by the AI agent.
I managed to get Copilot to generate a JSON from scratch.
 

Lucas Siqueira

Active Member
Licensed User
Longtime User
I managed to get Copilot to generate a JSON from scratch.
But can you convert the JSON into a .bal and .bil layout?
 

LucaMs

Expert
Licensed User
Longtime User
But can you convert the JSON into a .bal and .bil layout?
Yes.

The process is as follows:
  1. I create an empty layout named "layMaiPage" using the Designer.
  2. I "tell" Copilot to create a layout-json file, same name layMaiPage.
  3. I place the layout-json file in the JsonLayouts folder.
  4. Using a macro within the project, I run JsonLayouts.jar;

    #Macro: After Save, Sync Layouts, ide://run?File=%ADDITIONAL%\..\B4X\JsonLayouts.jar&Args=%PROJECT%&Args=%PROJECT_NAME%

    this synchronizes the two files—meaning it populates the "actual" layout (.bal, .bjl) with the views created and positioned by Copilot in the JSON file.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Yes.

The process is as follows:
  1. I create an empty layout named "layMaiPage" using the Designer.
  2. I "tell" Copilot to create a layout-json file with the same name.
  3. I place the layout-json file in the JsonLayouts folder.
  4. Using a macro within the project, I run JsonLayouts.jar;

    #Macro: After Save, Sync Layouts, ide://run?File=%ADDITIONAL%\..\B4X\JsonLayouts.jar&Args=%PROJECT%&Args=%PROJECT_NAME%

    this synchronizes the two files—meaning it populates the "actual" layout (.bal, .bjl) with the views created and positioned by Copilot in the JSON file.
Before, you need to provide Copilot (or another AI) with a JSON file generated from the file created by the Designer, so that it can analyze it and learn its structure.
 

aeric

Expert
Licensed User
Longtime User
But can you convert the JSON into a .bal and .bil layout?
Why are you repeating asking the same question?
The answer is yes.
Try it on your own to see the results.
It works for B4A, B4i and B4J. Each platform has it's own JSON file. Read the post by Erel to learn more.

Edit:
If you are asking can the json from bal can be converted to bil then the answer is No.
bil will create a different json file.
If you don't want to manually editing the bal and bil layouts, you need to prompt your AI agent to do so.
Eg. "Add a label and text input for both B4A and B4i (and also B4J) for my new customer email in the jsonlayouts files"
AI agent writes to both the json files and once you save in B4A, the bal and bil will be updated from the 2 updated json files.
Meaning, you need 2 json files to convert to 2 layouts, B4A and B4i.
 
Last edited:
Top