🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
2 messages
2 total messages Started by Sqwertz Fri, 12 Dec 2014 07:07
Scripting Functions in 40tude Dialog
#258689
Author: Sqwertz
Date: Fri, 12 Dec 2014 07:07
21 lines
1822 bytes
Why is when I try and write or modify scripts in Dialog I always seem
to run into unknown built-in functions?  Are only a subset of the
Delphi functions available in the Dialog scripting host?  Or maybe
built around an old version of Delphi that does not support these
functions?

Specifically, how do you assign a date to TDateTime variable?  All the
references for Delphi say this is how it's done:

  var toDate : TDateTime;
 ......
  toDate   := EncodeDateTime(2015, 12, 31, 23, 59, 59, 0);

Compiler error is:

Failed when compiling: Unknown identifier 'EncodeDateTime'

Every time I have to use Delphi in Dialog I find myself banging my
head against the wall!

-sw
Re: Scripting Functions in 40tude Dialog
#258695
Author: Bernd Rose
Date: Fri, 12 Dec 2014 21:12
36 lines
2759 bytes
On Fri, 12 Dec 2014 01:07:31 -0600, Sqwertz wrote:

> Why is when I try and write or modify scripts in Dialog I always seem
> to run into unknown built-in functions?  Are only a subset of the
> Delphi functions available in the Dialog scripting host?  Or maybe
> built around an old version of Delphi that does not support these
> functions?

Object Pascal. The Dialog Help file lists the available functions
and types (last chapter of section Reference). On this page Marcus
recommends the Reference Book by Marco Canto, which is still online
under the link from the help file. The second edition of the book
is free to download and, IMHO, more than sufficient for scripting
Dialog.
 
> Specifically, how do you assign a date to TDateTime variable?  All the
> references for Delphi say this is how it's done:
> 
>   var toDate : TDateTime;
>  ......
>   toDate   := EncodeDateTime(2015, 12, 31, 23, 59, 59, 0);

There's no such thing as EncodeDateTime() in Object Pascal. But there
are two separate functions, which can quite easily be combined:

;--------------------------------------------------------------------
Program Test;
 var toDate:TDateTime;
Begin    
 toDate := EncodeDate(2015, 12, 31) + EncodeTime(23, 59, 59, 0);  
 Writeln(DateTimeToStr(toDate));
End.
;--------------------------------------------------------------------

HTH.
Bernd
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads