The result looks like this:
"line1" + #CRLF$ +
"line2" + #CRLF$ +
"line3" + #CRLF$ +
...
Code: Select all
Procedure PasteAsString()
Protected sci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
If sci = 0
MessageRequester("", "Scintilla not found", #PB_MessageRequester_Error)
Else
Protected text$ = GetClipboardText()
If text$ <> ""
Protected output$
Protected i, lines = CountString(text$, #LF$) + 1
For i = 1 To lines
Protected line$ = RTrim(StringField(text$, i, #LF$), #CR$)
line$ = ReplaceString(line$, #DOUBLEQUOTE$, #DOUBLEQUOTE$ + " + #DOUBLEQUOTE$ + " + #DOUBLEQUOTE$)
line$ = RemoveString(line$, " + " + #DOUBLEQUOTE$ + #DOUBLEQUOTE$)
If i > 1
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
output$ + " + #CRLF$ + " + #CRLF$
CompilerElse
output$ + " + #LF$ + " + #LF$
CompilerEndIf
EndIf
output$ + #DOUBLEQUOTE$ + line$ + #DOUBLEQUOTE$
Next
If output$ <> ""
SetClipboardText(output$)
SendMessage_(sci, #SCI_PASTE, 0, 0)
SetClipboardText(text$)
EndIf
EndIf
EndIf
EndProcedure
PasteAsString()