Share My Creation jMashBal2Bil Convertor

Did you find this useful, if so what can be improved? Thanks :)

  • Yes

    Votes: 7 70.0%
  • No

    Votes: 3 30.0%

  • Total voters
    10

Mashiane

Expert
Licensed User
Hi

NB: Now Updated to include a source code convertor, converting basic & simple source code from B4A to B4I. See Post #9

I have wanted to do this for a while now. The current Bal2Bil convertor is a command based tool, so I wanted such a tool but as a nice UI. So after playing around, I used B4J to develop it.

Will explain some things here about porting.

Credits:
Bal2Bil
CustomToast
jShell
jRLMessageBoxes
 

Attachments

Last edited:

Mashiane

Expert
Licensed User
Here is the B4J source code for the project including the library references used. I have updated it to include a folder selection and then you can convert a complete folder at once.

NB: You need to copy Bal2Bil.exe to your Objects folder.
 

Attachments

Mashiane

Expert
Licensed User
Hi there..

I've noted that with using the jShell, at times as much as a success result is provided, the resulting b4i output file is somewhat corrupted. Thus I have updated the source code here to use an internal convertor as per source code from the Bal2Bil tool. I have not experienced any errors so far with my converted files. 27 screens to be exact.

The attached source project thus does not need the exe file for bal2bil anymore as the source code is included. Anyway, the functionity to use the shell call is still here, previously this was RunWSH (dependency on bal2bil.exe) and now its RunWSH1 (no dependency).

Other things to show here are:
  • Set a form's background image
  • Set a form's icon
One can get some useful code from this site about B4J etc.

Enjoy...
 

Attachments

Mashiane

Expert
Licensed User
Hi there, I am converting a B4A app to B4i. I noticed that I was doing repetitive tasks, so I decided to create a b4j tool to help me convert my source code to b4i easily. This works just like a macro anyway.

From the attached source code, take a look at jMash > replacers. This maps all code parts that I want to replaced from my b4a source code in the new b4i code.
commentout is a list of all code parts that I want to be commented out if they start with such code. The code also fixes the StartActivity call.

What you will have to do is to fix the Show method of your code module.

Usage: Start jMashBal2Bil, open the Source Code Convertor, Copy and Paste your source code from an open B4A code module and click convert. Paste your code in a new b4i code module.

For me this has decreased the number of repetitive tasks that I was performing.

B4X:
''' initialize replacers, code on the left will be replaced with code on the right
   replacers.Initialize
   replacers.Put("Job.GetBitmapSample(100%x,100%y)", "Job.GetBitmap") ' personal
   replacers.Put("Job.GetBitmapSample(", "Job.GetBitmap(")
   replacers.Put("File.DirDefaultExternal", "File.DirDocuments")
   replacers.Put("File.DirInternal","File.DirDocuments")
   replacers.Put("File.DirInternalCache","File.DirTemp")
   replacers.Put("File.DirRootExternal", "File.DirDocuments")
   replacers.Put("Activity_Create(FirstTime As Boolean)", "Show")
   replacers.Put("Activity_Resume","pg_Appear")
   replacers.Put("(spinner)","(hd)")  ' personal
   replacers.Put("As EditText", "As TextField")
   replacers.Put("As CustomListView", "As iCustomListView")
   replacers.Put("LoadBitmapSample(", "LoadBitmap(")
   replacers.Put("Activity.GetAllViewsRecursive", "pg.RootPanel.GetAllViewsRecursive")
   replacers.Put("As Cursor", "As ResultSet")
   replacers.put(".RowCount", ".NextRow")
   replacers.Put(".GetKeyAt(",".Get(")
   replacers.Put("Application.LabelName", "modMashiane.AppName") ' personal
   replacers.Put("Sub Globals","Sub Process_Globals")
   replacers.Put("Activity.LoadLayout(","pg.RootPanel.LoadLayout(")
   replacers.Put("As Spinner", "As Picker")
   replacers.Put("As CheckBox", "As Switch")
      
   ''' initialize things to comment out
   commentout.Initialize
   commentout.Add("Activity.Finish")
   commentout.Add("msa.with(")
   commentout.Add("Private msa ") ' personal
   commentout.Add("Private mst ") ' personal
   commentout.Add("Private spinner ") ' personal
   commentout.Add("Sub Activity_KeyPress") ' YOU NEED TO FIND AND FIX THIS"
   commentout.Add("Activity.AddView(")
   commentout.Add("modMashiane.InitializePicker")
   commentout.Add("K.HideKeyboard")
 

Attachments

carchek

Member
Licensed User
Hi, I have updated all the libraries and I get an Error: " Private rld As RLMessageDialog" That library is missing although I have installed the right library and updated Java.
 

Mashiane

Expert
Licensed User
Can yo
Hi, I have updated all the libraries and I get an Error: " Private rld As RLMessageDialog" That library is missing although I have installed the right library and updated Java.
You propably downloaded the wrong library. Please ensure your library is jRLMessageDialogs.jar as there is also jRLDialogs8.jar from the same author.
 

Descartex

Well-Known Member
Licensed User
Simply wonderful
 

winjiadh

Active Member
Licensed User
I download your jMashBal2Bil.zip and all files.
Unzip and run with B4J 4.7
but error like this
"
B4J version: 4.70
Parsing code. (0.09s)
Compiling code. Error
Error compiling program.
Error description: Unknown member: toasticonsize32x32
Occurred on line: 85
Toast.ToastIconSize32x32
Word: toasticonsize32x32
"
QQ截图20161208151051.jpg
 

winjiadh

Active Member
Licensed User
Top