Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 04:27 #19164

  • mainhatten
  • mainhatten's Avatar
  • Topic Author


  • Posts: 199
  • This is ***not*** something X# specific, but an option to edit, compile & run simple prg based scripts of fox code
    It needs the Vfp9SP2 Runtimes from github.com/VFPX/VFPRuntimeInstallers or www.foxpert.com/download/runtime.html and will give you a command window REPL from which you can issue anything the Runtime supports - which does include compiling prg into fxp and then run those fxp.
    So those with none or only older versions of fox/vfp can compile & run
    • own scripts after no or minimal editing under the version of vfp X# will implement
    • check out benchmarking scripts comparing the implementation in X# on your machine
    • follow the discussion and examples between dev team and fox heads by running small examples
    • copy the small tidbits found in fox help file and play with those in fox
    • Try out the benefit of integrated SQL
    • Try out the benefit of the buffering / optimistic locking approach coupled with tableupdate
    • write own or run foreign benchmarks and pipe results into text files to compare to VO or X#
    • call into GUI Class libraries after set classlib or via NewObject()
    • build GUI in prg from scratch / test previously class based and prg-ported GUI
    • connect to several backends via Cursoradapter, View or SQL Pass Through
    • and much more
    Original abandoned source is on github.com/EdLeafe/vRunFox, a few fixes/deletions to fix build errors. Changed source available for looking/fixing/adding functinality for the price of asking, perhaps I'll put it on Github. Login is "X#" or "x#", has command history showing off a few things.
    2 minimal dummy Prg added and compiled, as well as table to play with. Do not play with FoxUser.
    Vfp9Sp2 Help File can be loaded: github.com/VFPX/HelpFile
    with small code samples and explaining some of the concepts I mentioned in the list better than I could.

    hope it interests & helps some here
    thomas
    Attachments:

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 15:20 #19165

    • FoxProMatt
    • FoxProMatt's Avatar



    1. I'll check this out.
    2. I really wish you would post it as a repo on Github, rather than attaching it as a zip file in a message board.

    #2 allows for public discussion and issue tracking in the GitHub space, rather than tucked away here in an X# message thread. In my opinion, it would be a lot more interest to the general FoxPro community if it we in it's own github repo.

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 15:33 #19166

    • FoxProMatt
    • FoxProMatt's Avatar



    mainhatten - I sent this link to a VFP friend of mine just now (Jeff Roberts, he's not here on X# board), and he immediately download it to tinker around, and here is his feedback:
    Interesting.... I could be missing something but it asks for a password that I do not know. Scanning through the files in the zip I do not see a password field or clue. I also don't see a PJX/PJT file so think at least some of the source is missing. -Jeff

    Any advice for this issue??

    Please Log in or Create an account to join the conversation.

    Last edit: by FoxProMatt.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 17:25 #19169

    • robert
    • robert's Avatar


  • Posts: 3600
  • Matt,
    Thomas wrote:

    > Login is "X#" or "x#"

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 19:30 #19170

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Hi Matt,

    FoxProMatt wrote: 1. I'll check this out.
    2. I really wish you would post it as a repo on Github, rather than attaching it as a zip file in a message board.

    #2 allows for public discussion and issue tracking in the GitHub space, rather than tucked away here in an X# message thread. In my opinion, it would be a lot more interest to the general FoxPro community if it we in it's own github repo.

    On 1)
    All the better if vfp heads check it out to find areas not well supported - our vfp environment has many more HP, but this here is meant to help those not used to bright side of vfp capabilities to expierience them on their own machines.
    I already found that I need publics directly in command window - also that one of the special concepts like Datasessions should be better shown, as set window is not available. On the bright side: Already included is the "ArrayBrowser" - as no debugger runs, it gives the option to "watch" vfp arrays as a cursor.
    On 2)
    Attached was only the exe and some dummy prg and example table of vfp functions. Before going to Github, I'd like to estimate interest first - Zip of Sources can be mailed or attached at other post. If there is no interest at all, why put it up on Git ? Ed's version was targeted to be included in apps - why create a newer version better adapted only to run as standalone, if not even here there is interest ?

    Must be true to my Git alias "lazy-fox" ;-)
    thomas

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 19:44 #19171

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • FoxProMatt wrote:

    Interesting.... I could be missing something but it asks for a password that I do not know. Scanning through the files in the zip I do not see a password field or clue. I also don't see a PJX/PJT file so think at least some of the source is missing. -Jeff
    Any advice for this issue??

    As Robert already answered - but perhaps still a chance to mislead or misguide from my side, let me add that Len(pwd)=2... It is not meant as a real deterrent (which was needed if embedded).
    Edit: If Jeff is not in this forum, he must have DL Ed's version. Tell him to search for the .H file to find the pwd, which is a bit longer than the stuff I put up....

    Currently up no sources, only compiled exe - if Jeff wants the sources, I'll post here or send zip via mail. Git if the VO devs NOT having access to vfp dev system find useful and it gets some traction, see other post.

    At least now I can offer "my" implementations of vfp functions in X# to check in X# and vfp now for everybody interested on the machines they are used to or need to run on - might help in other areas as well.

    regards
    thomas

    Please Log in or Create an account to join the conversation.

    Last edit: by mainhatten.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 27 Jul 2021 20:54 #19172

    • FoxProMatt
    • FoxProMatt's Avatar



    mainhatten - I sent Jeff a link to this message on X# board post , so if it's a public board, I assume he was able to download from here, even if he doesn't have a login.

    I'll pass along the x# X# password to him.

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 09:45 #19176

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Thomas,

    thanks for the upload. Now i´m able to run Foxpro 2.0 code with VFP :-)

    Here´s what i´ve found so far:

    - it seems that the "?" output is not redirected to the main screen. I noticed that you are using in your samlpes "wait window" to show results.
    FUNCTION wwp(tcMess)
    tcMess = EVL(m.tcMess, "Keine Message mitgegeben")
    
    && WAIT WINDOW m.tcMess
    
    ? m.tcMess  && the output doesn´t become visible ?
    
    RETURN

    - when i open or create a prg file via the "modify command" i can edit and save the code via the "File" menu. Somewhat annoying is that an opened editor is always closed as soon as I click on another area than the menu.

    - It seems that the menu item states are not always updated. e.g. it´s not possible to compile a prg via the menu item "compile" because the item is always disabled. But that´s no show stopper, because there´s no problem to compile sources inside the command window via the "compile" command.

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 14:20 #19180

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Karl-Heinz wrote: Hi Thomas,
    thanks for the upload. Now i´m able to run Foxpro 2.0 code with VFP :-)

    Yupp, thats what I hoped ;-)

    Here´s what i´ve found so far:
    - it seems that the "?" output is not redirected to the main screen. I noticed that you are using in your samlpes "wait window" to show results.


    Weird - should work, as I thought I had fixed it ... see attached jpg, started session under list memory, results of "?" with correct info in white in green screen (coloring left as was in original source code).
    Will check uploaded version...

    - when i open or create a prg file via the "modify command" i can edit and save the code via the "File" menu. Somewhat annoying is that an opened editor is always closed as soon as I click on another area than the menu.

    True. But IMO "Icing on the cake", take ANY editor, edit away, save, compile & run in command window.
    Perhaps I'll stumble over something if adding/fixing more pressing errors, of course then I'll correct, but till then,
    fire up FP2, set default to the directory vRunfox points to and you are in separate process...

    - It seems that the menu item states are not always updated. e.g. it´s not possible to compile a prg via the menu item "compile" because the item is always disabled. But that´s no show stopper, because there´s no problem to compile sources inside the command window via the "compile" command.


    I confess, I am not always a "Mausschubser"...

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 15:15 #19185

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Karl-Heinz wrote: - it seems that the "?" output is not redirected to the main screen. I noticed that you are using in your samlpes "wait window" to show results.

    Downloaded my stuff again, unzipped and ran - works as expected.
    _Screen.BackColor is 8421376
    _Screen.ForeColor is 16777215
    If I set _Screen.ForeColor = RGB(0,0,0)
    _Screen.ForeColor is then 0 as expected (Black on green)

    You can also play with the settings in the .cfg file, those are used at startup so your last setting should be persisted. Or you could run following code either as prg or in command window
    _Screen.ForeColor = RGB(0,0,0)
    ? _Screen.ForeColor, "Black as _Screen.ForeColor"
    _Screen.BackColor = RGB(255,255,255)
    ? _Screen.BackColor, "White as _Screen.BackColor"
    ? _Screen.ForeColor, "Black _Screen.ForeColor"
    _Screen.ForeColor = RGB(255,0,0)
    ? _Screen.ForeColor, "Red as _Screen.ForeColor"
    _Screen.ForeColor = RGB(0,255,0)
    ? _Screen.ForeColor, "Green as _Screen.ForeColor"
    _Screen.ForeColor = RGB(0,0,255)
    ? _Screen.ForeColor, "Blue as _Screen.ForeColor"
    _Screen.ForeColor = RGB(0,0,0)
    ? _Screen.ForeColor, "Black as _Screen.ForeColor"

    HTH
    thomas .

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 15:16 #19186

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Thomas,

    About the Texteditor "auto close" behaviour: Nope, that´s not acceptable ;-) My FP never closes the editor when i jump to e.g. the command window.

    About the "?" behaviour: There´s no problem with the "?" output when i try something like "? Date()" inside the command window. i correctly see the current date in the main window. The problem is the "?" usage inside a called proc/func. Just compile this prg and run it with "Do Test2" . Do you see anywhere the expected output "Hello from '?'" ?

    Test2.prg
    PROCEDURE Test2
    
    ? "Hello from '?'"
    
    && WAIT WINDOW "Hello from 'WAIT WINDOW'" 
    
    RETURN

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 18:46 #19188

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Hi Karl-Heinz,

    Karl-Heinz wrote: About the Texteditor "auto close" behaviour: Nope, that´s not acceptable ;-) My FP never closes the editor when i jump to e.g. the command window.


    The "auto close" can be avoided by adding NoWait to the command line just like with a Browse.

    About the "?" behaviour: There´s no problem with the "?" output when i try something like "? Date()" inside the command window. i correctly see the current date in the main window. The problem is the "?" usage inside a called proc/func. Just compile this prg and run it with "Do Test2" . Do you see anywhere the expected output "Hello from '?'" ?

    Nope, is not visible. ? I will have to look at in more detail, as
    Set console on
    seems not to fix it, perhaps I need to define and activate specific window or someting similar. Until then: can you use _screen.print(cString) ? Not as easy as ?, but when piping info into text file, you need strings in any case, so via a logging module single items should be possible. And yes, controlling position via
    _screen.print(chr(13)), _screen.print(chr(10))
    is also PITA compared to ? / ?? ease.
    FUNCTION Qmark(tcMess)
    tcMess = EVL(m.tcMess, "Keine Message mitgegeben")
    WAIT WINDOW m.tcMess + chr(13) + "before"
    _screen.LockScreen = .f.
    _screen.Activate
    WAIT window _screen.ActiveForm.Name
    *_screen.Cls
    _screen.Enabled = .T.
    *_screen.Paint()
    _screen.Print(CHR(10))
    
    _screen.Print(m.tcMess + "in PRINTSTATUS()")
    _screen.Print(m.tcMess + "in PRINTSTATUS() again")
    _screen.Print(CHR(13))
    _screen.Print(CHR(10))
    _screen.Print(m.tcMess + "in PRINTSTATUS() 3")
    _screen.Print(m.tcMess + "in PRINTSTATUS() 4")
    
    SET CONSOLE ON
    ? m.tcMess
    WAIT WINDOW m.tcMess + chr(13) + "after"
    RETURN
    upd:
    at least several parameters could be handled via for xx loop 1 To PCount()
    adding transformed(eval("pararmN"+str(xx))) value of to string fed to _screen.Print()
    //upd

    regards
    thomas

    Please Log in or Create an account to join the conversation.

    Last edit: by mainhatten.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 19:57 #19189

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Thomas,

    yes, adding "NOWAIT" keeps the editor window open. Thanks !

    To see the '?' output i´ll use for the moment this skeleton:

    PROCEDURE Arrtest1
    
    =set ( "safety" , .f. )
    
    set alternate to output.txt
    set alternate on
    
    
    
    
    ? "one" , 12 
    ? "two"
    ? Date() , Time()
    ?
    ? .f. , .t.
    
    && etc...
    
    
    
    
    
    close alternate
    set alternate to 
    
    modi comm output.txt
    
    Return
    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 20:51 #19192

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Hi Karl-Heinz,

    Karl-Heinz wrote: To see the '?' output i´ll use for the moment this skeleton:

    PROCEDURE Arrtest1
    =set ( "safety" , .f. )
    set alternate to output.txt
    set alternate on
    ? "one" , 12 
    ? "two"
    ? Date() , Time()
    ?
    ? .f. , .t.
    close alternate
    set alternate to 
    
    modi comm output.txt
    Return

    One way to skin that Fox. Another for screenupdates earlier:
    FUNCTION QL_Ln ( p01, p02, p03, p04,p05 ;
    		,p06, p07, p08, p09,p10 ;
    		,p11, p12, p13, p14,p15 ;
    		,p16, p17, p18, p19,p20 ;
    		,p21, p22, p23, p24,p25 )
    *-- read QuestionmarkList_writeLN
    LOCAL lnRun, lcPr, lcAdd
    lcAdd = ",   "
    lcPr = ""
    FOR lnRun = 1 TO PCOUNT()
    	lcPr = m.lcPr + TRANSFORM(EVALUATE("m.p";
    			+PADL(ALLTRIM(STR(m.lnRun)),2,"0")))  ;
    			+ m.lcAdd 
    next
    IF PCOUNT()>0
    	lcPr = Left(m.lcPr, LEN(m.lcPr)-LEN(m.lcAdd))
    ENDIF
    _screen.Print(CHR(13)+CHR(10)+m.lcPr)
    regards
    thomas

    Please Log in or Create an account to join the conversation.

    Last edit: by mainhatten.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 28 Jul 2021 21:46 #19195

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Hi Karl-Heinz

    Karl-Heinz wrote: To see the '?' output ....

    Duuuhhh
    ACTIVATE SCREEN

    I knew it was one of the old forgotten thingies...
    Will stop for now after a generous Facepalm...

    best regards
    thomas

    Please Log in or Create an account to join the conversation.

    Last edit: by mainhatten.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 29 Jul 2021 16:16 #19203

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Thomas,

    i entered 'Activate screen' in the command window, but the '?' output is still not visible. Anyway, for the moment 'Set Alternate' does what i need.

    btw. There´s a FoxConsole.ini, but it seems the values are ignored ? i ve tried these settings but they have no effect.

    CompileOnSave=.T.
    SaveCmdText=.F.

    the names suggest that:

    - The source code is automatically compiled -> but it doesn ´t happen.
    - The values entered in the command window are not added to the vRunFoxCmd.txt -> but they are still added.


    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 29 Jul 2021 17:41 #19205

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Thomas,

    another FoxConsole.ini sample

    i wanted to change/add some settings from

    [FoxSettings]
    Settings=EXCLUSIVE OFF;DATE TO BRITISH;MULTILOCKS ON;DELETED OFF

    to

    [FoxSettings]
    Settings=EXCLUSIVE OFF;DATE TO GERMAN;MULTILOCKS ON;DELETED OFF;SAFETY OFF

    but that has no affect. To activate both settings i must enter both settings in the command window

    SET DATE GERMAN
    SET SAFETY OFF

    it seems the content of the ini is never used ?

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts 29 Jul 2021 22:21 #19206

    • mainhatten
    • mainhatten's Avatar
    • Topic Author


  • Posts: 199
  • Hi Karl-Heinz,

    Karl-Heinz wrote: i entered 'Activate screen' in the command window, but the '?' output is still not visible. Anyway, for the moment 'Set Alternate' does what i need.

    Yupp, "Activate Window Screen" alone is not enough... Yesterday I was debugging and ? went once to screen - which resulted in me kicking off the post, but checking no further. Came home today, tried a few variations and am now even more puzzled - currently ? output sometimes gets output, BUT OFTEN NOT to screen/form I expect from reading code and props - I must be getting old or debugger throws off internal timing and I need to sprinkle DoEvents inside....

    Sigh - the original code was meant to be run inside other app sometimes puzzles, as some of the scetions might make sense in such surroundings. Slooow work, but as _screen.Print, my function with many parameters AND set alternate work (even if not as comfortable as used), I will get there.
    First I will try to reactivate the classlib I deleted due to it referring a totally missing other classlib - perhaps this clears some things up. Vcx hacking again...

    btw. There´s a FoxConsole.ini, but it seems the values are ignored ? i ve tried these settings but they have no effect.
    CompileOnSave=.T.
    SaveCmdText=.F.
    the names suggest that:
    - The source code is automatically compiled -> but it doesn ´t happen.
    - The values entered in the command window are not added to the vRunFoxCmd.txt -> but they are still added.

    This might stem from elsewhere and not be related to the FoxRun.Exe, as this has that .cfg file. Will step through load and watch if/when this is accessed or written

    Keep them coming - I'll work more on it later, but have other pressing stuff. Hope you are enjoying vfp9!

    regards
    thomas

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1