Bill Tillman Posted July 10, 2012 Posted July 10, 2012 I have a task which I'm going to try and use LISP for. I'm reasonably sure I could do this in VBA with the INSTR command but since some other tasks are done with LISP I'm going to try to stay with that language for now. We have some drawings which are staged in a certain location so that they can be reviewed by one of the designers. The typical filename pattern is comprised of 5 digits like this: 99999.dwgThere are some drawings which once checked and found to contain error(s) will be named like this: 99999 (Pending).dwgWhen the time comes, I'd like to rename the file and remove the (Pending) suffix. But as you can see, sometimes this pattern will be there, other times it will not. Is there something similar in LISP to the INSTR command with VB which would identify this pattern and then let me re-concatenate the string without the (Pending) text? Quote
BlackBox Posted July 10, 2012 Posted July 10, 2012 Look into the vl-String-Search and vla-SaveAs functions. ** Edit - Oh, and potentially the vl-File-Delete function as well. Quote
Bill Tillman Posted July 10, 2012 Author Posted July 10, 2012 (edited) I think I found what I'm looking for with wcmatch....will test this method.... and vl-string-search...one of these should work. UPDATE: Thanks RenderMan..your suggestion for vl-string-search worked quite well. (vl-load-com) (defun c:approve (/ fname x) (setq x (vl-string-search "(Pending)" (getvar "dwgname"))) (if (> x 0) (setq fname (strcat (substr (getvar "dwgname") 1 x) ".dwg")) (setq fname (getvar "dwgname")) ) (princ); exit quietly ); end function Edited July 10, 2012 by Bill Tillman Quote
Recommended Posts
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.