Delete spaces in the clipboard Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Itman
Posts: 17
Joined: 11 Sep 2016, 13:47

Delete spaces in the clipboard

19 Jul 2018, 16:44

Hi, can you help me to find a script that deletes spaces in the clipboard?

E.g a text wich has a a a a should be aaaa and paste it.


Thank you!
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Re: Delete spaces in the clipboard

19 Jul 2018, 16:53

Look up RegExReplace

OR

try this:

Code: Select all

StringReplace, TotalVar, TotalVar, %A_SPACE%,, All
Last edited by chef423 on 19 Jul 2018, 16:55, edited 1 time in total.
User avatar
Flipeador
Posts: 1204
Joined: 15 Nov 2014, 21:31
Location: Argentina
Contact:

Re: Delete spaces in the clipboard

19 Jul 2018, 16:54

Code: Select all

F1::
Clipboard := RegExReplace(Clipboard, "\s")
SendInput ^v
return
Itman
Posts: 17
Joined: 11 Sep 2016, 13:47

Re: Delete spaces in the clipboard

19 Jul 2018, 17:06

Thank you! Works great!
Just another question, I don't know if I should open an extra topic for it.
I have the following code:

Code: Select all

!x::
If (Clipboard<>"")
{
  Clipboard:=SubStr(Clipboard,2)
  Send, %clipboard%
}
Return
Alt + X deletes the first letter of the clip and pastes it. How can I combine it with the string

Code: Select all

Clipboard := RegExReplace(Clipboard, "\s")
SendInput ^v
So that in hitting ALT + X first all spaces should be deleted first and pasted. But if there is no space than the first letter should be deleted an pasted?

Thanks again!
User avatar
Flipeador
Posts: 1204
Joined: 15 Nov 2014, 21:31
Location: Argentina
Contact:

Re: Delete spaces in the clipboard  Topic is solved

19 Jul 2018, 17:20

Code: Select all

!x::
Clipboard := RegExMatch(Clipboard, "\s") ? RegExReplace(Clipboard, "\s") : SubStr(Clipboard, 2)
SendInput ^v
return
Itman
Posts: 17
Joined: 11 Sep 2016, 13:47

Re: Delete spaces in the clipboard

19 Jul 2018, 17:53

amazing! Thank you so much!
Guest

Re: Delete spaces in the clipboard

03 Oct 2018, 19:12

Plz tell me someone, why my script makes my clipboard empty?

Code: Select all

^c::
ClipWait
;replace in Clipboard +7 (952) 6670804 --> +79526670804
Clipboard := RegExReplace(Clipboard, "\+7?\((\d{3})\)?(\d{6})","\+7$1$2")
return
trying to do smth like this https://www.youtube.com/watch?v=PfjyecsqEhE

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Sniperman and 401 guests