Something like this?
You can change it to be global with and "x" in the ssget statement or type all at the select objects prompt.
P=
Code:
;___________________________________________________________________________________________________________|
;
; Written By: Peter Jamtgaard C.E., P.E., S.E. copyright 2018 All Rights Reserved
;___________________________________________________________________________________________________________|
;
; Any use by unauthorized person or business is strictly prohibited.
;___________________________________________________________________________________________________________|
;___________________________________________________________________________________________________________|
;
; Comand line function list
;___________________________________________________________________________________________________________|
;* C:TextFix
;* Command line function to remove quotes from text, mtext and attributes
;___________________________________________________________________________________________________________|
;
; General Function Header List
;___________________________________________________________________________________________________________|
; Function List Argument1 Argument2 Arguement3
;* (ErrorTrap symFunction)
;* Standard Error Trap
;* (TextFix strReplace strFind strTextString)
;* Function to replace all single quotes with blanks and double quotes with single quotes
;* (TextSubstituteAll strReplace strFind strTextString)
;* Function to replace all instances of a find string in a text string with a replace string
;___________________________________________________________________________________________________________|
;
; Command line function to remove quotes from text, mtext and attributes
;___________________________________________________________________________________________________________|
(defun C:TextFix (/ intCount entSelection lstEntity objSelection ssSelections )
(if (setq ssSelections (ssget (list (cons 0 "TEXT,MTEXT,INSERT"))))
(repeat (setq intCount (sslength ssSelections))
(and
(setq intCount (1- intCount))
(setq entSelection (ssname ssSelections intCOunt))
(setq lstEntity (entget entSelection))
(setq objSelection (vlax-ename->vla-object entSelection))
)
(if (wcmatch (vla-get-objectname objSelection) "AcDbBlockReference,AcDbMInsertBlock")
(if (= (vla-get-hasattributes objSelection) :vlax-true)
(foreach objAttribute (vlax-invoke objSelection "getattributes")
(TextFix objAttribute)
)
)
(TextFix objSelection)
)
)
)
(princ)
)
;___________________________________________________________________________________________________________|
;
; Standard Error Trap
;___________________________________________________________________________________________________________|
(defun ErrorTrap (symFunction / objError result)
(if (vl-catch-all-error-p
(setq objError (vl-catch-all-apply
'(lambda (XYZ)(set XYZ (eval symFunction)))
(list 'result))))
nil
(or result
'T
)
)
)
;___________________________________________________________________________________________________________|
;
; Function to replace all single quotes with blanks and double quotes with single quotes
;___________________________________________________________________________________________________________|
(defun TextFix (objSelection / strTextString)
(and
(setq strTextString (vla-get-textstring objSelection))
(setq strTextString (TextSubstituteAll strTextString "\"\"" "$" ))
(setq strTextString (TextSubstituteAll strTextString "\"" "" ))
(setq strTextString (TextSubstituteAll strTextString "$" "\""))
(errortrap '(vla-put-textstring objSelection strTextString))
)
)
;___________________________________________________________________________________________________________|
;
; Function to replace all instances of a find string in a text string with a replace string
;___________________________________________________________________________________________________________|
(defun TextSubstituteAll (strTextString strFind strReplace )
(while (vl-string-search strFind strTextString)
(setq strTextString (vl-string-subst strReplace strFind strTextString))
)
strTextString
)
(vl-load-com)