Following pseudo code seems ideal, but the object is to send printmerge data to laser engraver w/o operator understanding (or having the chance to screw up) CorelDRAW, file format, etc.
1. Operator selects template from a list of ~10.2. Operator scans barcode which is the name of a datafile (probably, CSV w/.txt extension)3. macro, behind the scenes, uses printmerge functionality to Merge to New Document
Optionally:4. Allows user to select from a list of 8-10 Imposition Layouts5. Sends to a print driver.
If no "takers," Any/All of that "doable" with VBA? I don't see any way to record or access Print Merge functions(?).
Roy Brewer
OK. I would like to se your files and your simplist, most confortabile way of working scenario.
I suppose that your .CLY files are custom imposition layouts. Is that correct?
I also suppose that your scanner will scan in a excel file. Is that true? Or in a txt file? Do you use such a scanner or you will use one recommended for the provided solution/proposition?
FaneDuru,
I'll have those file ready to share within a few days. Yes, the .CLY files are Imposition layouts that we use. Note all Imposition layouts move the work to U/L corner of "printer" and will have several combinations of across/down to fill up the "printer page."
More details with the sample files being prepared, but following are the basics of what I need.
What we'd like is to scan in the path to a .TXT file (.CSV or TAB delimited) with any, inexpensive bar code reader. Macro would open and process the data in the file and user would click OK to send to laser engraving system. Their may be data for up to several hundred tags or as few as one. The beauty using the Imposition layouts, is that as many Signatures (Corel's term for multiple "pages" sent to printer) as needed.
In order to avoid any adjustments of the program/macro in discussion the best idea looks to be the possibility of programmatically select your imposition layout. But this looks to be the most difficult part. Corel VBA does not have anything built for simple accessing of that setting in the Printing Properties. I thought it is possible using API calls and identifying the controls, sending clicks and so on but it looks not possible/easy because of the fact that when you launch the Print Form all VBA is paused. And any handler of the form cannot be returned...
It is possible (even easier) to arrange on a Corel page the exactly whished layout (similar with imposition layout), but this involves to have a specific macro for each of your cases... Since you need that kind of automation I suppose they are a lot.
But, please show us the file able to close your actual scenario and describe as well as possible what you need. To parse a txt file, select each row and identify its components according to separator and a rule it's not complicate. To access the path and open them in Corel, even easier, to programmatically execute PrintMerge it is not a problem, too. But you have previously analize which is the maximum characters number which does not bother the space which must keep the text. And one or more rules to apply in case of exceeding (adjusting the length of the text, proportionally or not, a smaller font, something to make it looking nice)...
Re. impositions layout - maybe define print style for each imposition and then load & use print style (with its defined imposition layout)
If you do a manual work with Corel, you most likely place your shapes with the mouse to a location or grid line. Then you have a hand full pages and print them in this 'Imposition layout' to distribute them over a sheet. Here this makes sense.If you do something in VBA, you have to place your shapes to somewhere, you need to define for example the centre of a circle or the lower left point of a text. So you need to place your shapes to somewhere. So: Is there a big issue to say x=12 + DeltaX instead of simply x=12. And you have calculated DeltaX with the position of the 'label' and the left border, length and distance between the labels.Some similar situations I did that way:I placed my shapes at the position they finally shall have on the label (so I do not need to calculate to much), put the shapes in a shape range and placed the centre of the shape range to the centre of the label. So it's easy to build up the shapes and also easy to place them.If you have to use the same 'Imposition layout' often, you can do the following trick: Create a function where you submit an ID and a position. Within this function you have to define for each ID the distance from the border, the dimension of the label and the gap between the labels. You need those information for X and Y. Then you need to limit the number of shapes either with a count or the maximum dimension of the output media. Maybe you also need an ID to indicate, if the next shape shall be placed below or right of the previous. With this information you can create a shape which is the result of the function. If you place this function in a global toolbox, you can access it from different projects, create there your shape range, call this function with the ID for the template and the position of your label align your shape range to any corner or centre of created shape and delete it afterwards.So you can build up your own library with often used 'Imposition layouts' and access them easily.If needed: It's also possible to create a function like this:Function MkImpoLayShp(ByVal pLayout as Integer, ByVal pPos as Integer, ByRef iModi as Integer) As ShapeThen you can say within this function, that maybe the 5th label for layout 2 shall be mirrored. If you call the function that way:Set TmpShp= MkImpoLayShp(2,5,n1)If n1=1 then MySR.Flip cdrFlipHorizontalMySr.CenterX=TmpShp.CenterXMySr.CenterY=TmpShp.CenterYTmpShp.DeleteThere are many ways more to deal with this problem, most likely this is not the most useful for you, but maybe it helps you to start thinking about different ways to realize this 'Imposition layout' with VBA. It would be great, if it brings you on the right way to find a better suitable way for your needs.If you need someone to show you how to solve certain issues in VBA, contact me, maybe I can help you.