Re: FindFirstFile


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Grant Foraker on July 21, 2015 at 13:26:33:

In Reply to: FindFirstFile posted by Robert G Laurin on July 21, 2015 at 11:11:40:

One of my customers uses Paychex. From the Paychex website, they download a CSV to a server folder. The file name changes each time and there's a second worthless/pointless file that the download forces into the folder. Here's how I get the file and bring it into Comet.
==============================================================================

ImportPaychexTransactions:
INQUIRE (66,2666) KEY = 'PAYCHEX-1' ! Control file where I keep paths. This one is a UNC.
LET PAYFILE$ = STRIP(DATAPATH$) + '*.CSV'

LET FLAGS = 2
PRINT (FindFirstFile = PAYFILE$, FLAGS)
GOSUB GetResult
If (FileError > 32767) FileError = FileError - 65536

IF FuncError NE 1
LET MBMSG$ = 'The G/L data file from Paychex was not found. ' + STR(FuncError) + '/' + STR(FileError)
MSGBOX(MBMSG$)
LET RESULT$ = 'X'
GOTO ProgExit
ENDIF
IF FileError NE 0
LET MBMSG$ = 'The G/L data file from Paychex was not found.' + STR(FileError)
MSGBOX(MBMSG$)
LET RESULT$ = 'X'
GOTO ProgExit
ENDIF

Result$ = Sub(Result$, 45, 254)
Delim = Pos("@00@", Result$)
If (Delim NE 0) LET Result$ = Sub(Result$, 1, Delim-1)
LET RESULT$ = STRIP(RESULT$)

LET MBMSG$ = 'File ' + RESULT$ + ' found. Continue with Copy?'
LET MBCAP$ = ''
LET MBTYPE = MBOKCAN + MBQUES
MBRESULT = MSGBOX(MBMSG$,MBCAP$,MBTYPE)
IF MBRESULT EQ 2 ! USER CLICKED CANCEL
LET RESULT$ = 'X'
GOTO ProgExit
ENDIF
!------------------- COPY TO COMET ---------------------------------------------
LET PAYFILE$ = STRIP(DATAPATH$) + RESULT$
INQUIRE (66,2666) KEY = 'PAYCHEX-2'
LET FLAGS = 2048 ! OVERWRITE
PRINT (CopyFile = PAYFILE$, DATAPATH$, FLAGS)
GOSUB GetResult
==========================================================================================


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?  

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):





Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]