Jump to content
Macro Express Forums

Writing/appending To A Data File


Recommended Posts

Overview: My fax server saves incoming faxes as TIFF's, OmniPage auto-detects each, OCR's it and saves a PDF version in an incoming fax folder. Then the user either (a) sends a junk fax file to a Junk folder, or (B) opens the folder in Adobe and saves it to one of many case folders.


I need to keep a data file audit trail of TIFF & PDF files as they are processed, so that I can know exactly what happened with each incoming fax. I believe that these four fields would be sufficient:


1. Path&FileNameOfOriginalPDF

2. DateTimeReceived

3. Path&FileNameOfSavedPDF

4. DateTimeSaved


Since, the PDF's are sequentially numbered (i.e., 01001.pdf, 01002.pdf, etc.), I figured that I'd set up a data file with those fields, initally populating it with a few thousand records where field 1 in each would have the FileName of the anticipated PDF files. I think I need two macros:


1. The first macro would monitor the folder, alert the user when OmniPage creates a new PDF file and enter its create date/time into the DateTimeReceived field.


2. The first macro would also open ExplorerPlus, prompt the user to click on the new file and look at it with the built-in viewer [i sure wish Mx could do that], and ask the user if Mx should move the file to a "junk" folder (i.e., fax spam) or open it in Adobe. If moved to a junk folder, that macro would also complete the last two fields.


3. If opened and then saved Adobe, a trigger would start a second macro which would enter the Path&FileNameOfSavedPDF into Field 3 and the DateTimeSaved into fields 3 and 4.


I think I may be able to write a macro to monitor the incoming fax folder for the appearance of #####.pdf, where #####.pdf is the name of the first file record in the data file for which there is yet no corresponding DateTimeReceived value in field 2.


'Problem is that I can't figure out how to write the values for fields 2, 3 and 4 to the correct record in an ASCII data file. I do remember studying BASIC many, many years ago (by torchlight), and that there was a command to open a data file and add values to specified fields.


Can you tell me how to add this data to the audit data file?


Thanks so much.



Link to comment
Share on other sites



prompt the user to click on the new file and look at it with the built-in viewer [i sure wish Mx could do that],
Would not just promping for "file select file" from "Set variable" be OK?

Then you could right click to"view" ; ie "open briefly" with Adobe or iE Explorer, and exit to select or not?

Best, Randall

Link to comment
Share on other sites

Thank you so much, Randall! I just saw your reply and I'm studying it now, along with some of your amazing postings.


You mention Excel. We use WordPefect and the QuattroPro Spreadsheet program. Do you think the Excel programs you laid out will work with QuattroPro also?


Thank you again!



Link to comment
Share on other sites

hi again;

Woops - I don't think so; I doubt you could "object create" as you can in Office to do the "Com" thing; which my program relies on;

sorry! (unless you find it is posible; a quick web search found nothing)

I'm sure it is possible with AscII, just not familiar.

Best, randall

Link to comment
Share on other sites

I have a large macro I developed for a client that does a very similar thing but actually is part of a much larger picture. Faxes are received via WinFax which is set to print to a cheapo PDF print driver called 5D. At the moment a user periodically runs a "File disposer" macro that is designed primarily to update meta data in the PDF from user input which is read in by the user. IOW they look to see what the person’s name, company, SSN and other sort of info. This is then used to update the metadata in the PDF and create all the necessary folder structure and file away. This macro is used to dispose of all PDF’s be it from fax, scan, or generated from application so it’s a bit of a do-all. I reiterate, this is an on-demand kind of thing. I also have scanning macros to supplement this. These folks have two large Kyocera copy centers that generate PDF output. I have macros that force the user to jump thru a series of hoops so that everything is uniformly scanned and filed properly. The bit you would be interested in is my file monitoring. It starts by assuming the directory is empty. I use the “Wait for file exist” using “*.pdf” followed by a “Wait for file ready” (important) and then do my thing. It also is set up so that when it looks in the folder it takes the first PDF file and subsequently open the next. So in case two files arrive at nearly the same time or if there are several already in the folder it doesn’t mind. If you’re interested I could share this routine with you. In general I think I have already done everything you have but in a little different order.


For logging I would suggest writing log files to a file. This is very simple to do. Then make it so that one file is generated per month or something so they don’t get too big. Check out my date generator for that. I’ll be posting a link in the third party forum in just a few minutes. In this case WinFax and or 5D could do the logging but I would use the file creation date if I were you. All phases could report to this file satisfying your audit trail.


BTW I tried the monitoring for the next file name in a series thing and it failed. Problem was that if two arrive at nearly the same time it gets out of sync. Also if the macro is started and stopped the user has to do something to give it a start point again. This is why I developed the routine I mentioned above.


I also have a cool email notification section for newly arrived and filed faxes if you’re interested. Works slick.


As for you main problem of writing to a certain line I would simply create a log file entry for each event. Then you could use Excel, Access or even a simple filtering routine in ME to filter the results. Much simpler. But if you want to add lines I would make a CSV or TSV file and, say, make my entry in the first field as some sort of key like file name. Then if you need ot add to that row use the ASCII file process command with repeat to scan thru the entire file to search for that string in the first field. Grab that info and write at and the new info to a new CSV file. But seriously, it would be a lot simpler to have just one line per event and filter.


If you would like any help on this project let me know. But I got a lot on in this thing so it might even be better to have a phone conversation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...