PDA

View Full Version : Help with a script



Pete Simmons
03-17-2005, 5:37 PM
http://woodpenman.com/images/tees2.cdr



The linked file is a Corel jig I use to engrave golf tees. Could you help me with a script to automate filling in the names and logo after the first tee ( in upper left) is edited. The tees are spaced 1 inch x 3 inches. To get fancy how about being able to input do 1,2,3,4,5 or 6 dozen tees?

Thanks in advance for the help. I am sure once I learn how a simple script like this is set up and run I can edit it and go on from there.

Laura Zaruba
03-18-2005, 10:38 AM
Hi Pete.

I don't know much about using scripts but I thought I'd take a look and see if I could come up with something but I couldn't open the file? (I'm using Corel 11.)

Thanks,

Laura DeMeyer
Etched in Time Engraving
http://www.etchedintimeengraving.com

James Stanaway
03-18-2005, 12:42 PM
Hi Pete,

I'm not sure if this is what you're looking for exactly, but see if it will work for you. Download the file www.epiloglaser.com/tees_test.cdr (http://www.epiloglaser.com/tees_test.cdr).

When you have your first tee set up, go to 'Tools', 'Visual Basic', 'Play'. One of the options should be 'RecordedMacros.Duplicate_Tees'. Choose Run to start the macro.

You will be asked how many columns you want created and how many rows to create. Enter the numbers and the first tee will duplicate for that number of columns and rows. If you want to create 24 tees, just choose 6 columns and 4 rows. If you want 48 tees, choose 6 columns and 8 rows.

Good luck, and I hope this helps!

James Stanaway
Marketing
Epilog Laser
jstan@epiloglaser.com

Pete Simmons
03-18-2005, 7:53 PM
Your VBA Macro is right on. Works fine. Thanks.

Now some questions.

I have been studying script use. I use Corel 12 and cannot find Script Editor. I found script manager but I do not see a way to write or edit scripts. From what info I have found it looks like the script editor was used with Corel 9 and after that it seems Corel headed toward VBA.

Am I looking for something ( script editor) that is not there anymore?

Your VBA macro runs fine as listed but is the VBA player the only way to run it?

Can I use that code directly as a script and put it in the script manager?

Is this file tied forever to the tees_test file or can I seperate it, modify it and use it on other similar templates?

Can I store it in a script folder as a (.csc or .bas? ) file and run it from the script manager when other template files are open?

Jerry Allen
03-19-2005, 1:34 PM
Pete,
I think they dropped the scripting editor in lieu of VBA.
It just still allows scripts to be run.
Perhaps you can use an older version for script editing.
The VBA editor is more stuctured.

Jerry Allen
03-19-2005, 1:53 PM
In case anyone is interested in Print Merge in Corel12,
I use the attached templates for editing text using print merge.

I edit the text in Word and Excel depending on the file type and need to automate numbers, etc. See notes.
I recommend using the tab format, but see notes below. The Corel slash format is okay but is not as easy to edit as tab delimited.

Notes:
1) Corel uses a goofy single slash and double slash delimiter when you use its Print Merge save routine. You can view and edit it in Word but not Excel.
2) Tab delim: Excel is cool for incrementing entries. Word is good at cut and paste.
3) When saving tab delimed in Word or Excel, a bug in Corel causes an error in the first field name which looks like a tab. When you import the edited file in Corel Print Merge, select the file, on the next page select the first item TWICE, click Rename at the right and delete the box character in front of the first field name. If you don't all data entries will shift.
4) Watch out for Word changing case in the field names. They are case sensitive and the Draw file will not import if the case is different.
5) Search and replace in Word will allow you to convert a Corel "slash" Print Merge file to tab delimited. You will have to carefully enter double and single slashes separately, first to change double slashes to tabs and then to shnge single slashes to null.
6) When using print merge the first checked record is the one used (if there is more than one). Make sure to uncheck the ones you don't want.
Use the attached files as templates--copy and save them to a new name so you don't screw up the original settings.
7) text files are all Unicode--double byte for foreing language--usual;ly that will not matter to you but you may get asked.
8) Study the file formats

(sorry about the zip file--I tried to attach the two data files as text (.txt) but couldn't get it to work?!)

Roy Brewer
03-20-2005, 11:05 PM
Pete,

Possibly the best recommendation I can offer is to purchase the 10lb/$50 CorelDRAW 12: The Official Guide which has a great introductory chapter on Corel's macro language(VBA). Having done a bit of BASIC programming, I was ecstatic when Corel Corp dropped the bombshell that they were switching from their script language to VBA. This means that if you learn a bit about VBA you can program most of the MSOffice products as well as automate CorelDRAW to do *anything* you want. BTW, AutoCAD also uses the same VBA macro language.

Having said all that, most should not be messing with this; it will take scores of hours before you'll be able to do anything significant (unless you have a programming background).

Nevertheless, I'll answer the remaining questions and throw in a few necessary pieces of information.

With the Epilog supplied .CDR file open,
Tools>Visual Basic...>Visual Basic Editor...

.GMS is the file extension for Corel macros. Caution, each version of Corel VBA has slight differences in the way global macros are handled. My references will be for Corel 12.

.CSC? As Jerry said, CorelSCRIPT .CSC files are still supported but no longer created from within Corel products.

.BAS? Yes. One of the ways you can modify Epilog's "macro" is to File>Export to File... This then can be imported into your new document. Or, if you want this to be always available, it is best placed in the GLOBALMACROS.GMS which is found in the main \DRAW folder. Or, you can create your own standalone file; stand alone files must(?) go in the \DRAW\GMS folder to be "seen" by DRAW or the VBA editor.

Only way to run? Numerous ways to run, but the most elegant is to create an icon and put it on a toolbar so that a single click will call the code.

I almost wish I had not started on this! There is no place to stop. So, I'll stop with this. Anyone not intimidated by "scores of hours to do something significant," should start by recording macros and seeing what the macro recorder writes by opening the macro in the VBA editor.

Obviously, Aaron and a few others are more knowledgeable than I on this issue and I'm sure they'll correct any prejudices/misinformation I've put "on the table."

Roy Brewer
03-20-2005, 11:40 PM
In case anyone is interested in Print Merge in Corel12,
I use the attached templates for editing text using print merge.
Jerry,

I suspect you might just be introducing Print Merge to our community. But in case you are really using it like this, you are working too hard. I've attached(?) a file that has just one of the 100 boxes in your template. Using the Imposition Layout Tool with 10x10 in upper left corner automatically loads upon Perform Print Merge.

If anyone is interested, I have a DOC file on Print Merge with the key being creating the appropriate Imposition Layouts.

Print Merge will also increment fields alongside bringing in other variables.

Other than illustrating how to create/use macros, there is really no sense in the macro that James supplied if you understand how to make just one "Tee" and then use the Imposition Tool to across/down. This uses less resources, prints faster, stores more efficently and requires less keystrokes even if an icon is used. Numerous other advantages for laser engraving.

Jerry Allen
03-23-2005, 1:58 PM
Roy,
I couldn't post for a couple of days, but wanted to get back to you on the Imposition Layout subject. I downloaded your file but don't have the foggiest what to do with it. I searched Help and came up empty. Please post or email the doc with the info.
All I can figure from what I see is that you create a bunch of pages and then print them as thumbnails or something like that. If so, that would make designing a jig template a little difficult.

I agree that Print Merge is a pain, but have been fairly successful using Excel and Word to edit and generate numbers, etc. Once the .cdr and text file are set up it's pretty easy. If Corel just made the merge field insertion tool increment automatically to the next field that would be a major improvement. Or better yet, allow selection of text to convert to a data field.