Code: Select all
clipboard := "" ; Empty the clipboard
Send ^a
Send ^c
Loop
{
StringReplace, Clipboard, Clipboard, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0 ; No more replacements.
break
}
Send ^v
return
I have used the below to create a variable "Alltext2" and then run the script above, using the variable instead of the clipboard, but this does not work. I would be grateful for help.ABSTRACT:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
INTRODUCTION:
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Code: Select all
WinActivate, Document - WordPad
ControlGetText, Alltext, Document - WordPad
GuiControl, Focus, Document - WordPad
; Get all text between ABSTRACT and INTRODUCTION
alltextlen:= strlen(Alltext)
StartPos := InStr(Alltext, "ABSTRACT:" , CaseSensitive := true, StartingPos := 1, Occurrence := 1)
EndPos := InStr(Alltext, "INTRODUCTION:" , CaseSensitive := true, StartingPos := Startpos, Occurrence := 1)
Alltext2 := SubStr(Alltext, Startpos+Strlen("ABSTRACT:"), endpos-(startpos+Strlen("INTRODUCTION:")+2)) ; Crop Text