We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

This forum is meant for examples of X# code.

Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by Karl-Heinz »

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

Code: Select all

PROCEDURE Test2

? "Hello from '?'"

&& WAIT WINDOW "Hello from 'WAIT WINDOW'" 

RETURN

regards
Karl-Heinz
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by mainhatten »

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.

Code: Select all

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
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by Karl-Heinz »

Hi Thomas,

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

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

Code: Select all

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
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by mainhatten »

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

Code: Select all

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:

Code: Select all

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
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by mainhatten »

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

Code: Select all

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

best regards
thomas
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by Karl-Heinz »

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
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by Karl-Heinz »

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
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

We Will Fox You! - Command Window to Compile and Run simple vfp/foxpro scripts

Post by mainhatten »

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
Post Reply