Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Paste plain text (and copy/cut)


  • Please log in to reply
22 replies to this topic
KoolRob
  • Members
  • 2 posts
  • Last active: Aug 16 2009 09:41 AM
  • Joined: 16 Aug 2009
Thanks Laszlo!

Endolith
  • Members
  • 14 posts
  • Last active: May 12 2015 03:47 PM
  • Joined: 18 Feb 2011
Is there a way to make it strip newlines and slashes and other bad characters while pasting to a filename in Windows Explorer or the Desktop? I'm sick of this stupid error dialog. I'd rather it just strip out the bad characters or replace them with "-"

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
just add a bunch of StringReplace, or a RegExReplace instruction

Endolith
  • Members
  • 14 posts
  • Last active: May 12 2015 03:47 PM
  • Joined: 18 Feb 2011

just add a bunch of StringReplace, or a RegExReplace instruction


Ok. How do you detect that it's in a filename box on the desktop or Explorer, though?

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
the simplest is to define two hotkeys, one with removing special chars

wiseley
  • Members
  • 29 posts
  • Last active: Sep 30 2011 11:12 PM
  • Joined: 22 Apr 2009
Laszlo, nice to know that you are still around :D
thanks for all the great scripts you provided this community.

th4drummer
  • Members
  • 28 posts
  • Last active: Jun 04 2015 09:36 PM
  • Joined: 02 Feb 2013

This was a very useful script that worked while I was using Windows XP. Now, I tried using it on a laptop with Windows 7 and it didn't work (both computers with office 2007).

With the risk of not getting a reply due to this being an old topic, I thought I'd give it a try.

 

Any help would be appreciated.

 

Thanks in advance.

 

 

edit: Turns out it was an issue with SendPlay in Win 7 with UAC. Fixing it involves either turning off UAC or switching to Send instead of SendPlay.



capeably
  • Members
  • 61 posts
  • Last active: Jun 10 2016 06:50 AM
  • Joined: 18 May 2013

I have a modified version to remove white space and new line marks and that avoids "pasting" because that can trigger unnecessary paste options in Microsoft Office:
 

$>!v:: ; paste without formatting
  gosub getplain
  Send {Raw}%clipboardt%
  clipboardt = 
  return
  
  getplain:
  StringReplace, clipboardt, clipboard, `r`n, %A_Space%, All
  clipboardt := RegExReplace(clipboardt, "` {2,}", "` ")
  StringLeft, 1st, clipboardt, 1
  IfInString, 1st, %A_Space%
  StringTrimLeft, clipboardt, clipboardt, 1
  StringRIght, last, clipboardt, 1
  IfInString, last, %A_Space%
  StringTrimRight, clipboardt, clipboardt, 1
  return
Updates May 16, 2008

 

 
 
 
This version of the script removes trailing spaces and formatting that can cause issues when copying/pasting in Word, etc., but it does so without having to "type" the text. So might work better for longer blocks of text.
 

Spoiler