Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro batch find replace text

Status
Not open for further replies.

Gabriele82

Automotive
Jul 15, 2024
6
thread560-452818

Hello everyboy
I need a macro or batch in catiav5 or autocad
That find and replace textes in several drawings.
I have a word table with the words and phrases that i have to import.
Anyone have this to pass me ?
Hope in an answer..
thanx in advise
 
Replies continue below

Recommended for you

I don’t know. Seems Good but the link is broken
 
Sorry about that - there is some patreon stuff but I don't want to sign up to see if that's where the macro got moved to.

Does a regular search and replace work? I've used AutoIT to automate what can be done with the user interface. I suspect this is tedious work as one has to find every instance of every word or phrase in the drawing; there may be drawings that don't use all the words and phrases and there may be drawings where some word or phrase is repeated.

The program needs a loop like:

For each word or phrase:
Search for the item
if the item is found then replace with ... then repeat search
repeat (with next word or phrase until none remain.)

Things to watch for: If a word by itself is also part of a phrase then the replacement of the phrase has to happen first or the phrase won't be found due to a word already being replaced.
 
Basically I would need a macro that automatically finds and replaces the words/phrases by taking them from a Word file
many drawings so it could be an external macro
 
That's the beauty of AutoIT. It is completely outside the application. It's not a macro, but an actual programming language for building programs that control other programs. I'd move the word/phrase list out of Word to a plain text file, separating the WAS and NOW with a tab character and each pair separated with a carriage return.

Anything you can do from the interface you can get AutoIT to do. See
 
ok, i had download it. can u explain me what use it please?
may with some pictures.. thanx a lot
 
See
You might look at the Notepad example under tutorials for a start to see what AutoIT does.
You will likely need to use to understand how to do the editing and running to begin with.

The direct link to the Notepad example is: but there are other tutorials on the above page.

The script editor is introduced here:
This all may seem harder than having a pre-worked solution, but you currently don't have a pre-worked solution (and I am very disappointed in 3dcatia for not keeping that macro) so this is the best path I can suggest.

One very nice feature is that most every part of AutoIT has good documentation that includes a description, all the parameters, and a working example. For example: You don't have to understand much initially - you can copy the example to a new script and save and run the example to see what it does and then you can go back line-by-line to see what each line is for.
---
What is interesting to me - I worked a project where an Italian company sold us their drawings to use with a US government contract. All the drawings had to be converted to English. They also had to be converted to English units from metric and converted from 1st angle projection to 3rd angle projection. In all, a search and replace would have been such a tiny amount it wasn't worthwhile. Hopefully changing text is all you need to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor