I'm struggling with the following thing. I have a simple script, that points to a word with mouse, clicks on it, does copy (ctrl+c), then does paste (ctrl+v).
Now, when a copy is done, I need to trim the text in the buffer/clipboard, meaning delete either beginning space (if any) or ending space (if any) - or both. Here's the code I have so far (I list only relevant part):
MouseMove, 439, 219
Click 2
Send ^c
ClipWait
clipboard := RegexReplace(clipboard, "^\s+|\s+$")
clipboard := Trim(clipboard," \`t\`r\`n")
clipboard := LTrim(clipboard, OmitChars = " \`t\`r\`n")
clipboard := RTrim(clipboard, OmitChars = " \`t\`r\`n")
StringReplace, clipboard, clipboard, \`t\`r\`n, , All
StringReplace, clipboard, clipboard, %A_Space%, , All
Send ^v
As you can see I used all the possible options I could find, and STILL the space does not get removed. But also, the strange thing is sometimes the space is removed, but in around 40% of cases it's not. But in any case, I simply need to a solution that would trim/remove spaces in all cases (every single time).
Any ideas, suggestions?