Jump to content

Recommended Posts

Posted (edited)

Hi all,

I'm having an issue in which if the clipboard contains special formatting it does not pass to ClipPut. I've included a sample script and data below.

While True
    $Clip = ClipGet()
    ClipPut($Clip)
    Sleep(100)
WEnd

Input:

 

User 1
Data 1 4/18
User 2
Data 2 4/15
user 3
Data 3 4/18
User 4
Data 4 4/19
Data 5 4/19


Output:

User 1    
Data 1    4/18
User 2    
Data 2    4/15
User 3    
Data 3    4/18
User 4    
Data 4    4/19
Data 5    4/19

Is there any way to modify the clipboard data while keeping special formatting?

Thanks!

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11, MSEdgeRedirect
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)

@rcmaehl
You could do something like this:

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

Global $varClipContent = ClipGet()


MsgBox($MB_ICONINFORMATION, "Before:", $varClipContent & @CRLF & "User 1 will become now User 5")

$varClipContent = StringRegExpReplace($varClipContent, 'User 1', 'User 5')

MsgBox($MB_ICONINFORMATION, "After:", $varClipContent & @CRLF & "User 1 is now User 5")

ClipPut($varClipContent)

:)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted
9 minutes ago, FrancescoDiMuro said:

@rcmaehl
You could do something like this:

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

Global $varClipContent = ClipGet()


MsgBox($MB_ICONINFORMATION, "Before:", $varClipContent & @CRLF & "User 1 will become now User 5")

$varClipContent = StringRegExpReplace($varClipContent, 'User 1', 'User 5')

MsgBox($MB_ICONINFORMATION, "After:", $varClipContent & @CRLF & "User 1 is now User 5")

ClipPut($varClipContent)

:)

That still removes formatting. 


User 5
Data 1    4/18
User 2
Data 2    4/15
user 3
Data 3    4/18
User 4
Data 4    4/19
Data 5    4/19

instead of 
 

User 5
Data 1 4/18
User 2
Data 2 4/15
user 3
Data 3 4/18
User 4
Data 4 4/19
Data 5 4/19

 

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11, MSEdgeRedirect
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted (edited)

I've got it partially figured out using 
 

#include <Clipboard.au3>

While True
    $Clip = _ClipBoard_GetDataEx($CF_UNICODETEXT)
    _ClipBoard_SetDataEx($Clip, $CF_UNICODETEXT)
    Sleep(100)
WEnd

But still lose some data, specifically cell sizing.

 

Edit: Disregard, sleep(100) seems to have screwed it up somehow when I was testing before. Works fine.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11, MSEdgeRedirect
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...