Scripting ...
Scripting ...
This question is adressed to Antonio. I know that xHB have "xHbScript" . It's requirement to have something to FWH , that script will support good FWH things ... . What you can say , Antonio ? ... Or maybe it's any other technique which can support FWH libs ? I'm asking for that , because it's ideas to do own ERP more flexible and , I'm thinking , scripting with FWH can do this job ...
With best regards ! Rimantas
With best regards ! Rimantas
Rimantas U.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
I know xhbScript . But I have in mind scripts which can work with FWH syntax . As a sample - open dialog with some controls - gets , buttons :Antonio Linares wrote:Rimantas,
You may use xHB's "xHbScript", it works fine with FWH
Code: Select all
#include "FiveWin.ch"
function Main()
local oDlg, lExit := .f., oBtn
DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE "A Dialog Box"
@ 3, 4 BUTTON "&Ok" OF oDlg SIZE 40, 12
@ 3, 12 BUTTON oBtn PROMPT "&Cancel" OF oDlg SIZE 40, 12 ;
ACTION ( MsgInfo( "Cancel" ), lExit := .t., oDlg:End() )
ACTIVATE DIALOG oDlg VALID lExit
return nil
Regards !
Rimantas U.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Hello James ,James Bott wrote: I'm just curious, where are you going with this? What is the advantage to using script insead of code?
At first I want to to specify , that I'm talking about separate prgs as scripts ... It can be prg as script can run , or xbs , ppo files as they are supported from xharbour.com ...
Exist many places where the scripts are better than code . One of the best place to fit scripts are reports ... Today I'm addidng code inside exe for any report . I'm thinking that this can be changed in other way - put prg's or ppo's files in special directory , from main program in report menu ( generated from DBF ,which contain list of reports ) call needful report = script ... With database it's all working OK . But at the beggining of report I'm calling dialog/window in which user direct needfulls parameters for report . Of course , all the code is with FWH ...
I begin from reports , because this place must be very flexible - at the begining of new project users don't know possibilities of programmer and programmer can't to see future - what users will ask ... . So , in mine mind , directory with prg's or precompiled ppo's , maybe xbs's , files it's the easiest way to manage such things . Now , I'm adding code , rebuilding exe , and then placing the new exe remotely in users servers . I'm thinkig that remotely to do new prg file or modify old its more easy ...
Antonio , sorry , but xbScript don't support FWH syntax . I renamed dlg.prg to dlg.xbs and tried to open that . It return error dialog with "compilation error" message ... Maybe it's working and I don't know how to to run that .
So I'm asking you , that maybe something similar exist in FWH or xHarbour ...
Regards , Rimantas
Rimantas U.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Rimantas,
I just forgot this: Harbour natively supports dynamic scripting! There is no need for you to use a third party scripting tool!
You create a HRB file on runtime and execute it from the application, so there is no limitations at all and you can execute any Harbour code
Let me find some samples for you.
James, runtime scripting is an incredible powerfull feature, that allows to have full data driven support in your applications Its the foundation of ERP applications
I just forgot this: Harbour natively supports dynamic scripting! There is no need for you to use a third party scripting tool!
You create a HRB file on runtime and execute it from the application, so there is no limitations at all and you can execute any Harbour code
Let me find some samples for you.
James, runtime scripting is an incredible powerfull feature, that allows to have full data driven support in your applications Its the foundation of ERP applications
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
I have been watching this topic with interest. I am using xharbour (bcc) now. But like to know the possibilities of creating hrb files on the fly and running them both in harbour and xharbour. In principle what I am looking for is something similar. Have some code as data somewhere and run it at runtime, instead of replacing the exe for every small modification.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
This is a simple test. Please have a copy of harbour.exe where you run this:
test.prg
Another.prg
Please notice that Harbour users don't need to keep an external harbour.exe as they can use hb_CompileBuf() that compiles from the application itself
test.prg
Code: Select all
#include "FiveWin.ch"
function Main()
Compile( "another.prg" )
__HrbRun( "another.hrb" )
MsgInfo( "done" )
return nil
function Compile( cPrgName )
WinExec( "harbour.exe " + cPrgName + " /n /gh", 0 )
while ! File( cFileNoExt( cPrgName ) + ".hrb" )
SysRefresh()
end
return nil
Code: Select all
function DontNameThisMain()
MsgInfo( "Hello world!" )
return nil
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
NageswaraRao,
Just copy the data to a temporal external file:
MemoWrit( "test.hrb", cHrbData )
later on, erase it:
FErase( "test.hrb" )
Just copy the data to a temporal external file:
MemoWrit( "test.hrb", cHrbData )
later on, erase it:
FErase( "test.hrb" )
Last edited by Antonio Linares on Fri Nov 02, 2007 8:53 am, edited 1 time in total.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
I have tested with xharbour. In xharbour __hrbrun requires the filename as parameter. it looks like __hrbrun calls __hrbload with the file name. now if _hrbrun uses __hrbload to load the hrb file into memory, then what is the function that executes the code in the memory ? i guess we need to use that function to execute code in memory
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India