BinaryBrother Posted February 16, 2011 Share Posted February 16, 2011 (edited) Ok... So I've opened a Business and I hate QuickBooks... (This thread isn't about alternatives either... )I've already created most of the input interfaces using Koda and began utilizing SQL + INI databasing. It works beautifully, I've even checked what the performance looks like after the generation of 10,000 customers with random information etc, and it looks great. So this will suffice for plenty of time to come... Now to my real question... What would be the best way to utilize a dynamic template for simple things like invoices, etc?I don't really want to print off raw text documents for invoices etc, I'm trying to accomplish something professional and nice. I did take a look at the "PDF UDF" on the forums, but it looks waaaaay more complicated then what I'm looking for... Any and all ideas or suggestions are much appreciated, in the direction of a good method to print professional and good looking company documents via AutoIt. Edited February 16, 2011 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
ChrisL Posted February 16, 2011 Share Posted February 16, 2011 How about creating templates in Word and then using the Word com object to populate the documents? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 16, 2011 Share Posted February 16, 2011 How about creating templates in Word and then using the Word com object to populate the documents?I agree, If you want to have something non-text looking page, then you should use word or wirte your own HTML document.The plain html file could be printed via internet explorer and then it looks like you see it in your browser.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
jchd Posted February 16, 2011 Share Posted February 16, 2011 began utilizing SQL + INI databasing.Sorry for off topic remark, I've a pretty good idea about SQL (and SQLite particularly) but what do you call INI databasing? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
hannes08 Posted February 16, 2011 Share Posted February 16, 2011 Hey BinaryBorther,maybe you want to take a look at the UDF from martin. This seems like a ggo way to start.Regards,Hannes Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
saywell Posted February 16, 2011 Share Posted February 16, 2011 This is a bit of code I use to populate a word doc. It waits for the user to close it [having printed it] and then deletes it. Elsewhere in my App I have a similar function which uses Melba23's ExtMsgBox udf - I make a coloured box sit on top of the top right of the word window after the search/replace actions are complete, while the user types in text. When done, user clicks OK in box, and word doc text is extracted, added to an html record, and saved to a specified location. For invoices, the first option may be all that's required. $oWordApp = _WordCreate("") ;Local $oOpenTemplate = _WordDocOpen($oWordApp, @ScriptDir & "\" & $Template) Local $oOpenTemplate = _WordDocAdd ($oWordApp,0,$Template) $oDoc = _WordDocGetCollection($oWordApp, 0) _WordDocSaveAs($oOpenTemplate, @ScriptDir & "\Temporary.rtf") WinClose("Document1") ;ClipPut ($sContent) WinActivate ("Temporary.rtf") ;WinActivate(@ScriptDir & "\Temp.rtf");------------>>>>>> focus to doc ;MsgBox(0, "Ref", $Ref) $oFind = _WordDocFindReplace($oOpenTemplate, "REF", $Ref, 1, 0, 1, 1) $oFind = _WordDocFindReplace($oOpenTemplate, "DD Mon YYYY", @MDAY & " " & @MON & " " & @YEAR, 1, 0, 1, 1) $oFind = _WordDocFindReplace($oOpenTemplate, "HHHH", $Header & " - " & $EventDate, 1, 0, 1, 1) $oFind = _WordDocFindReplace($oOpenTemplate, "BodyText", "");$sContent, 1, 0, 1, 1) WinActivate ("Temporary.rtf") WinSetState ("Temporary.rtf", "", @SW_SHOW) Send ("^{END}") ; cursor to end of text Send ($sContent) Send("^{HOME}") ; cursor to start of text MouseClick("left") ; ready to add lines for correct position [by eyeball but perhaps by measurement later?] WinWaitClose("Temporary.rtf") ; wait for user to finish _WordQuit($oWordApp) ;Exit word FileDelete(@ScriptDir & "\Temporary.rtf") ; delete temp file FileDelete(@ScriptDir & "\Document1") ; delete blank file William Link to comment Share on other sites More sharing options...
BinaryBrother Posted February 18, 2011 Author Share Posted February 18, 2011 How about creating templates in Word and then using the Word com object to populate the documents? I couldn't get regular MS Word to display the right way... But apparently a few of the comments below seem to prove I just don't know what I'm doing. Sorry for off topic remark, I've a pretty good idea about SQL (and SQLite particularly) but what do you call INI databasing? Just using a standard INI container that contains various information... Since I'm a complete SQL newb, the SQL is just used for mass storage of information. The INI handles everything else... Hey BinaryBorther, maybe you want to take a look at the UDF from martin. This seems like a ggo way to start. Regards, Hannes Yea, I had already taken a look at that. Looked a little overly complicated and I was hoping to find something a bit more newb friendly, but I'll give it another look. This is a bit of code I use to populate a word doc. It waits for the user to close it [having printed it] and then deletes it. Elsewhere in my App I have a similar function which uses Melba23's ExtMsgBox udf - I make a coloured box sit on top of the top right of the word window after the search/replace actions are complete, while the user types in text. When done, user clicks OK in box, and word doc text is extracted, added to an html record, and saved to a specified location. For invoices, the first option may be all that's required. William Thanks for the information! I'll deff give this a look. Thank you all for your input. As always, it is much appreciated. SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
jchd Posted February 18, 2011 Share Posted February 18, 2011 Using a DB for flat mass storage and .INI for classified information is (sorry to say) just plain wrong. SQLite and SQL gives you all freedom to store _everything_ you need to store in a reliable and organized way, access it very efficiently and guarantee ACID operations. I'm not lecturing you, just willing to help people gain the most benefits of what is readily available at only little development cost/hassle Think about it: you're processing an order, have decremented stock for some of the sold items, but experience a power outage or BSOD. In what shape are your .INI files now? Where do you restart from? Only solid SQL will help you there, thanks to DB integrity procedures and transactions. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
BinaryBrother Posted February 18, 2011 Author Share Posted February 18, 2011 As for integrity, keeping the INI container in DropBox prevents any major data-loss, including corrupt databases because you can go back for 30 days and recover anything. I do completely agree that it should all be SQL, but I don't have time to learn it ATM, we needed this software 3 months ago... The INI container, with sufficient data integrity checks and backups, will be plenty for now. SIGNATURE_0X800007D NOT FOUND 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