PDA

View Full Version : [LzBot] ThinBasic Integrated Development Environment (update to 0.972)



xLeaves
26-01-2020, 00:03
LzBot (also known as LzRPA) is a software whose ultimate goal is to allow users to quickly and easily develop various automation tools.

These tools include, but are not limited to:
Office automation software (automatic operation of Excel, SAP, web pages)
Automated game software (giving the repetitive labor of online games to a virtual scripting robot)
Development of various other small programs (quickly develop various small programs that can solve problems in daily life)

Now that it has been updated to version 0.972, and has initially completed the planned functions, as well as the development of the English version, I will introduce this software in this new post.

10119

It uses a look and interface layout similar to VS.NET. The layout can be adjusted freely. It is divided into four main parts by default: command tree, log and integrated help, workspace, editor.

The command tree on the left can quickly browse the various functions supported by ThinBasic, and can quickly insert code into the editor, including various statements and commands, and even a document.

10120

Clicking a command can display the integrated help of this command, which allows the development process to be maintained within the integrated development environment without having to query the user manual, thereby improving development efficiency.

The workspace can open multiple projects, or execute files individually. LzBot provides a lot of convenience for project development, including automatic management of extended libraries and automatic copying of dependent files.

10122


LzBot also provides a project option editor, where you can more easily edit the version information (including automatic version overlay) and change the icon for the program.

Below the editor, there is also a Log pane where you can write code and use the TracePrint function to output debugging information here.

10123

In terms of code editing, the functions provided by LzRPA are also relatively complete, including keyword coloring, auto-completion, hover prompt and other functions.

10124

10125

My interest development team and I have used this editor to complete many project applications. At present, although it is not particularly perfect, it is stable enough.



I think that to attract enough users to a development environment, the first is stability and ease of use. Based on these two considerations, I have used ThinBasic as a back-end script engine because I have been paying attention to ThinBasic for some years. Updates are stable, and support for syntax and features is also very good (for ease of use, I have only filtered in the BASIC scripting language)

In terms of ease of use, I have made some improvements, such as integrating the help documentation directly into the IDE, changing various compilation preprocessing commands to be directly set by the user interface, and reorganizing the help documentation so that users only need to browse the commands Tree, find the required function, and then learn if, select, for, do, function and other statements to start programming. At present, my partners and I have launched some teaching videos (but explained in Chinese).

In addition, I have also extended some of the functionality of ThinBasic (or call it, within the extended range supported by ThinBasic, provided some new command libraries for ThinBasic), such as keyboard and mouse movement simulation, ported from FreeBasic Time library, extended window operations, extended Microsoft Office automation, extended web page automation (supports IE and Chrome), extended image text recognition, extended target window and process operations, etc.

In addition to these, I also tried to strengthen ThinBasic in terms of mechanism. Earlier, I tried to develop a shell program through thincore.dll to achieve multi-threading function, but this attempt failed. Later, I tried to pass multiple The process approach to achieve similar functions, fortunately this time I succeeded, and then I encapsulated the redis operation function into ThinBasic code, so it is very convenient to use LzBot to develop multi-process collaboration programs (the multi-thread function of other development tools). Thanks to this, it is very convenient to use LzBot to access the Redis database.



One of my wishes is to use software robots to simplify people's labor intensity at work. There are still many workers who need to sit in front of a computer and do a lot of repeated labor every day. These labors are often replaceable by robots, such as forms. Data entry, data transfer between multiple programs, etc.

When I'm doing similar work, I try to use LzBot to do it all automatically for me, so that I can spend my time on more creative tasks.



Compared to ThinBasic's existing development tools (ThinAir), LzBot does better in some aspects, but there are worse parts. I try to express the difference between the two objectively.

ThinAir is more focused on providing a complete toolchain for ThinBasic, and LzBot is more focused on its purpose, allowing more people to help themselves work through simpler learning using ThinBasic.

Because of this difference, LzBot has more considerations in terms of ease of use, but it is still insufficient in functional depth. For example, ThinAir provides the function of parsing the function list in the file, which LzBot does not have.

However, in development, LzBot is closer to VB. For example, TBMain is changed to Main. Some string functions do not require the use of $ at the end. Object aliases are created for the iDispatch type. The names of some functions are changed to VB or VBScript. Consistent, and added some new features, LzBot fits the usage habits of the target user as much as possible, and in the traditional ThinBasic development, it is more in line with the author's usage habits.

When LzBot uses the extension library, as long as the code of the extension library is added, the extension library will be automatically added to the project dependency list. When the EXE is generated, the code and files that the extension library depends on are automatically generated together to make this process. More simple.

At the same time, LzBot also extends the concept of extension libraries. Traditional ThinBasic can be an extension library. A piece of code and a DLL can also be used as extension libraries. This makes it easy for people who are good at different programming languages to develop extensions for ThinBasic instead of using PowerBasic as much as possible. Development extension.

Both LzBot and ThinAir have the concept of engineering, but ThinAir's project needs to be managed by the developer himself, and the files are referenced to each other. That's right. I also use C / C ++, C #, FreeBasic to develop and do the same.

However, this is not very friendly to novice programmers, so LzBot's project management simply assembles all files into a new file, and there is a unified entry point to make it easier for new users to get started. This is a Choosing the problem, my choice is to take care of new users.

LzBot has made a lot of simplifications. For example, generating an EXE does not need to face a complicated generator interface, but directly generates an EXE with the same name in the code directory. If it is a project, it is generated according to the path in the project option. Ask the user to save the file first, but ask the user where to save the program after generating the EXE, so it will be easier for novice users to use it.



Finally, to summarize the disadvantages of this version of LzBot:

The English version is not very mature, and some pop-up dialog boxes have not been translated, because there are pop-ups in many places. I am adding them to the multi-language configuration file one by one, and then helping Wendan translate it into the English version, which is a huge jobs.

There are some minor compatibility issues with the development of the ThinBasic original. In fact, I provided a solution. When the file extension uses tbs, the code is generated according to my improvement. When the file extension uses tbasic, the original development habits of ThinBasic are used Development.

Finally, the age of this development environment is still very low, only a few months, so the details are not good enough. For example, the cursor position is not displayed, the encoding does not support UTF8, there is no file parsing, and the function of listing function variables is not available. Automatically complete functions written by the user.



Of course, I also have a complete plan for the future direction of LzBot:

The first is the console system. I will use Redis and multiple processes to implement a new project type. This project type can manage all child processes in a unified data environment, and start, pause, and terminate the operation of a transaction at any time. And can feedback the running status of each task in the user interface. With this system, developers only need to complete specific function code, when this function is performed, how many times, and how many processes are performing the same task at the same time. How to coordinate and synchronize data between tasks is left to the framework.

The second is a new UI editor. As I said in another post, I want to provide users with a very simple user interface editor, preferably like VB, or even simpler (at least to achieve some effects (The interface is nice and simpler), this is a big project, so I planned for a few months and still haven't finalized the selection, maybe this is my most important task in 2020.

The last point is how to help the office staff. The richness of the ThinBasic and LzBot commands is far from enough. To help the people I want to help, I need to understand what these people need. In fact, I have investigated this matter several times. For years, office workers often use ERP systems such as Excel, web browsers (accessing web-based management systems), SAP, and miscellaneous management software. These softwares are developed using different technologies. I need to be able to implement these things. Stable and perfect operation simulation, and make the development of this process very simple, in order to achieve my goal, now that this goal is still far away, I will finally achieve it.



Finally, how do I download LzBot:

https://github.com/CN-xLeaves/LzRPA



Use Git's clone command to clone LzBot locally, or visit https://github.com/CN-xLeaves/LzRPA/releases to directly download the zip archive (yes, the main factor that prevents me from patronizing the ThinBasic forum often is the network, access The speed is not very fast. When I publish the results, I need to upload files many times to be successful, but this time the 0.972 version of the compressed package cannot be successfully uploaded to github, so please download the 0.97 version of the compressed package first)



After that I will say something about getting started with LzBot operation, in the form of a reply.

This article was published using google translation. I don't know if there are some sentences that are not very fluent or the meanings to be expressed are different. I am very sorry here, and language is one of the obstacles to communication.

xLeaves
26-01-2020, 00:57
Q:How do I get started?
A:Open the software, New File, Run
Then, open the software, New Project, Run ... Coding ... Run ……

Q:How to use multi-threaded function?
A:Multi-process, multi-process, multi-process !!!
Command tree, Commands, Work (Muiti-Thread), double-click Work_Create

Q:How do multiple processes communicate?
A:Use network, TCP / IP, or Redis.
Select Thread Project when creating a project to create a multi-process project that can access data to each other
It references the GlobalData extension library. This extension library has a global variable named G. This global variable is of type Redis. This is a database class used to access Redis. The main process and child processes are already connected when they are executed. To the same database.
The easiest way is to use Key_Set, Key_Get, accessing key-value pair data is very simple.

Q:Is there anything to note about multi-process development?
A:The code of the global code block will be executed in all processes (the main process and all child processes will run), and the Main function will only run in the main process. Functions that begin with Work_ are run after the child process starts at Work_Create.
Do not execute Work_Create in the global code block, otherwise it will fall into an infinite loop that cannot be ended, which is very scary, very, very scary.

Q:How to improve the English translation of LzBot?
A:Modify this file: setup\Language\en.json

Q:How do I add support for a new language?
A:
1. Add a new file in the setup\Language directory, such as cn.json
2. Modify "Language": "en" at the bottom of setup\option.json and replace en with your newly added file name (without extension)
3. Modify the json file. This file uses utf8 encoding and can directly support multiple languages.
4. If you still want to translate the command tree, find command.json in the setup directory, copy it to command_cn.json and edit this file (cn is replaced with your language file name)
5. Similarly, documents in the document.json and setup\Help, Modules\* directories can be created in this language

Q:How to add an extension library to LzBot?
A:LzBot does not yet have an online extension library source. I want to add this feature in the future, but it will take some time.
Extension libraries are now stored in the Modules directory. A folder is an extension library. The extension library requires at least three files: boot.tbs, command.json, and setup.json.
command.json is a list of commands displayed in the command tree, and is also responsible for automatically generating data for these functions.
setup.json is an extension library configuration file. You can configure which keywords and data types need to be highlighted, what are the dependent files of the extension library, and which other extension libraries does this extension library depend on (for example, GlobalData depends on Redis and RedisServer, and GlobalData Dependent extension libraries will also be introduced together)
boot.tbs is the source code of this extension library. The extension library that comes with ThinBasic may have only one line of code. For example File extension library, the code is: Uses "File"
Use Modules \ CommandEdit.exe to edit command.json of the extension library.

Q:Where is LzBot's website?
A:Unfortunately, due to lack of financial support, this project was developed by me and some enthusiasts. No one built and maintained the website.

Q:Is it open source?
A:I have such a plan, but before LzBot has taken shape, I can only invite a small number of people with sufficient strength to join the development group to ensure the quality of LzBot's code. In fact, the core code of this tool and many extension libraries are currently only me. Developed by one person.
Of course, I am willing to open source some of the extension libraries developed by myself for everyone to improve together. This part of the function is perfect, and ThinBasic can also benefit together.

Q:How is this part of the project implemented?
A:so easy, the file created first is in the front, the latter is created later, the top is the automatically generated version information, the public code is immediately behind (stored in setup \ boot.tbs), and the public code is followed by the extension library Dependent code, then the entire piece of code that all files are put together, and finally these codes will be run by ThinBasic.

Q:How to configure the project template?
A:so easy, Option.json is found in the template directory. Of course, the English version is Option_en.json. The same is true for other languages. You can see the list of project templates here. Note the MakeFile and MakeParam attributes of each project template. They point to an EXE file. After the project is created, , Will run this program, and this program will further fill the project information and default code, so theoretically it is easy to move all the templates in ThinAir, and the configuration is relatively free.

Q:How to add keywords automatically
A:command.json. This file is responsible for generating the number of commands, as well as auto-completion and hovering bubble tips. You can easily find this by opening it.

Q:What are Build.exe, Debug.exe, FileAssociation.exe, LogServer.exe, and Runner.exe in the bin directory?
A:Build.exe is responsible for translating tbs code into EXE (implemented by automatically controlling ThinBasic_Bundle_UI)
Debug.exe is responsible for debugging the running script (-D calls ThinBasic interpreter), and the temporary generated files will be deleted after the execution is completed
Runner.exe is responsible for running the script, and the temporary generated files will be deleted after the execution is completed
FileAssociation.exe is responsible for creating file associations
LogServer.exe is responsible for forwarding the debugging information issued by the script to the development environment to implement the function of TracePrint

Q:How did integrated help come about?
A:In this directory: setup\Help
Find the AiBot_Help JavaScript function.
LzBot encodes the Help field data of the corresponding entry in Command.json as json and sends it to this function, and then this function generates an HTML page and displays it.
Note the Temperature field of the Command.json entry, which is the name of the template file corresponding to the setup \ Help directory, so you can create your own integrated help.

Q:What version of ThinBasic does LzBot use now?
A:1.11.2.0

Q:What should I do if I encounter a problem?
A:I come here often, I can post here, and I will reply when I see it.

Q:Any helpful tips?
A:The SampleScripts_LzRPA directory has some code, of course, a lot of code is not perfect, and I will continue to enrich these codes in future releases.

Q:Is CommandEdit.exe available in English?
A:No, but source code: https://github.com/CN-xLeaves/LzRPA_CommandEdit
Maybe later versions I will provide an English version

DirectuX
26-01-2020, 13:54
Hi xLeaves,

just to say, I am very impressed by this huge project and the clever adoption of thinBasic !

ErosOlmi
26-01-2020, 19:20
Me too!
Now I have to work even harder to support as much as I can multilanguage support :D

xLeaves
27-01-2020, 23:39
I also have to make this editor fully support utf8 and better multilingual versions as soon as possible :drink: