martinle Posted June 9, 2017 Posted June 9, 2017 Hello, I live in Austria. If I execute a Lisp written in English and it does not contain "_" (underline) in the program it is very Effortlessly enter all the underlines in a longer Lisp by hand. Is there a faster solution for this? Please help. Example: (Command "copy" unit1 "" "m" p2 p6 p22 p23 "") ;;;; without underlines (Command "_copy" unit1 "" "_m" p2 p6 p22 p23 "") ;;; With underscores Martin Quote
Tharwat Posted June 9, 2017 Posted June 9, 2017 Hi, The underscore prefix has nothing to do with fast process or anything else other than it ensures is that the command name is used in English if you are using None-English release of AutoCAD. Furthermore, to avoid changing the name of the command call within your lisp file to the language of your AutoCAD Program. eg: 'copy' to 'kopiëren' Quote
Roy_043 Posted June 9, 2017 Posted June 9, 2017 (edited) @martinle: In Notepad++ you can use regular expressions to search and replace texts. > Notepad++ > Replace... > Find what: [b]\(\s*command\s*"(?!\._|_\.|_)[/b] > Replace with: [b]\(command "_[/b] > [ ] Match case > [[b]v[/b]] Wrap around > Search mode > [[b]*[/b]] Regular expression Edited June 9, 2017 by Roy_043 Quote
martinle Posted June 9, 2017 Author Posted June 9, 2017 Hello tharwat, I am looking for a lisp translation of English in German which automatically sets the underscores. Martin Quote
martinle Posted June 9, 2017 Author Posted June 9, 2017 Hello roy, I use notepad ++, but it is rather tedious to change everything individually Martin Quote
BIGAL Posted June 9, 2017 Posted June 9, 2017 Like Roy_043 use word and make a macro and just do a number of "replace", after coding just be carefull when saving as you can make a DOC not a TXT. Just do one and then you can copy it and edit etc Below is directly from Word record macro ' this example from word replaces all lower case b with a uppercase B ' depending on your word "View" "macros" Sub Macro1() ' ' Macro1 Macro ' ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "b" .Replacement.Text = "B" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub Quote
Roy_043 Posted June 10, 2017 Posted June 10, 2017 @martinle: Using the regular expressions in my previous post *ALL* commands will be fixed at once. Just try it. @BIGAL: It is not a simple case of exchanging one character. Command names may already have a "_" or "_." or "._" prefix. See the 'Find what:' regular expression. Quote
martinle Posted June 10, 2017 Author Posted June 10, 2017 Hello roy, I will try it when I am on Monday again at work. But I can not yet understand their explanation. Excuse me. Martin Quote
Roy_043 Posted June 10, 2017 Posted June 10, 2017 Note that my suggestion will only change command names not command options. So: (Command "copy" unit1 "" "m" p2 p6 p22 p23 "") Will become: (command "_copy" unit1 "" "m" p2 p6 p22 p23 "") Quote
Lee Mac Posted June 10, 2017 Posted June 10, 2017 @Roy, you may want to include a double-quote in the negative-lookahead, to avoid (command "") being changed to (command "_") Quote
BIGAL Posted June 11, 2017 Posted June 11, 2017 Roy_043 as I suggested using Word you make a macro with a number of changes then you do not have to remember all the typing save a blank DOC. This way it would be all done in one go. As Word macro's are VBA you could read a file with the replace options. Quote
Roy_043 Posted June 11, 2017 Posted June 11, 2017 @Lee: you are right. Thanks. Improved version: Find what (Suchen nach): \(\s*command\s*"(?!\._|_|") Replace with (Ersetzen durch): \(command "_ Alternative (also works for command options): Find what (Suchen nach): "(?!\._|_|\s|\)|") Replace with (Ersetzen durch): "_ Note: Since this regular expression matches not just command names and options, replace matches one at a time. Quote
Lee Mac Posted June 11, 2017 Posted June 11, 2017 Nice one Roy The following could be used to also account for the use of vl-cmdf: Find: \(\s*(command|vl\-cmdf)\s*"(?!\._|_\.|_|") Replace: \($1 "_ Quote
martinle Posted June 11, 2017 Author Posted June 11, 2017 Thanks to all of you for the great support. I'll try it out at work tomorrow. Maybe I manage to change the command and the options in one piece.? I hope! Martin Quote
martinle Posted June 12, 2017 Author Posted June 12, 2017 Hello, have it tested and it makes me a lot of work. Many thanks. It works wonderfully! Martin 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.