 Okay, finally So I find it funny to start from a post that was that was posted in on the ask site One year ago. The question was where are the skid-force libraries located on my system and the right answer was well, you have just have to install 7.1 and So upgrade from 7.0 to 7.1 and the solution was Choosing as being well skid-forges scam do not use it Was not a very friendly from my view point of view and coming from a guy I have enormous respect for because He helped me very often in fact by his advice on forums So I started from from there and so My conclusion was there is a big misunderstanding Script for just never been designed or conceived as the enemy or the replacement or Arrival of you know, not at all. They are complimentary But we must be aware that and she uses today when they want to be able to script they have Well, the next duality either they can record the macro You know what it is and you know also that what is recorded and what is What you obtain as result is completely not reusable and On the other side you have an enormous API. What does everything? But when people ask where should I start well the answer on forums is Mainly well, you have nice books to read They are good starting points This was a bit a bit short and all condition was that we had to do something for that and we Okay, developed a number of things that are no Available as standard in LibreOffice Being aware that the target audience Not the people who could speak, you know before they could they could walk The We have today we face a population of of users We must be aware that the competition Which named Microsoft today offers to make scripts a very good idea an excellent idea Very nice object model easy concrete not abstract more than not abstract objects No, what is a service manager? What is a document component context that are concepts that you may ignore in when you script with Microsoft in fact and Microsoft could convince with His tools millions of people millions of entries I say millions To start scripting and to make things With scripts To make them automated And this is very remarkable. We are I'm I believe very very far from that situation so what script forche involves is First of all a common API because it's still an API a common API for basic and Python We encourage the use of object oriented programming also in basic. It's of course natural in Python it's also It contains also libraries that extend basic and also that extend Python. We will see In summary what what what they are It's simple to use. Yes. It's simple to use. It's not against you know, we'll see that it's really the case It's more user-friendly and it's also a la carte in the sense that you are not obliged at all to use only script forche or to dedicate all your scripts Within the framework of script forche you can really mix everything together. It's doesn't doesn't matter It's also inspired by use cases. The point of view is not to have well developers that have managed that The development of the the technology of LibreOffice can be described with You know IP API That's the view of the point of view is really the user Use use cases mean user benefits So we started really Reasoning from use cases So the idea is not here to detail use use case that you see here It's just a sample of what script forche can do but it just shows that there is abundance of ideas. Well Uses need once or several times they need to do something. How do they start? Okay, I said There is a number of services that are extensions of basic basic is too low is far from what VBA offers well in a certain sense and so we Decided also to start in fact with the development of a number of services that really Extend the language So you have here for instance for the array service It's not available for Python. It's nonsense to make in Python Python has already all these data structures. Well, yeah so you you just can sort arrays or Make sets to define the union of two arrays whatever these are kind of things that are directly available with the API of script forge Same idea this time for the string service the string service you have built it in basic a number of things that allow you to To let's say find a string a substring within a string But if you start talking about how do I find a regular expression within a string is something else well We were convinced that it was necessary to have to have for Input validation to to pass a number of strings to be able to import Let's say a CSV file that that kind of things you have you need well a number of primitives and these primitives are You have here a sample of what is available Including for instance last one hashing a string Well, we use Python to hash. It's a module in Python that is available with LibreOffice. Well, we use it to to produce the hash code of a string of or of a file and Third a kind of service also available only for basic is a mapping class that is more than collections and Know that Microsoft did exactly the same. So they have also a dictionary mapping class that is super set of the collection class That was for basic for Python. Well, the idea was When when you start as a new script author to write some Python code for LibreOffice well There is Some some step that we could cover here by saying well Basic offers the integration between basic in LibreOffice, which is better than between Python and LibreOffice and That integrates the integration goes for for an example through a create you know service primitive Well, the idea was well, let's make the same But let's make it so that the primitive in Python calls the basic primitive Which returns then back the value that was found with that After that after the call and we made it for a number of Primitives that are available built in in basic so that the step going from basic when I know basic going to Python and starting scripting for LibreOffice is easy that step is really easy and you have here the list of the The functions that are made available some Many of them are written in basic in fact in background not all of them some are directly in Python or Something else, but this makes for instance that we are able to have a user interface Let's say through message box that is exactly Identical in Python in basic that you have script that makes both well you just have to To call the same message box function. In fact from basic or from Python. It's really identical. I Said it's not to you know killer. It's in fact to you know enable we will see examples also later well, you There exists within the item that are manipulated with script for a number of objects that are you know objects and This makes that we have With this guy this style of scripting here shortcuts to you know, it's very easy to say. Well, I start With the calc service you have this first statement there. I have an import range that is built by the import from a CSV file just as an example there and I have Yeah, the X cell range variable is in fact Produced by a shortcut from the script for Scalc service producing Producing a standard you know object and so you can go further in the development of your script for instance, it's Skip force does not provide any mean to format cells or cell ranges Formatting a cell or cell range is much too complicated to do to not to use you know for doing that Well, you can so via shortcut to go very fast To your target here the cell range and from there start it start and for instance by using x-ray in Python only basic whatever starting from there going further and Use really methods or Properties from you know objects. So you have a huge list You have a sample here of a number of things that are available Via shortcuts and that's very important to understand that both work read together Some nice features that I can show but it was and that will illustrate the philosophy of the things for instance here I have Two scripts one in Python and one in basic. They do exactly the same in the sense that there are events and they log the event and the Go through that even the log the event itself and They log it where in what we call the console and console is Either log file or is a dialog box that you can display in model mode or in non-model mode and for instance here The events are triggered when the mouse scores over The vertical bar first and the horizontal bar afterwards and you see you have events triggered by basic Even even triggered by Python and you have the console that lists the event At the time that it happens So you see that integration between both and the coexistence between Python basic, you know is is excellent also you have a number of Helps that Describe the context in which the script is running About the platform and a number of those aspects are Supplied by by Python, but they are available in Pi in basic. I mean here also the same way And we from now on we do not make any distinction anymore between basic and Python so you have a number of Description of the context in which you work and this is very important when you make an extension for instance, you don't know in advance in which context that the Extension will work. It's important to be able to for instance know Well, I want to know if extension x-rays available on the system where I run my script Well, you can ask the question with the extension folder available in In file system or the list of extensions in platforms. So you Are supported here to have that Available at any time Script for this also international you have a service that helps you make scripts that are independent No, I said otherwise you can you can Supply a script which a number of language files that are separated from the scripts This is a principle and this is what we use also in for any translation within Libo office And you have also a region service that Supports The calculation of Certain times or time offsets or that that kind of things well to just to answer the question when it's 12 o'clock In Milan what time is it in Tokyo? this is Supported here and it lies on you know of course so you know supports from for doing that But who knows that support as Which end users knows that that that Libo office and you know have the necessary Primitives to supply that kind of answers. It's not not obvious at all Here a number of also nice features in Calc to also to illustrate the philosophy a range in script for is a string it's also a single range, but it's a string and The string is what you find in formulas classically in Calc but Extended with a number of placeholders that you can put in your range You can put a tilt to say well, it's the current selection You can pull the start to say well, it's the last cell of the sheet of the row of the column and Okay, it's a string and with a number of extensions so a number of methods have also of course a Range as a string as input, but many methods return a range also Effectively as a string and you have the list there you have a number of a huge number of methods they are returned also arranged because In many cases and this is a user point of view The data comes from somewhere you put it in in a data sheet But you don't know the size of the data that you have in a sheet So it's if you have many cases where the size is unpredictable. I Just take a simple example here. I don't say that's the shortest way to do it But let's say we I have a matrix in columns BC and D And what I want to do, but I don't know how many lines So I don't know the width of of my my area. I just know it starts in b2 and extends from there and I want to have the sum of all items row by row in the next available column well, I must be able I must be able to I must be able to Construct my scripts step by step, but independently from the size. Well, it's possible thanks to the ID I You have a number of premises that return ranges and to have here an example and to have also Still on calc That's an extension of that as I start from the same matrix. I I have also the concept of filters There's nothing to do with calc filters. It's just the ID. I want to do something But by selecting by selecting either the rows or the columns or the cells Where I want them to be applied In the example I want to keep only the rows where the last column Does not contain a multiple of 10 wide It's not important in say, but it's just the idea that you can just express with a calc formula It's there. I say modular 10 must not be zero and The result is that the two rows containing 30 and 60 as some of the rows are removed And the resulting range is what still exists in the sheet Okay, that gives a bit the Resonning what we what we made on calc. Here's something else about user interfaces in dialogues you may have Three controls and they are very fine very nice to display tabular data When the tabular data is sorted Well here the example is how can I Display in a tree control the content of the bibliography database, which is also shipped with LibreOffice as an example and Well, we use first the database service below there in the gray in the gray rectangle You see where I express just a select statement and I do get rose get rose is very powerful because It does not depend on the type of field or number of fields, whatever it just Produces an array or a tuple of tuples that is for the data expansion and We provide a control service the dialogue control service, which May be a tree control with a number of methods and properties and some of them are typical for three controls and Three we can make that just by adding the full set of data in one Statement at sub tree. Well, the trees constructed is built. We can do that statically or dynamically if you click on On some node you click on the expansion and symbol Well, you can get the data from some for the day from the database at that moment. We can make still in the user interface Quite rapidly pop up menus And the idea is not to to build the tree node by node like you Want to do maybe should do it in with you know, it's it's much simpler than that. We just list the items Like you see just the the the full branch Line by line and we can add With that technique either item normal item the radio button button or checkbox We just the idea is just to list The items one by one. This makes that when you have to update your pop-up menu is much easier But it's it's quite straightforward For a user to write this one Same for menus For of course, there is a main difference a menu Well when must be clicked to be activated the puppy menu pop-up menu you activate the menu as a whole While and then you can wait for the answer while for a menu Well the menu stays there for forever up to his deletion and you can wait for the execution of Some item in the menu and that is executed with the definition of just An event that can be triggered here, but these are not standard events these are events that are Managed by ship for the by ship forge in the background Here I want to give Rapidly a full example the question is I want to have a dialogue displaying the actual data in the form of a chart in in the dialogue so today You cannot make that easily so I start with the definition of number of initializations This is the full the full script You will see it's 18 lines as a whole and I start with the import statement in python I just define In advance that I will use a number of script for services. I call them basic user interface and file system Second step I get the data still from the bibliography database. I want to List how many Books exist by language in a nice pie chart. That's the objective I get the data from the database So I define where is the database and I Make the select statement. I get the rows. I close the database. I get the rows in An array or a tuple of tuples called data Next step. I import the data in calc I have to make here because bibliography is does not accept the Count by Aggregated function in sql. So I have to make a pivot table in in calc But I create a new calc sheet Completely hidden. So in the background it's not visible for the user. I import the data with the set array statement, I make the pivot table with a number of arguments the pivot table appears it's there in the top right corner of the slide And I define the chart with a number of Characteristics is a chart type is a pie The I request to have three dimensions and I ask to have the regent available appearing also And finally I export the file because I have to do that to Any temporary file I use for that a file system service and I get temp name to to get just any temporary name at that moment I export the file and in the dialogue I put that the dialogue dot controls and the name of the control is image control dot picture Just must contain the name of the file that I just filled in with the With the with the chart. So I have here in less than 20 lines including commands. I have here Just a script that I think is easy to read It's quite easy to make easy to test and that Make something that is okay an idea An objective that the user had at that moment. I think it's it's important to have so Something that it's that makes use in fact in the background of many many Calls to several, you know Items it's easy. I think here approve that it's very concentrated So we have still for the next future and so we are still two minutes and so it's just the end Number of topics that we still want to develop in the near future Also in at the site of the user interface Mainly toolbars A number of service probably also because run things and that kind of things particularly in basic is Very incomplete And then in any kind of base and databases Data sheets We want to know for instance if the user has A clicks on a row in a data sheet He must be able to start a script from there and know knowing Where which row he had selected at that moment from for instance a typical example And there are a number of quick operations on on database aspects Okay, thank you. And so I'm here representative of a number of people who work together to produce What I explained today If Thank you Yeah, thank you. So, uh, do you normally get Request from users saying or could you please implement this in a script script force and You have telegram group where we Me together so we discuss constantly when we want to plan when we are planning something new Work together to define what we will do with Which priorities but of course if you have requests if you concretely want To see New things appearing in the in the libraries. It's certainly possible and can discuss that. Yeah, excuse me. Is the question Do we know which end users use script for that kind of things? No, we don't know That there are no means to identify what whatever they are really doing We have feedbacks all the ways but number of people that kind of things we have no idea But if there are there are channels to express their wishes for having new things. Yes