softtouch 9 Posted January 17 Does anybody know of any easy to learn opensource scripting language? I need to be able to send string to the scripting engine from Delphi, have it process the strings and return the result to Delphi. I also need to be able to load such scripts at runtime and execute them. Each of such script need to do different thing, based on some parameter, so I might need to load many different scripts at the same time. Share this post Link to post
dummzeuch 1505 Posted January 17 Is Python open source and easy to learn enough? There are lots of others though, e.g. Delphi Web Script to name a more obscure one that is written in Delphi and therefore easy to include in any Delphi program. Share this post Link to post
Lars Fosdal 1792 Posted January 17 There is also Embedded LUA for Delphi https://blogs.embarcadero.com/powerful-verysimple-lua-embeddable-scripting-language-library-for-delphi/ https://github.com/Dennis1000/verysimplelua Share this post Link to post
Lajos Juhász 293 Posted January 17 Pascal Script was also a good scripting language it's unfortunate that is dying slowly. Share this post Link to post
softtouch 9 Posted January 17 1 hour ago, dummzeuch said: Is Python open source and easy to learn enough? There are lots of others though, e.g. Delphi Web Script to name a more obscure one that is written in Delphi and therefore easy to include in any Delphi program. DWScript seems to be up to Delphi 11.x only, but I use Delphi 12. Share this post Link to post
dummzeuch 1505 Posted January 17 25 minutes ago, softtouch said: DWScript seems to be up to Delphi 11.x only, but I use Delphi 12. I have the opposite problem: It apparently no longer supports Delphi 2007. Your problem is easier to solve: Just load the Delphi 11 package and let the IDE automatically upgrade it. Your chances are good that it will just work. Share this post Link to post
softtouch 9 Posted January 17 Python is too huge for just the small things I want to do, and I dont want to dig into python programming. I took a look at TJvInterpreterProgram, but its hard due to lack of documentation. It works, but I could not figure out how to use system functions like copy, delete etc. from within the code for the interpreter. Share this post Link to post
hsauro 40 Posted January 18 5 hours ago, softtouch said: Python is too huge for just the small things I want to do, and I dont want to dig into python programming. I took a look at TJvInterpreterProgram, but its hard due to lack of documentation. It works, but I could not figure out how to use system functions like copy, delete etc. from within the code for the interpreter. Your best bet given your requirements is lua, mentioned previously. Used a lot in gaming apps. Share this post Link to post
FPiette 383 Posted January 18 A few years ago I used DWScript with great success. You can easily have variables and function from your host application exposed to the script. DWScript scriting language is easy to learn since it is almost Delphi language. Share this post Link to post
softtouch 9 Posted January 18 5 hours ago, hsauro said: Your best bet given your requirements is lua, mentioned previously. Used a lot in gaming apps. Not sue lua is ok for my project. I saw it does not know anything about regex. Share this post Link to post
Lajos Juhász 293 Posted January 18 34 minutes ago, softtouch said: Not sue lua is ok for my project. I saw it does not know anything about regex. Regex is a new requirement in this thread. Share this post Link to post
softtouch 9 Posted January 18 Just now, Lajos Juhász said: Regex is a new requirement in this thread. Maybe I could use gmatch instead of regex, that might be ok. I am currently playing with lua, but could not yet figure out how to return a string to delphi. Share this post Link to post
TiGü 21 Posted January 18 PowerShell is a powerful scripting language and you will find lot of materials (youtube, tutorials, books) about it. Share this post Link to post
softtouch 9 Posted January 18 Thanks for all the suggestions. I think I will go with lua as recommended by Lars Fosdal (thanks for that). I got most things running already and even it has no regex, gmatch and some other will do it. Share this post Link to post
Lars Fosdal 1792 Posted January 18 Please note that the Embedded LUA was a search find. I have not used it myself. Share this post Link to post
softtouch 9 Posted January 18 5 minutes ago, Lars Fosdal said: Please note that the Embedded LUA was a search find. I have not used it myself. But it was a good find 🙂 It works well so far. Thanks again. 1 Share this post Link to post
Anders Melander 1783 Posted January 18 9 hours ago, FPiette said: DWScript scriting language is easy to learn since it is almost Delphi language. The script language is easy but integrating DWScript into an application is hard; There is zero documentation and the examples are insufficient. I've used DWScript since Delphi 5 but I still find it hard to use. Share this post Link to post
John R. 18 Posted January 19 19 hours ago, Anders Melander said: The script language is easy but integrating DWScript into an application is hard; There is zero documentation and the examples are insufficient. I've used DWScript since Delphi 5 but I still find it hard to use. I can confirm that but once integrated, it is very stable, frequently updated with lots of unit tests! I highly recommend DWScript. Share this post Link to post
zed 14 Posted January 19 (edited) On 1/18/2024 at 2:38 PM, softtouch said: I got most things running already and even it has no regex, gmatch and some other will do it. You can provide your own functions to work with regex in lua. Its API is very flexible. Look at this for example: https://www.geek.co.il/~mooffie/mc-lua/docs/html/modules/regex.html (the implementation is quite simple: regex.c) Edited January 19 by zed Share this post Link to post
softtouch 9 Posted January 21 (edited) Back to searching... LUA is not what I can use, it seems not to support UTF-8 for files. Edited January 21 by softtouch Share this post Link to post
shineworld 73 Posted January 24 I don't know if support Unicode (I guess) but I've used it in past years and was very simple to use: https://www.remobjects.com/ps.aspx Share this post Link to post