Share My Creation [B4X] [TOOL][SOURCE] lm Snippets Manager

I definitely want to speed up the development of my softwares; I decided to develop a very useful snippets manager.

Although the main purpose is to have all your snippets at your fingertips, saved in a local db, cataloged and easy to find, I have also added the possibility of inserting those that are on b4x.com and also a link to their page.

I am sure that it will also be of use to all the members of our beautiful community.

I'll fill it with my own snippets, as I'm sure you will too, but also the best and most useful ones that are on site.

New version, 3.1.0 (see this post).

NEW Version 3.0.0 - 07/19/2022 - Replaced the import-export part.

Version 2.3.0 - 03/29/2022 - Added import-export.

Version 2.2.0 - Added "wildcards" to filter for snippet name. Also added ToolTipTexts. See post #86.

Version 2.1.0 - Added a very useful list of most recent snippets used (window always on top). See post #40.

Ready 2.0.0 version, which implements the feature shown in
post #34, code highlighting (which had a hard to solve bug).

Source code - Min. donation: 16 euros.
Obviously you are not allowed to publish/sell the lmSnippetManager source code.

NOTE: to create the stand-alone (exe) version, use:
Download OpenJDK 14.0.1
EDIT: see this post. You have to add javafx folder to that OpenJDK 14.0.1.




Made with love in B4X... of course!!!
 
Last edited:

PaulMeuris

Active Member
Licensed User
You can use a zip tool like this:
B4X:
        Dim sh As Shell
        sh.Initialize("sh", "cmd", Array As String("/c", xui.DefaultFolder & "\7za.exe", "e", "-o" & destfolder & "\" & newfolder,newfilename))
        sh.WorkingDirectory = destfolder
        sh.Run(-1)
        Wait For sh_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
        If Success Then
                    
        End If
The "e" switch is for extract files and the "a" switch is for add files...
 

LucaMs

Expert
Licensed User
Longtime User

LucaMs

Expert
Licensed User
Longtime User
You can use a zip tool like this:
B4X:
        Dim sh As Shell
        sh.Initialize("sh", "cmd", Array As String("/c", xui.DefaultFolder & "\7za.exe", "e", "-o" & destfolder & "\" & newfolder,newfilename))
        sh.WorkingDirectory = destfolder
        sh.Run(-1)
        Wait For sh_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
        If Success Then
                   
        End If
The "e" switch is for extract files and the "a" switch is for add files...
Yes but it is my software that the users will install that should perform the compression and I cannot know in advance which external tools they have (much less where, on their computer, they are located).

I solved it with Archiver, thanks to @stevel05.
 

LucaMs

Expert
Licensed User
Longtime User
For the moment I'm afraid I'll enter the emails by hand, one at a time. It is likely that a group could be created to avoid this hassle.
 

LucaMs

Expert
Licensed User
Longtime User
I found a very simple solution (unfortunately I only found it now, since... I only looked for it now ๐Ÿ˜ ): create a folder on Google Drive and share it. Inside it I could have inserted the new version of lmSnippetManager from time to time (umm... but I suppose that in this way I would not have been able to notify the update).
 

LucaMs

Expert
Licensed User
Longtime User
I just found a very simple way to copy all the emails of a shared file to share a new one but... I'm ashamed to write it ๐Ÿ˜„, it was really simple (but I haven't tested if it works yet, as the latest version of the project is not yet fully completed and tested)
 

LucaMs

Expert
Licensed User
Longtime User
The new functionality is used to export the snippets inserted in lmSnippetManager into b4xlib libraries:

1695552355544.png

that you can use with the new B4J feature (soon also with B4A and B4i).
 
Last edited:

BasicBert

Member
Licensed User
Longtime User
I haven't looked very much into the codesnippets system, being a bit dazzled by how this should work. Also it is only available in B4J, while I also use B4A and would like the same way of working in both languages. So I ordered ImSnippetsManager, which I can use for both with just copy and paste. That's simple and understandable for me.

Getting ImSnippetsManager to work from the sourcecode I got from LucaMs, I had to fool around a bit with the needed libraries. But i managed to get it up and running from the IDE of B4J (9.80).

I had to comment out all #JavaCompilerPath mentions in the Main module to get it to work. I have Java sdk's 11 and 14 installed.

Now the only thing that doesn't work is to make a stand alone exe-file with Inno Setup Compiler, as I have done with my own B4J-program(s).
The compiling goes well, but after startup it closes immediately.

Do you have any suggestions how to solve this? Maybe send me an exe-version?
 

LucaMs

Expert
Licensed User
Longtime User
Also it is only available in B4J, while I also use B4A and would like the same way of working in both languages
Certainly the next versions of B4A and B4i will also have that feature.

I had to comment out all #JavaCompilerPath mentions in the Main module to get it to work.
Those lines are already commented, left only in case of need.


Now the only thing that doesn't work is to make a stand alone exe-file with Inno Setup Compiler, as I have done with my own B4J-program(s).
You don't need Inno Setup to create the exe.

1695845683053.png


I still use jdk-8, since it still works very well and now I don't remember which one, 11 and/or 14, compile without any problem (you can find many posts about this "problem" in this thread) but it is definitely doable.

If you want I can send you the exe but it would be much better if you were able to compile the project, since you will also need it for your other projects.
 

BasicBert

Member
Licensed User
Longtime User
Certainly the next versions of B4A and B4i will also have that feature.


Those lines are already commented, left only in case of need.



You don't need Inno Setup to create the exe.

View attachment 146467

I still use jdk-8, since it still works very well and now I don't remember which one, 11 and/or 14, compile without any problem (you can find many posts about this "problem" in this thread) but it is definitely doable.

If you want I can send you the exe but it would be much better if you were able to compile the project, since you will also need it for your other projects.
I agree it would be better if I can compile it myself, if only for the educational aspect. So I think I'll try to install jdk-8 alongside 11 and 14 and read the thread again.

I used the Build Standalone Package option for creating the jar-version, from that I had Inno make the exe.
Now I found out also an exe is created in temp/build. Time to learn and explore further.

Thanks for your quick response.

Edit : It seems I have been lazy not reading the whole thread. Excuse me for that. Most of my questions remaining were answered before.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
An Italian member of B4X pointed out to me that in the latest version, 3.10, I left a reference to a "lmSnippets" library that I did not provide. It was just a test of the new B4J functionality, it is not needed for this project of mine, so deselect it.
 
Top