Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Strings als Anweisung übergeben (https://www.delphipraxis.net/91174-strings-als-anweisung-uebergeben.html)

mkinzler 2. Mai 2007 06:40

Re: Strings als Anweisung übergeben
 
Package:
Delphi-Quellcode:
package PascalScript_Core_D7;

{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'RemObjects Pascal Script - Core Package'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}

requires
  rtl,
  vcl
  //dbrtl;

contains
  uPSC_extctrls in 'uPSC_extctrls.pas',
  uPSC_forms in 'uPSC_forms.pas',
  uPSC_graphics in 'uPSC_graphics.pas',
  uPSC_menus in 'uPSC_menus.pas',
  uPSC_std in 'uPSC_std.pas',
  uPSC_stdctrls in 'uPSC_stdctrls.pas',
  uPSCompiler in 'uPSCompiler.pas',
  uPSComponent in 'uPSComponent.pas',
  uPSComponent_COM in 'uPSComponent_COM.pas',
  uPSComponent_Controls in 'uPSComponent_Controls.pas',
  uPSComponent_DB in 'uPSComponent_DB.pas',
  uPSComponent_Default in 'uPSComponent_Default.pas',
  uPSComponent_Forms in 'uPSComponent_Forms.pas',
  uPSComponent_StdCtrls in 'uPSComponent_StdCtrls.pas',
  uPSDebugger in 'uPSDebugger.pas',
  uPSDisassembly in 'uPSDisassembly.pas',
  uPSPreProcessor in 'uPSPreProcessor.pas',
  uPSR_buttons in 'uPSR_buttons.pas',
  uPSR_classes in 'uPSR_classes.pas',
  uPSR_comobj in 'uPSR_comobj.pas',
  uPSR_controls in 'uPSR_controls.pas',
  uPSR_dateutils in 'uPSR_dateutils.pas',
  //uPSR_DB in 'uPSR_DB.pas',
  uPSR_dll in 'uPSR_dll.pas',
  uPSR_extctrls in 'uPSR_extctrls.pas',
  uPSR_forms in 'uPSR_forms.pas',
  uPSR_graphics in 'uPSR_graphics.pas',
  uPSR_menus in 'uPSR_menus.pas',
  uPSR_std in 'uPSR_std.pas',
  uPSR_stdctrls in 'uPSR_stdctrls.pas',
  uPSRuntime in 'uPSRuntime.pas',
  uPSUtils in 'uPSUtils.pas',
  uPSC_buttons in 'uPSC_buttons.pas',
  uPSC_classes in 'uPSC_classes.pas',
  uPSC_comobj in 'uPSC_comobj.pas',
  uPSC_controls in 'uPSC_controls.pas',
  uPSC_dateutils in 'uPSC_dateutils.pas',
  //uPSC_DB in 'uPSC_DB.pas',
  uPSC_dll in 'uPSC_dll.pas',
  PascalScript_Core_Reg in 'PascalScript_Core_Reg.pas';

end.
Delphi-Quellcode:
unit PascalScript_Core_Reg;

{----------------------------------------------------------------------------}
{ RemObjects Pascal Script
{
{ compiler: Delphi 2 and up, Kylix 3 and up
{ platform: Win32, Linux
{
{ (c)opyright RemObjects Software. all rights reserved.
{
{----------------------------------------------------------------------------}

{$I PascalScript.inc}

interface

{$R PascalScript_Core_Glyphs.res}

procedure Register;

implementation

uses
  Classes,
  uPSComponent,
  uPSDebugger,
  uPSComponent_Default,
  uPSComponent_COM,
  //uPSComponent_DB,
  uPSComponent_Forms,
  uPSComponent_Controls,
  uPSComponent_StdCtrls;

procedure Register;
begin
  RegisterComponents('RemObjects Pascal Script', [TPSScript,
                                       TPSScriptDebugger,
                                       TPSDllPlugin,
                                       TPSImport_Classes,
                                       TPSImport_DateUtils,
                                       TPSImport_ComObj,
                                       //TPSImport_DB,
                                       TPSImport_Forms,
                                       TPSImport_Controls,
                                       TPSImport_StdCtrls]);
end;

end.

Aike 2. Mai 2007 07:57

Re: Strings als Anweisung übergeben
 
Liste der Anhänge anzeigen (Anzahl: 1)
Gibt es da auch die Möglichkeit, weitere Units etc. einzubauen? Ich möchte zum Beispiel auch Showmessage() benutzen und eigene Units :-)

[edit]Das sieht alles sehr schön aus und ich werd's bestimmt mal verwenden, aber ...
Delphi-Quellcode:
var s:string;
begin
  s:='close';
  s;
end;
... geht trotzdem nicht ;-)

Was geht, ist, dass du in ein Memo-Feld deine Befehle eingibst, aber die können auch nicht auf alle System-Units zugreifen.

Beispiel (in das Memo-Feld eingegeben):
Delphi-Quellcode:
program Test;

begin
  Application.Messagebox('bla','bla',0);
end.
=> Compilieren (F9); gibt eine MsgBx aus :-) Leider kennt er auch "MB_ICONINFORMATION" nicht.
[/edit]

Flocke 2. Mai 2007 08:46

Re: Strings als Anweisung übergeben
 
Als allererstes solltest du dir klar machen, dass das Script nicht im Kontext deiner Anwendung ausgeführt wird, sondern in einem eigenen - es kennt also zuerst einmal überhaupt keine Methoden außer den eingebauten.

Du kannst mit "AddMethod" eine Methode für die Benutzung im Script registrieren, z.B. mit
Delphi-Quellcode:
Script.AddMethod(Self, @TCustomForm.Close, 'procedure Close;');
Schau dir doch erst einmal die Beispiele in "C:\Programme\RemObjects Software\Pascal Script for Delphi\Samples" (oder wo immer dein Installationspfad liegt).


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:39 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz