I would add one word of caution:
Beware deleting the file _immediately_ after your copy/print command!
(Actually that’s a line of caution – but never mind.)
_If_ the print fails for _any_ reason the chances are you’ve lost the file and
have to re-run the report (or whatever).
Regards,
Alastair.
From: Mike Byerley
Sent: Monday, November 07, 2011 10:59 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Copying a file to a printer from within a timer
You can use an external form which can run autonomously within the RBase
session. Use a Form timer. Use only this code in the Form Timer EEP:
SET Var vchkfile = (CHKFILE('c:\main\mike.txt'))
IF vchkfile = 1 THEN
COPY c:\main\mike.txt \\servername\printername
ERASE c:\main\mike.txt
ENDIF
put the initialization of the variable vChkFile in your onBefore Start EEP:
SET Var vchkfile INTEGER
Get in the habit of spelling VAR fully. RStyle won't correct it to VAR from
just V. I know it's a habit but there might come a time when it is
unacceptable and then you would have hoards of V's to find and fix.
The form Timer is a low cost gizmo that runs in its own thread (just the
same way windows scheduler runs).
Set the timer for however many milliseconds you want to check for the file.
----- Original Message -----
From: "Michael J. Sinclair" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, November 07, 2011 2:42 PM
Subject: [RBASE-L] - Copying a file to a printer from within a timer
Hi all,
I want to have Rbase check for the presence of a file within a folder, and
it if finds any file, I would like Rbase to send that file to the printer
and then erase the file from the folder.
Here is my code...
LABEL start
SET V vchkfile = (CHKFILE('c:\main\mike.txt'))
IF vchkfile = 1 THEN
COPY c:\main\mike.txt \\servername\printername
ERASE c:\main\mike.txt
ENDIF
GOTO start
RETURN
Here is my question...
Do I want to run the above file as a stand alone file, ie a continous loop
OR
would I be better off trying to use a TIMER EEP within a form?
I assume the form would be better because I should be able to "turn off the
code" by closing the form.
What I don't uderstand is where I need to put the EEP. Would it be a "On
Before Start EEP" or a TIMER EEP (what is the difference?)
Does it matter if I start the form with EDIT USING formname vs ENTER USING
formname?
Does the interval specify how often the EEP runs (ie I don't need the LABEL
start and GOTO start loop), or does the interval specify the time between
the moment the form is started and the time the EEP fires (in which case I
assume I would still need the LABEL start and GOTO start to make the code
keep checking the folder for files?
I am trying to quit using Rbase for DOS (even though I love it), this will
get me one step closer!
Any help would be great!
Mike