Full Version: Macro to remove characters

From: Elm (MKLEIN) [#1]
 14 Aug 2006
To: ALL

This maybe a little far fetched, but is there a script for Corel 12 that will allow you to copy/paste text from an email or text editor and sort out certain characters.

Example...

I have a customer who emails us several orders everyday such as this...

Line1: text to be engraved on line #1
Line 2: text to be engraved on line #2
Line 3: text to be engraved on line #3
Line 4: text to be engraved on line #4

etc...

What I want is to automatically remove the 'Line 1', 'Line2', etc.
as I only want the information after the colon, basically remove the colon mark and any text or characters before it.

Thanks
Mike


From: Carl (CSEWELL) [#2]
 15 Aug 2006
To: Elm (MKLEIN) [#1] 15 Aug 2006

Mike;

Yes, that can be done in a CorelDraw macro. There are many VBA macros available for wildcard replacement of text and any of those probably could be ported to CorelDraw. This would be a good add-on to CorelDraw and I would be surprised if it is NOT in X3. Anybody know for sure? If I get a minute, I'll see if I can port a Search Replace with wildcards for CorelDraw.

In the mean time, do you have Microsoft Word? If so, cut-n-paste the text into Word. Go to Edit>Replace. Or Ctrl-H if you like shortcuts. On the Replace tab (which should be the current tab), click on the More box (bottom left of the pop-up window). Find the "Use Wildcards" checkbox and check it.

Go to the "Replace What" text box and enter (without quotes) "Line ?: ". You can add the number of spaces after the colon. Hopefully, they will be consistent. Don't put anything in the "Replace with" box. Click on Replace All. You'll have to also do it for the double-digit characters, as in: "Line ??: ". Or, if you are sure there are no other colons in the line, just use a "*" (asterisk) in place of the question marks, as in, "Line*: ". That should get them all very quickly.

Then cut-n-paste the text into CorelDraw.

HTH.

EDITED: 15 Aug 2006 by CSEWELL


From: Elm (MKLEIN) [#3]
 15 Aug 2006
To: Carl (CSEWELL) [#2] 15 Aug 2006

Carl,

I do appreciate your response. That method has been tried, using Word, and it does work, although it just adds another step into the process which takes time.

Right now, I am use copy/paste from the email info and put it into corel and then change it to artistic text to remove the paragraph format. I received that tip from Mike Null the other day which was well appreciated.

Although the copy/paste does not remove the 'Line 1:, Line 2:, etc...
at least I don't have to enter the text from scratch and worry if my spelling is correct. Spell checker is pretty much worthless when entering
personal names unless they are consistant.

Thanks
Mike


From: Mike (MIKEN) [#4]
 15 Aug 2006
To: Elm (MKLEIN) [#3] 15 Aug 2006

Mike:

Glad to see you joined up. You'll like this forum.

Carl is the guru on these macros and the macro that is most helpful to me is "import text". It is a real time saver.

From: Carl (CSEWELL) [#5]
 15 Aug 2006
To: Elm (MKLEIN) [#3] 15 Aug 2006

Mike;

Are you pasting the whole file into one text object? Do you then copy and paste each individual line to another text object within CorelDraw? In other words, are you importing a list of names from a file into CorelDraw and then copying them individually to a nametag layout?

From: Shaddy [#6]
 15 Aug 2006
To: Elm (MKLEIN) [#1] 15 Aug 2006

If you do have Word, paste into there first, make sure your margins are skinny enough so you don't have word wrap.

Then press the ALT key while using the mouse to click and drag from the upper left corner to the lower middle (where your sentance starts). Then delete it. Make sure your Show/Hide Paragraph Marks is enabled so you can see if you got all the characters.

For alignment reasons, make sure you have a font like Courier New, you can always change it later.

Then select the correctly remaining text and paste into Corel.

For a macro, if your email lines have the ":" for sure, and the line of text will never have a ":", you can use a VBA feature called "Split" to separate the line at the ":". Then you can strip off the ramaining spaces from the front of your line of text and , sounds like ignore the first part. Might be able to use that to process the info of the text that was copied to the clipboard before pasting it onto the page. I have too many irons in the fire right now, but I'm sure Carl will come up with something, sounds like his interest is perked. :-) 

Shaddy


From: Elm (MKLEIN) [#7]
 15 Aug 2006
To: Carl (CSEWELL) [#5] 15 Aug 2006

Carl,

Each order is emailed to me seperately, and all of them contain up to 4 lines of information to be engraved. What I do is select the text to be engraved, which also selects the 'Line 1:' stuff also, and paste that into my corel template I have. I then change the text to artistic and manually delete of the 'Line 1:' 'Line 2:' etc. from the imported text.

I am not trying to import several plates of information at one time. Each one of the plates on the template are different sizes and shapes so the imported text has to be sized accordingly, which works fine. This method is going to save a lot of time not only on my typing of the text but eliminate proofreading them. This particular job is engraving pre-cut metal anodized plates, of which there are 27 different shapes on my template.

Mike


From: Elm (MKLEIN) [#8]
 15 Aug 2006
To: Mike (MIKEN) [#4] 15 Aug 2006

Hey Mike,

Glad you turned my onto this forum. Looks like a group of friendly, helpful people here. I also appreciate the tip you gave me yesterday during our phone conversation in regards to the importing of text and changing it to artistic, that works Great!! Now just to get rid of the
extra text and characters.

I was going to try out that new vector table here in the next day or two
but after yesterday, I got bombarded with a couple of large name tag orders so my week is filled again...One of these days I'll get a chance to test it out.

Mike


From: Mike (MIKEN) [#9]
 15 Aug 2006
To: Elm (MKLEIN) [#8] 15 Aug 2006

Mike:

Glad to hear you're busy. I'll be happy to take on your overflow. Actually my July and August have been my best ever and I'm a good week out on work.

This forum is really good for our type business. I wish I'd know about it years ago. I just started a few months ago myself.

Carl and a guy named Shaddy who's also on the other forum know their way around these macros.

From: Carl (CSEWELL) [#10]
 16 Aug 2006
To: Elm (MKLEIN) [#1] 16 Aug 2006

Mike;

Please see the attached macro. It will trim the specfied number of characters from the beginning of each line of the selected Text Objects. Simply select the text objects that contain the lines that you want to trim, run the macro, and, if the default number is correct, click on "Go". The default is "8" but it can be changed when you run the macro. If the number you need is different than "8", let me know and I'll change the default value for you. Or, if you know VB, you can change it yourself.

If you don't know how to 'install' macros, please see message 4368.1

I thought that the macro might be generic enough to be useful for others so I coded it as a single, variable, function: trim a variable number of characters from the left of a text string.

I originally thought that a widcard find/replace macro could easily be ported to CorelDraw, but, apparently, the API calls for certain Microsoft dialogue boxes are not available in all applications. Hopefully, this is NOT correct.

HTH.

From: Carl (CSEWELL) [#11]
 8 Sep 2006
To: Elm (MKLEIN) [#1] 8 Sep 2006

Mike;

Did the macro help with your problem?

From: Elm (MKLEIN) [#12]
 8 Sep 2006
To: Carl (CSEWELL) [#11] 8 Sep 2006

Carl,

You are a genious!

After my copy/paste to several plates on the template, then selecting
all the text to have the characters removed, it takes about 3 seconds vs. several minutes the way I use todo it.

Yes, it works perfect. I am always looks for short cuts to save time but I was wondering if there is a way to set up the script in Corel to run from
a one click operation.

Right now I have modified my tool bar to only have the necessary tools I use, and one of them being the play button to activate the script selection.

Don't get me wrong it is still better than the way I use todo it, but is there a way to set up a button so when I click on it the script will run right away instead of bring up all the scripts for selection. I know this may be a little far fetched, but it don't hurt to ask..

Thanks again,
Mike


From: Carl (CSEWELL) [#13]
 8 Sep 2006
To: Elm (MKLEIN) [#12] 8 Sep 2006

quote:
if there is a way to set up the script in Corel to run from a one click operation.


Yes. The following may appear daunting, but it's actually pretty easy. Let me know if you have any problems with it and I'll try to make those areas clearer. It was copied from message 4364.2

-------
You can also add the macro as a command on a toolbar, which isn't the easiest thing to do, but we're talking minutes and not hours to implement. I have a flyout specifically for macros.

It's fairly straight forward and once you do it, it is fairly intuitive. To add a command button for a macro to the Toolbox toolbar:

- Right click anywhere on the toolbox toolbar and follow Customize> Toolbox Toolbar> and then click on Add a new command

- In the new window, just below the word Command (top center of the new window) is a text box with File. Click on the down arrow and find and select Macros (it's at the top of the list).

- In the text list box below, find the macro that you want to add as a command button and click on it ONCE.

- You can add a tool tip (see box to the right) under the GENERAL tab.

- Or use a shortcut key for it under the SHORTCUT KEYS tab

- Click on the Appearance tab.

- Here you can change the ICON by IMPORTing one or drawing your own!

- You may want to change the caption (above the ICON) to something simpler than what is displayed.

- Once you get all that done (and you can come back and modify this later), left click (hold down the mouse button) on the macro name in the list box (to left of the tabs section, where you first clicked on it above) and drag it to the toolbox toolbar. Or wherever you want.

- You can undo the command button by dragging it back to where you dragged it from.

- You can go back and modify the icon or tooltip without having to drag it to the toolbar again.

From: Elm (MKLEIN) [#14]
 8 Sep 2006
To: Carl (CSEWELL) [#13] 8 Sep 2006

Carl,

Perfect...

Just finished setting it up on the tool bar and works great!
I can see where this will be handy for setting up other macros
to run with one click operation.


Thanks
Mike


From: Carl (CSEWELL) [#15]
 8 Sep 2006
To: Elm (MKLEIN) [#14] 8 Sep 2006

Excellent.

You probably should export your Workspace so you have a backup copy in case you ever have to use the dreaded F8 on start-up. Right-click on the toolbox toolbar. Follow Customize> Workspace, click on Export Workspace, choose all of the checkboxes (or just toolbars) and then SAVE. If you have CorelDraw running on several computers, this is a great way to synchronize your workspaces so they all look the same.

If you move a workspace to a new computer, make sure you manually copy the GMS files for any macros that you have added. I don't know for sure, but I don't think they are included when you export your workspace.

From: Elm (MKLEIN) [#16]
 8 Sep 2006
To: Carl (CSEWELL) [#15] 8 Sep 2006

Carl,

That's exactly what I will be doing this weekend, setting up another clone pc to our pc's here in the shop. My wife's aunt from Ohio is going to start entering data onto my templates which I will be sending her via email orders, so the more I can automate the process the better for everyone involved.

I really do appreciate ALL the help and info you have given and I hope
someday I can return the favor.

Thanks
Mike


From: Elm (MKLEIN) [#17]
 24 Sep 2006
To: ALL

Well Carl, I'm going to pick you brain again on another feature of Corel which may or may not be available. I have a customer who needs some text engraved, but not in English, but Russian. I did find a online text translator which I can enter the English text and it will convert it over to Russian, after which time I then copy/paste to corel. Just thought maybe it was possible todo this in corel alone. This is the first time I have ever had anyone ask for this tobe done so its a new one one me..

Thanks
Mike


From: bluepaw [#18]
 24 Sep 2006
To: Elm (MKLEIN) [#1] 24 Sep 2006

Why not ask your customer to send you the copy without the line numbers?
Bill


From: Carl (CSEWELL) [#19]
 25 Sep 2006
To: Elm (MKLEIN) [#17] 25 Sep 2006

Mike;

Are you asking if the translation can be done in CorelDraw? Not that I know of and I really wouldn't recommend that you do it that way even it was possible. I would strongly suggest that you get the Russian text in the correct format, directly from your customer,. Language translation can be a very inexact 'science'.

From: logojohn [#20]
 25 Sep 2006
To: Elm (MKLEIN) [#17] 25 Sep 2006

I have someone who uses Laotian fonts.
Most characters require key combinations.

They gave me several types of Laotion fonts.

He brings in a doc file with his wording.

I open it and then can copy and paste it into coreldraw or Xenetech for making the layout fit the product.

Show messages: All  1-20

Back to thread list | Login

© 2024 Project Beehive Forum