Recent

Author Topic: I need scripts to execute Pascal routines  (Read 14639 times)

garlar27

  • Hero Member
  • *****
  • Posts: 652
I need scripts to execute Pascal routines
« on: January 21, 2011, 08:58:59 pm »
Hi,
    I'm doing a program that generates keystrokes as if a user where using the computer. The goal of this project is to run a stand alone test of other applications by executing the same test cases as needed.
    I've done a simple script to see if the project was technically possible, and it is, so now I need a powerful script language which has to access the internal tester's routines (specially the ones that generate keystrokes and mouse events), and obviously it must be cross platform.

    Does anybody know of a scripting language capable of what I mentioned?

    Actually I'm gathering info from Pascal Script, and trying to find a post in our forum where a Chinese guy (as I remember) who has done something similar (Damn! I can't find that thread!).

    I want to check all options before choosing one, or build one on my own.


Thanks.
Eric

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12652
  • FPC developer.
Re: I need scripts to execute Pascal routines
« Reply #1 on: January 21, 2011, 09:18:15 pm »
   I'm doing a program that generates keystrokes as if a user where using the computer. The goal of this project is to run a stand alone test of other applications by executing the same test cases as needed.
    I've done a simple script to see if the project was technically possible, and it is, so now I need a powerful script language which has to access the internal tester's routines (specially the ones that generate keystrokes and mouse events), and obviously it must be cross platform.

You use the word "script" a lot. I'm not entirely sure what you mean by that. In my book "script" is all one off throw-away programming(*), and I do a lot of it in Free Pascal.

Could you please explain what your exact requirements of what a "scripting language" is in your book?
 

(*) basically if it is worth committing to a revision system, it is not a script
« Last Edit: January 21, 2011, 10:47:17 pm by marcov »

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I need scripts to execute Pascal routines
« Reply #2 on: January 21, 2011, 09:44:58 pm »

You use the word "script" a lot. I'm not entirely sure what you mean by that. In my book "script" is all one off throw-away programming(*), and I do a lot of it in Free Pascal.

Could you please explain what your exact requirements of what a "scripting language" is in your book?
 

yeah, I usually repeat the same words within the same paragraph  :-[ ...

Script as I understand:

   A plain text file (or bytecode file) which has a well defined syntax and can be interpreted "on the fly" by an application which executes the commands written in that file.

   Something like bash or javascript (although I've never used javascript). But, from the script, I need to call procedures and functions defined in my program.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: I need scripts to execute Pascal routines
« Reply #3 on: January 21, 2011, 10:18:16 pm »
I use both Pascal Script and Lua, both are capable of calling or being called from compiled Pascal code, and designed to be used as a library.

The former is nice for fast script execution as (contrary to any other scripting language) it uses static type checking and you don't need to learn a new language, as a bonus the compiled script could be dumped so it doesn't have to recompile in the next execution (you might want to have automatic checking of this so your program could decided whether to recompile or not).

The latter is nice to be used as data definition language, has a single but powerful data structure (table), with Pascal-like syntax (case-sensitive, unfortunately), dynamic typing, quite fast in scripting language realm as it uses register based virtual machine (as opposed to more commonly used stack based one), small implementation (the full fledged implementation is around 265K).

Learn both and decide yourself.

PAEz

  • New Member
  • *
  • Posts: 29
Re: I need scripts to execute Pascal routines
« Reply #4 on: January 22, 2011, 09:33:30 am »
Ive never used it, but another possible option is Besen....
http://besen.sourceforge.net/
...personally I like Lua, but I thought Id mention it.
Lazarus 0.9.29  Windows XP sp3
E6400 2gig ram 7900GTX 512meg

I have a shocking memory and am a crap coder, so take everything I say with a grain of doubt

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I need scripts to execute Pascal routines
« Reply #5 on: January 24, 2011, 01:49:39 pm »
Wow!! I didn't know about Lua!! (gotta read a little more about it)
Pascal Script looks great!


Later I'll read about Besen....

Guess gonna be hard to decide ... later I'll post my choice ...

If someone has more suggestions they're welcome!!

Thanks.
Eric.
« Last Edit: January 24, 2011, 01:53:25 pm by garlar27 »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: I need scripts to execute Pascal routines
« Reply #6 on: January 24, 2011, 06:30:46 pm »
BESEN looks like a very nice Javascript implementation, but be sure to read its license!

Thanks.

-Phil

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: I need scripts to execute Pascal routines
« Reply #7 on: January 24, 2011, 06:53:08 pm »
I'll read it's license first. Thanks for the advise Phil. I don't want to learn something I can't use.

jl

  • Full Member
  • ***
  • Posts: 178
Re: I need scripts to execute Pascal routines
« Reply #8 on: June 28, 2011, 07:41:27 pm »
Hi, I found this thread by searching for Pascalscript.  I downloaded the demos for pascalscript, it appears to be quite complex.

If i need something as simple as this, which (besen, pascalscript, or lua) should I use? 

Code: [Select]
If xxx = 'yyy' then
begin
runfunction(x)
end
else begin
  runfunction(y);
exit;
end;

If xxx > 123 then runfunction(x) else runfunction(y);
exit;

xxx, yyy, x and y are variables I will pass to the script, which the user will modify the script in a memobox.  I do not necessarily need to use Pascal for the scripting - the end users are sys admins.  Preferably there should be a way to test the script - in case the user tries to use xxx>123, where xxx is a string variable!

Appreciate any opinion, thanks!
« Last Edit: June 28, 2011, 07:55:56 pm by touchring »

lainz

  • Guest
Re: I need scripts to execute Pascal routines
« Reply #9 on: June 29, 2011, 01:02:42 am »
Hi, I found this thread by searching for Pascalscript.  I downloaded the demos for pascalscript, it appears to be quite complex.

If i need something as simple as this, which (besen, pascalscript, or lua) should I use? 

Code: [Select]
If xxx = 'yyy' then
begin
runfunction(x)
end
else begin
  runfunction(y);
exit;
end;

If xxx > 123 then runfunction(x) else runfunction(y);
exit;

xxx, yyy, x and y are variables I will pass to the script, which the user will modify the script in a memobox.  I do not necessarily need to use Pascal for the scripting - the end users are sys admins.  Preferably there should be a way to test the script - in case the user tries to use xxx>123, where xxx is a string variable!

Appreciate any opinion, thanks!

Lua, is just that.

jl

  • Full Member
  • ***
  • Posts: 178
Re: I need scripts to execute Pascal routines
« Reply #10 on: June 29, 2011, 06:49:17 pm »
Thanks, I did some googling around, Plua seems a little too complex for me to understand, unfortunately.

FPC lua components is simple enough based on this example (http://lua-users.org/wiki/LuaInFreePascal) but my app current needs to cross compile on Delphi as well. 

Any thoughts?   :)


Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: I need scripts to execute Pascal routines
« Reply #11 on: July 01, 2011, 11:12:00 am »
Quote
but my app current needs to cross compile on Delphi as well.
It's actually better to use Plua since it's designed for both FPC and Delphi. What's complex there? It helps class and routine registration so you can do it easier than with plain lua.

PAEz

  • New Member
  • *
  • Posts: 29
Re: I need scripts to execute Pascal routines
« Reply #12 on: July 02, 2011, 11:21:29 am »
I really like PLua but it seems to cause memory leaks.
It could just be me because Im not great at this stuff, but if I run the examples with Heaptrc it spits a bunch of warnings at the end.
Other than that I found working with PLua to be great....if your finding it a little difficult you should relook at the examples, they helped me a great deal.
Lazarus 0.9.29  Windows XP sp3
E6400 2gig ram 7900GTX 512meg

I have a shocking memory and am a crap coder, so take everything I say with a grain of doubt

 

TinyPortal © 2005-2018