maloysius Posted January 10, 2020 Share Posted January 10, 2020 Hello AutoIt world, I am embarking on quite a complicated project. I work in POS systems and we sell a system that uses DBF files to store all of it's data. What I am trying to do is create an import tool that can append new items to the end of the file list. I am able to edit the files manually which works, and I know which files to edit. I have looked around and while there is plenty of code out there about reading and writing DBF files, but nothing I've found seems to allow you to just append to the end of the file without overwriting existing data. Perhaps I'm looking at it all wrong but I'm not sure. Does anyone have any ideas on where I could start with this? Thanks in advance!! Link to comment Share on other sites More sharing options...
Nine Posted January 10, 2020 Share Posted January 10, 2020 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted January 10, 2020 Share Posted January 10, 2020 What are you using to edit the files manually? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
maloysius Posted January 10, 2020 Author Share Posted January 10, 2020 @Nine, thank you very much, I will check it out! @Danp2, I am using FoxPro mainly, but have also recently discovered that Excel is able to open and edit them as well! Link to comment Share on other sites More sharing options...
RTFC Posted January 10, 2020 Share Posted January 10, 2020 You can do it all in AutoIt arrays with Xbase I/O, or you can: remove EOF marker in target dbf file append the new records with binary copy (needs to have the same fields structure) + new EOF marker (if not already present) edit the number of records counter in the header (see header struct definition in UDF) My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
maloysius Posted January 10, 2020 Author Share Posted January 10, 2020 @RTFC, thank you! I actually did download your UDF, but I couldn't figure out how to make it work, heh...i didn't realize that the files had EOF markers in them already...is this something that your script just knows about? I'm still pretty new to the whole DBF structure thing. Thanks for the advice!! Link to comment Share on other sites More sharing options...
Danp2 Posted January 10, 2020 Share Posted January 10, 2020 @maloysius I've worked with Foxpro for many years. Why not just stick with that since it is the best tool for the job IMO? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
maloysius Posted January 10, 2020 Author Share Posted January 10, 2020 @Danp2, I certainly agree that it's the best tool! I'm just trying to think of ways to automate parts of our process. The POS program that utilizes these files keeps information about menu items in 3 separate DBF files. While I could go through and manually add the items, it's a slow, painstaking process that I think could hugely benefit from automation. So if I could find a way to have an interface with those files through AutoIt, that would be awesome. I'm thinking of, for example, an Excel spreadsheet with all the item information in one place, and then AutoIt takes those columns of information and appends them to the ends of the appropriate files. I don't know if this might be a little too complicated for AutoIt. Link to comment Share on other sites More sharing options...
junkew Posted January 10, 2020 Share Posted January 10, 2020 Use adodb activex object with objcreate. ObjCreate("ADODB.Connection") search forum for examples maloysius 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
maloysius Posted January 10, 2020 Author Share Posted January 10, 2020 @junkew Will do, thanks for the info! Link to comment Share on other sites More sharing options...
Danp2 Posted January 10, 2020 Share Posted January 10, 2020 1 hour ago, maloysius said: I'm thinking of, for example, an Excel spreadsheet with all the item information in one place, and then AutoIt takes those columns of information and appends them to the ends of the appropriate files. I don't know if this might be a little too complicated for AutoIt. I believe it would be less complicated and potentially more reliable if you used Foxpro to automate this process instead of Autoit. If you stored the changes in a DBF table, then you could write a simple PRG to perform the update. If you insist on using Excel, this could still be done within Foxpro. FWIW, I've used this library to pull data from Excel into a cursor and then manipulated the data within Foxpro. maloysius 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted January 11, 2020 Share Posted January 11, 2020 objcreate("VisualFoxPro.Application") objcreate("VisualFoxPro.Application.9") With above you can probably create an object within AutoIt to control VFP. Although I feel thats a weird way of doing it. Don't know ,much about dbf files (last time I used them was more then 15 years ago) Just within foxpro you could use append from https://fox.wikis.com/wc.dll?Wiki~APPENDFROM maloysius 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
maloysius Posted January 23, 2020 Author Share Posted January 23, 2020 Thanks everyone for the advice! I will dig into it! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now