Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

AutoHotkey: Add specific character at the beginning of each line

Hello experts,

The following script allows me to add a specific character at the beginning and end of a selected text:

;====================================
;EE Code
;====================================

!^c:: ;code
Send, ^c
Sleep, 50
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error, No text appearing after one second
  Return
}
ClipboardVar:=Clipboard
Clipboard:="[code(string))]" . ClipboardVar . "[/code(string)]"
Sleep, 50
MsgBox,4160,Success,Your clipboard has been properly copied., 2
Return

Open in new window


I would like to take it as a reference to add specific character (-) at the beginning of the various lines of a selected text.

Example of a selected text:
Line 1
Line 2
Line 3
Line 4

Result:
-Line 1
-Line 2
-Line 3
-Line 4

If you have questions, please contact me.

Thank you for your help.
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luis Diaz

ASKER

Thank you very much Joe,
I modify the question to have a proper code comment.
I will test your proposal and keep you informed.
Joe,

I tested and it works!
Thank you very much for your help!
You're welcome, Luis, and thanks to you for letting me know that it works. Thanks, too, for writing the very nice Testimonial...I really appreciate it! Regards, Joe