I want to add number bullets to sequential lines in the microsoft word like program as follows...
Line one.
Line Two.
Line three.
Line four.
is converted to
1. Line one.
2. Line Two.
3. Line three.
4. Line four.
I should be able to keep the script running and do this again and again on different files one after another.
Thanks.
Add bullet numbers
Re: Add bullet numbers
Hi tnmc77,
Code: Select all
; CONCLUSION:
; abc
; def
; ghi
F11::
Send ^a^c
ClipWait
str := "" ; an empty string
Loop, Parse, % Trim(clipboard, "`r`n"), `n, `r ; retrieves substrings (fields) from the clipboard, one at a time, using the linefeed as delimiter
str .= (a_index-1) . ". " . A_LoopField . "`r`n" ; appends the number minus 1 of the current loop iteration, a dot, the field and a linefeed-carriage return to the string
SendInput % LTrim(str, "0. ") ; sends the string omitting "0. " from the beginning
return ; end of the subroutine
; -------------------------
; abc
; def
; ghi
F12::
Send ^a^c
ClipWait
str := ""
Loop, Parse, % Trim(clipboard, "`r`n"), `n, `r
str .= a_index . ". " . A_LoopField . "`r`n"
SendInput % str
return
Re: Add bullet numbers
A_Ahkuser,
Many many thanks.
The F12 script, not only numbers selected items but also lines in the rest of the page.
F11 script also numbers Conclusion line and not the lines which follow it. Also, it seems to change spacing and indent.
Thanks.
Many many thanks.
The F12 script, not only numbers selected items but also lines in the rest of the page.
F11 script also numbers Conclusion line and not the lines which follow it. Also, it seems to change spacing and indent.
Thanks.
Re: Add bullet numbers
If you want to prevent the script from number all the item and modify the selected items instead, substitute this line:
by this other one:
I doubt the script change the spacing and indent: actually, there's no space nor tab in the script. If you talk about interlining, you can try instead of:
this variant:
Code: Select all
Send ^a^c ; sends CTRL+A CTRL+C
Code: Select all
Send ^c ; ; sends CTRL+C
Code: Select all
A_LoopField . "`r`n"
Code: Select all
A_LoopField . "`n"
Re: Add bullet numbers
I cant believe I did not see the flaw of ^a^c. I just tried. Works like a charm. Many thanks. You rock.
Re: Add bullet numbers
Btw I should empty the clipboard before clipwait - i.e.:
Code: Select all
F12::
clipboard =
Send ^c
ClipWait
; ...
Re: Add bullet numbers
Thank you much
Re: Add bullet numbers
At work and the F12 script is working awesome. One issue...if there is a solution for it. (I am using Powerscribe, which is windows based - similar key commands as word).
It is adding space between lines. Any solution?
Many thanks.
Line one.
Line Two.
Line three.
Line four.
is converted to
1. Line one.
2. Line Two.
3. Line three.
4. Line four.
It is adding space between lines. Any solution?
Many thanks.
Line one.
Line Two.
Line three.
Line four.
is converted to
1. Line one.
2. Line Two.
3. Line three.
4. Line four.
Re: Add bullet numbers
OK my bad; I missed the fact that you're working on word: actually, i tested it in notepad and now I can understand how spaces and tabs appear. I don't have word so I can't test it but it seems to me that Word works just like Open Office and recognize a pattern and convert the input into a ordered list. One solution could be to substitute the dot with another symbol in order to thwart the pattern recognition. For example, using the median dot (UTF-32BE n°188):
Concerning the interlining did you try the alternative that I suggested you in my answer above ? - i.e.:
Hope this helps
Code: Select all
str .= a_index . Chr(183) . A_Space . A_LoopField . "`r`n"
Code: Select all
A_LoopField . "`n"
Who is online
Users browsing this forum: ArkuS, Google [Bot], Ineedhelplz and 219 guests