New in PS. Simple questions

Hello! I am new in PS with lots of dumb questions. For example:

  1. How to use functions from generic PS units (like ‘now’ from ‘???_dateutils’) in scripts?
  2. How to read and write application variables in scripts?
  3. Is there boolean type in PS (like ‘btBoolean’ or something)?
  4. How to use application functions with such argument types as pBoolean, pLongWord, pDateTime in scripts?

Insert the TPSImport_DateUtils plugin and add it to the list (after Classes)

see the samples; several of them show using external vars:

Boolean is an enum; use findType(‘Boolean’).

No idea what this means.

[quote=“ck, post:2, topic:7868”]Insert the TPSImport_DateUtils plugin and add it to the list (after Classes)[/quote] I forgot to mention that I ask about console application without any visual objects.

[quote=“ck, post:2, topic:7868”]see the samples; several of them show using external vars[/quote] Thank you, I saw them. I can’t find there anything about external variables. There are AddVariable, AddVariableN, AddUsedVariable, AddUsedVariableN, AddUsedPtrVariable and AddUsedPtrVariableN in compiler unit, but I don’t know which of them exactly suits my case.

[quote=“ck, post:2, topic:7868”]No idea what this means.[/quote] I am writing a library for an binary application. The app has API functions like
Procedure P1 (V1: pDateTime; V2: pLongWord; V3: pBoolean);
Does PS has such types to call that functions?

Same idea. Look at the console samples, they register several plugins.

also: https://github.com/remobjects/pascalscript/wiki/Using-RemObjects-Pascal-Script

explains the way add*variable works.

pDateTime isn’t a regular type. But if it’s a pointer to DateTime you can use var parameters. Pascalscript doesn’t support pointers.

Thank you Carlo! I’ve red the wiki and the samples. The console samples describe how to access external functions with TPSPascalCompiler.AddDelphiFunction and TPSExec.RegisterDelphiFunction. Is there a similar way to access external variables (without using TPSScript component)?

PSScript is just a lightweight component wrapper on top of the compiler/exec. So yeah; if you find a call you like in TPSScript you cn use that logic.

Could you please also tell me about difference between TPSPascalCompiler.AddFunction and TPSPascalCompiler.AddDelphiFunction?

AddFunction is for low level registrations. You generally want to use AddDelphiFunction and exec.RegisterDelphiFunction.

4 posts were split to a new topic: Pascal script set var question

A post was merged into an existing topic: Pascal script set var question