Jump to content

Batch Find & Replace Text


Lee Mac

Recommended Posts

Ok, I just thought we had another lazy member wanting everything handed to them without bothering to spend 2 seconds of their time to actually look for something. My apologies. o:)

 

When you removed the code, did you place a note saying that the routine was under construction and will be back soon? :unsure:

Link to comment
Share on other sites

Lee, I'm probably doing something wrong. I downloaded version 1.4. It says last edited 12:13 Today. I ran it on my files - the same once I uploaded for your experimentations, and it did not change anything in them.

How should I enter that stacked Registred Mark symbol on the search line?

I tried:

I-CON®/ Motor with I-CON®/ Control

and

I-CON® Motor with I-CON® Control

and

I-CON®^ Motor with I-CON®^ Control

and

I-CON®/^ Motor with I-CON®/^ Control

 

Link to comment
Share on other sites

Zoyad,

 

There are still a few bugs for stacked text, as I stated in my previous posts...

 

But I will say that if the Find String contains formatting that starts halfway through it this is unable to be replaced with the replace string - another known bug.

Link to comment
Share on other sites

  • 1 month later...

Hi Lee

 

Great program once again!

 

Looking to do the following and can't get to the answer: (if possible though)

 

Example:

I have the following text:

 

File Name: Drawing1,

File Name: Drawing2,

File Name: Drawing3, ect

 

I would like to find&replace Drawing* and replace with a Field value, so I end up with :

File Name: Field value

 

is there a way to do this through your program or any other method?

(Currently I would record a macro and create a script to delete the complete Dtext and paste the new field value dtext in the same position, but that could sometimes be a problem if the text is not on the exact same position in all the drawings)

Link to comment
Share on other sites

Hi Rustym,

 

I'm not sure that my program can currently do that which you are describing - I would think the best way to approach it would be to create a LISP that would create the Field and run this LISP through a Script.

 

Lee

Link to comment
Share on other sites

yes what I hoping to find. Doesn't have to be field values.

 

The same would apply for someone who want to change the text: 12341000 , 56781000

Searching for *1000 and replace with ABCD1000 on all text.

Link to comment
Share on other sites

  • 4 weeks later...

i found where it's located BUT it's supposedly in an AutCAD 2002 folder. i don't even have AutoCAD 2002 in my program files. How is it putting it there?

 

There's a shortcut in C:\Documents and Settings\dpate30\Favorites\Autodesk called acad.pat but then when i go to the properties it shows: "C:\Program Files\AutoCAD 2002\Support\acad.pat". i don't have this in my program files and yes i'm looking at hidden files and folders. How do i change this in the .lsp?

Link to comment
Share on other sites

You perhaps had '02 installed in the past, to change it in the LISP you would have to change all the places that involve searching for the ACAD.pat file. As you can probably gather, I've changed this methodology with recent programs, but haven't as yet updated the older ones.

Link to comment
Share on other sites

  • 3 weeks later...

Hey LeeMac....

 

You make people like us in less demand.... calm down.... You've got your pats on the back...we all know your pretty amazing, but leave it at that man. You can provide help without spoon feeding high level applications. For instance. here is my rendition of finding all files within a folder recursively:

 

(defun Get_All_Files (folder pat / tls fdl)
 (setq tls (append lst (vl-directory-files folder pat 1))
   fdl (vl-remove-if '(lambda (x) (member x '("." ".."))) (vl-directory-files folder nil -1)))
 (if tls
   (setq tls (mapcar '(lambda (i) (strcat folder "\\" i))tls))
   )
 (if fdl
   (progn
     (setq fdl (mapcar '(lambda (i) (strcat folder "\\" i))fdl))
     (foreach x fdl
   (setq tls (append tls (Get_All_Files x pat)))
   )
     )
   )
 tls
 )

This would assist someone who understands what we do, but it won't help someone who doesn't.... you go to far in my opinion. However, as good as I am at this stuff.... You did teach me something with your shell.application object reference for a starting folder location. I have used (ACET-UI-PickDir) in the past for this, and it is good to know that I have an alternative if the ACET function goes away.

Edited by CAD-Ninja
Link to comment
Share on other sites

Another possible way to code it :

 

(defun LM:GetAllFiles ( dir typ ) ;; © Lee Mac 2010
 (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1))
   (apply 'append
     (mapcar '(lambda ( x ) (LM:GetAllFiles (strcat dir "\\" x) typ))
       (vl-remove-if '(lambda ( x ) (wcmatch x "`.,`.`.")) (vl-directory-files dir "*" -1))
     )
   )
 )
)

Link to comment
Share on other sites

You make people like us in less demand.... calm down.... You've got your pats on the back...we all know your pretty amazing, but leave it at that man. You can provide help without spoon feeding high level applications.

 

You've got some good points though - anyone trying to earn a living out of doing this probably isn't going to like me posting free stuff - perhaps its time I took some of it down.

Link to comment
Share on other sites

Yeah I wasn't trying to slight you man. You and I are quite similar actually. I have a whole library of stuff that I have written without specific purpose.... just for the challenge of it (and frequently find ways of using). I get better all the time because I truly enjoy doing this stuff and always find new ways to challenge myself. I do still share what I write with some select peers, but they are people that talk the talk and will look out for the best interest of gifted minds. You might consider delving into some .NET like I have. They've made some pretty interesting advances recently.

For clarification, I never said you should take down your work. Once it becomes public property it should probably stay that way; it's not really yours anymore. I think someone like yourself could do a lot of good for likeminded folk without conducting a gravy train though. Again, it is just an opinion and I am not claiming to be right...

I enjoy helping people (probably more than getting off; the kicks last longer) but only those with the will and passion to learn something. Those without the dedication and motivation to better themselves are just a waste of your talents..... I think you'll find that the people associated with those two classes have very different goals.... Your peers (people like us) aren't looking for extravagant new toys to abuse. I scanned the code because I figurd there was something to learn from it, but if I wanted something that did the exact same thing.... I would write it from scratch and maybe ask you some questions as I go.... thus learning what you learned along the way, and hopefully finding a better way of doing it in the process.

I personally try VERY hard to inspire the leeches when I run into one on a personal level. On rare occasions I actually get one on the right track but for the most part leeches just want to be leeches. *shrug*

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...