Jump to content

Batch Find & Replace Text


Lee Mac

Recommended Posts

If you are process drawings in a folder that you have open in AutoCAD, you will need to regen the files to see the changes - I didn't add a regen to the program as I thought it would slow it down quite a bit.

 

This will only occur when you have the drawings open, if you are processing drawings that are not open, no regen is required.

 

Lee

Link to comment
Share on other sites

Hi Lee

 

That's brilliant, works a treat.

I was wondering if there could be a fully automatic option.

Once all the find and replace strings are set up, then the lisp could be fired up using 'bfinda' or something similar, which would run the lisp without any other user action. Just an idea, could be useful.

 

Cheers

Link to comment
Share on other sites

Hi Lee

 

That's brilliant, works a treat.

I was wondering if there could be a fully automatic option.

Once all the find and replace strings are set up, then the lisp could be fired up using 'bfinda' or something similar, which would run the lisp without any other user action. Just an idea, could be useful.

 

Cheers

 

Thanks Least, I appreciate it :)

 

Hmmm, nice idea, but could be dangerous in the wrong hands - at least with the dialog you get a 'warning' of what you are about to change - it could be done, but I am wary of it.

 

Lee

Link to comment
Share on other sites

I can understand that. If the option were to be only available when the config is set up for current drawing only, it would minimise the risk. Although it's not too hard to click through.

 

I have found a little bug, when the lisp is run twice.

This is using Dtext.

 

Find strings:

 

CL

E

R

 

Replace strings:

 

C/L

Eaves

Ridge

 

Works fine first run, but if the lisp were to be repeated the output is this:

 

C/L

Eavesaves

Ridgeidge

 

 

Thanks again.

Link to comment
Share on other sites

Yes, the program does not currenly use Wildcards, I should probably make that improvement.

 

Hence, currently, if you type to find "E", it will find it whether it be alone or within a string.

 

I shall look to make this revision in the next version so that you would have to type *E* to get the same behaviour.

Link to comment
Share on other sites

I don't think so.

I can do a find and replace with acads built in for say

E -> Eaves

 

then if I run the same strings again, it says 'no more occurrences', whereas yours currently modifies the Eaves to Eavesaves

 

 

Ta

Link to comment
Share on other sites

If you use the Find command and perform the replacement, then run the Find command again, ACAD will perform the replacement again - well, thats what happens in ACAD2010 anyway.

Link to comment
Share on other sites

Not here with 2005.

 

E -> Eaves in command changes the E to Eaves

run again

E -> Eaves, reports 'no more occurrences' and leaves the Eaves as Eaves.

 

Ah but I do have 'find whole words only' option ticked.

Link to comment
Share on other sites

I have updated the code to Version 1.3

 

Quite a few updates in this Version, including:

 

  • Table Text may now be searched.

  • Added the Option to Find Whole Words only (as discussed above).

  • Added the ability to double-click to edit an entry.

Enjoy!

 

Lee

Link to comment
Share on other sites

Works a treat and looks very professional!

 

I don't want to be a pain, but I have another request. Was wondering if it's possible to add an option to search model space or paper space only, or of course all.

 

Cheers

Link to comment
Share on other sites

Works a treat and looks very professional!

 

I don't want to be a pain, but I have another request. Was wondering if it's possible to add an option to search model space or paper space only, or of course all.

 

Thanks Least :)

 

I welcome the requests - sometimes its hard to come up with improvements for programs, so, as long as the request is not too specific to one particular user's purposes, I will consider implementing it.

 

Thanks for your continued support :)

 

Lee

Link to comment
Share on other sites

  • 2 weeks later...

I just found this routine, and it looks awesome. This will definately be part of my toolkit from now on.

Like someone else suggested previously, I too would love to be able to simply point to a txt file and do my find/replace based on that. I could then simply maintain my find/replace lists in one or more txt files, and load the one needed.

 

I would make lists like:

This is a string of text, This is text

This is another string of text, This is text

Etc.

 

Essentially, I want to reduce eleborate descriptions to a shorter string.

 

I know this program started off as a batch replacer for multiple drawings, but it would be nice to have the option to select current layout or selected objects, just like the built in Find/Replace command, instead of just Current Drawing Only.

 

Anyway, my 2 cents. Thanks for the program :)

Link to comment
Share on other sites

Thanks for your suggestions, I'm glad you like the program :)

 

I would like to add more to this program, but time is running short recently due to university exams etc, so I may have to put big projects like this to the back.

 

There are also a few issues regarding MText nested formatting that I need to resolve, so be careful when using it in that respect.

 

Lee

Link to comment
Share on other sites

There's a big reason for something like this being a bit too risky.

If you are left with removing all formatting codes to edit, the user is going to get some rather undesired results, or right now, with the possibility of accidentally modifying a formatting code because it matches the search parameter.

 

Know that I'm not dogging your work, it's just that some things are best left to do without complete automation.

Link to comment
Share on other sites

There's a big reason for something like this being a bit too risky.

If you are left with removing all formatting codes to edit, the user is going to get some rather undesired results, or right now, with the possibility of accidentally modifying a formatting code because it matches the search parameter.

 

Know that I'm not dogging your work, it's just that some things are best left to do without complete automation.

 

You've probably seen the discussion I'm having with Joe over at theSwamp regarding MText formatting codes - I'm not planning to remove MText formatting codes completely - rather dissect the text, make replacements and then put the formatting back together.

 

Users know the risk of a Batch find and replace, I'm just providing an option for those who want to use it (that's probably not going to be you).

 

Lee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...