This may do it for you:
(defun C:SWA ; = Space Words Apart
(/ mt mtobj strlist trk dimz newlist)
(setq
mt (car (entsel "\nSelect Mtext in which to Space Words Apart: "))
mtobj (vlax-ename->vla-object mt)
strlist (vl-string->list (vla-get-TextString mtobj))
trk (getreal "\nFactor of adjustment in spacing between words: ")
dimz (getvar 'dimzin)
); setq
(setvar 'dimzin 8); suppress trailing zeros in (rtos)
(foreach chr strlist
(setq newlist
(append
newlist ; already
(if (= chr 32); space?
(append '(123 92 84) (vl-string->list (rtos trk 2)) '(59 32 125)); then:
; add Tracking factor at space
(list chr); else: just the character
); if
); append
); setq
); foreach
(vla-put-TextString mtobj (vl-list->string newlist))
(setvar 'dimzin dimz)
(princ)
); defun
What it does is to impose the code into the text content, at every space [only], that you get from selecting that space and putting a Tracking value on it in the Mtext formatting editor. That can be greater than 1 as in your description, but it can also be less than 1.
It requires Mtext, not plain Text, since Tracking factors can be applied only in Mtext. Something similar could be done with plain Text, that would replace all spaces with multiple spaces, but that would give you less flexibility, working only with whole multiples of the width of a space as defined in the font involved. The tracking factor in Mtext doesn't need to be a whole number, but can include decimal places.
It doesn't yet do things it could be enhanced to do, such as verify that you selected the right kind of object, or apply the same tracking factor to spaces in multiple Mtexts.
It assumes that you don't type in a factor that has more decimal places than your Units setting is set to display, because it will put no more than the latter number of decimal places into the result. But a greater precision argument could be included in the (rtos) function if needed.
I haven't tried it on a string that it has already been applied to -- that could give unexpected results. If you don't like a result, I suggest you not run it again on the result, but Undo the first try and run it again with a different factor, on the un-adjusted original Mtext.
Bear in mind that it adjusts the size of spaces only, and has no concern with the number of characters in the words or digits in between. So the words will not be equally spaced in center-to-center fashion as with center-justified tabs in a word processor, unless they are of equal width to begin with, and even that will be affected by the particular characters in them, unless the font is a mono-spaced one.
Kent Cooper, AIA