Jump to content

RunTime IDE on WEB ? with RunTime Script ?


sagt3k
 Share

Recommended Posts

Hi,

I use objects for many years as Fast-Script to write code at run-time, saved on database and always be modified in real-time.

I wonder if I can have an object at run-time on UNIGUI able to modify the form and then be able to apply code at run-time with objects as Fast-Script or RemObjects Pascal Script.

I think it can be very useful to manage a quick maintenance of our software over the Web without changing the application .exe.

 

What do you think?

Link to comment
Share on other sites

Hi,

I use objects for many years as Fast-Script to write code at run-time, saved on database and always be modified in real-time.

I wonder if I can have an object at run-time on UNIGUI able to modify the form and then be able to apply code at run-time with objects as Fast-Script or RemObjects Pascal Script.

I think it can be very useful to manage a quick maintenance of our software over the Web without changing the application .exe.

 

What do you think?

 

That would be very interesting indeed.

Send us an example ... how you did it!

It would be nice to see working.

 

 

Link to comment
Share on other sites

At present am maintaining an engine that works on a classic project delphi. For several months I'm trying to port the entire project to UNIGUI unverse with great difficulty :) . However, I anticipate that the script can work in multi-thread on which I create in the form of TFrame then applying scripts that fetch from database. This allows me to change the logic of the program in real time. The program at the end is just a shell. Thank you for your interest, however, thought that working on the web is one of the most effective and quick to do maintenance projects to clients.

Link to comment
Share on other sites

OK, This is the heart of the current thread, which allows the start of the script and assign objects. For now I am busy with porting UNIGUI whole project, I will keep you informed as soon as I ported the script.

 

procedure TScriptThread.Execute;
Var Error:Boolean;
begin
CoInitializeEx(nil, COINIT_MULTITHREADED);
//-----------------------------------------------------------------------------
fsClassesRTTI1:=TfsClassesRTTI.Create(TForm(ChildForm));
fsGraphicsRTTI1:=TfsGraphicsRTTI.Create(TForm(ChildForm));
fsFormsRTTI1:=TfsFormsRTTI.Create(TForm(ChildForm));
fsExtCtrlsRTTI1:=TfsExtCtrlsRTTI.Create(TForm(ChildForm));
fsDialogsRTTI1:=TfsDialogsRTTI.Create(TForm(ChildForm));
fsMenusRTTI1:=TfsMenusRTTI.Create(TForm(ChildForm));
fsADORTTI1:=TfsADORTTI.Create(TForm(ChildForm));
fsDBRTTI1:=TfsDBRTTI.Create(TForm(ChildForm));
fsDBCtrlsRTTI1:=TfsDBCtrlsRTTI.Create(TForm(ChildForm));
fsChartRTTI1:=TfsChartRTTI.Create(TForm(ChildForm));
fsScript1:=TfsScript.Create(TForm(ChildForm));
fsPascal1:=TfsPascal.Create(TForm(ChildForm));
fsCPP1:=TfsCPP.Create(TForm(ChildForm));
fsJScript1:=TfsJScript.Create(TForm(ChildForm));
fsBasic1:=TfsBasic.Create(TForm(ChildForm));
fsScript1.SyntaxType:=LangScript;
fsScript1.OnRunLine:=fsScript1RunLine;
ErrorList:=TStringList.Create;
StrToPrintMsg:='Compiling ...';  Self.Synchronize(PrintMsg);
MsgList:=TStringList.Create;
CicliIstruz:=0;
Try
 fsScript1.Clear;
 fsScript1.AddRTTI;
 fsScript1.AddClass(TForm, 'TForm');
 fsScript1.AddClass(TApplication, 'TApplication');
 fsScript1.AddClass(TWinControl,'TWinControl');
 fsScript1.AddClass(TPanel,'TPanel');
 fsScript1.AddClass(TEdit,'TEdit');
 fsScript1.AddClass(TCustomADODataset,'TCustomADODataset');   
 fsScript1.AddClass(TADODataset,'TADODataset');
 fsScript1.AddClass(TCustomEdit,'TCustomEdit');
 fsScript1.AddObject('Self',Self);
 fsScript1.AddObject('Application',Application);
 fsScript1.AddObject('MainForm', TForm(Engine.MainForm));
 fsScript1.AddObject('ChildForm', TForm(ChildForm));
 if MainPanel<>Nil then
  fsScript1.AddObject('MainPanel',MainPanel);
 fsScript1.AddMethod('procedure ApplicationProcessMessages;',CallMethod);
 fsScript1.AddMethod('procedure ClearMsg',CallMethod);
 fsScript1.AddMethod('procedure ClearOut',CallMethod);
 fsScript1.AddMethod('function  GetInstrCycle:Int64;',CallMethod);
 fsScript1.AddMethod('function  GetTickCount:Longint;',CallMethod);
 fsScript1.AddMethod('function  GetThreadID:Integer;',CallMethod);
 fsScript1.AddMethod('function  GetThreadSession:String;',CallMethod);
 fsScript1.AddMethod('procedure Pause(Str:String);',CallMethod);
 fsScript1.AddMethod('procedure Print(Str:Variant);',CallMethod);
 fsScript1.AddMethod('procedure PrintMsg(Str:Variant);',CallMethod);
 fsScript1.AddMethod('procedure Sleep(time:integer);',CallMethod);
 //----------------------------------------------------------------------------
 Try If @thScriptAddObject<>Nil then thScriptAddObject(Self); except End;
 fsScript1.Lines.Text:=TextScript;
 StrStatus:='Running|'+FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now);
 Self.Synchronize(UpdateScriptThread);
 Error:=False;
 fsScript1.Run;
except
  on E: Exception do
   Begin
	Error:=True;
	ErrorList.Add(LastLine1+' : '+E.Message);
	StrStatus:='Error|'+FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now);
	Self.Synchronize(UpdateScriptThread);
   End;
end;
Try
 if fsScript1.ErrorMsg<>'' then
  Begin
   Error:=True;
   ErrorList.Add(fsScript1.ErrorMsg+' - '+fsScript1.ErrorPos+' - '+fsScript1.ErrorUnit);
   StrStatus:='Error|'+FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now);
   Self.Synchronize(UpdateScriptThread);
  End;
except
End;
Try
 if (Messages<>Nil) and (ErrorList.Text<>'') then
  Messages.Lines.Add(ErrorList.Text);
except
End;
 if Error=False then
  StrStatus:='End|'+FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now);
  Self.Synchronize(UpdateScriptThread);
 End;
Self.Synchronize(EndScriptThread);
CoUninitialize;
Try fsScript1.Terminate except End;
end; 

 

PS: Please format your code before posting - Farshad

Link to comment
Share on other sites

  • 5 years later...

Adding scripting to a project should be (and it is) totally unrelated to the platform.

If you look at the latest Best Practices, with uniGUI with can target both platforms - desktop and touch - and it is possible to separate the user interface from the business logic.

Basically, we should leverage Delphi actions and event handlers for moving all the business logic to a data module.

Any piece of code in the data module is just Delphi code and it could be implemented by using a scripting language. The only requirement is to provide the bindings (the script must be able to reference the host application classes).

You can use Pascal Script, paxCompiler, anything.

Things become more interesting when you add a run-time Form Designer to the mix, allowing you to redesign (or just design) the user interface, save that design, and load it again everytime you activate it again.

 

Everything is possible!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...