rcmaehl Posted April 22, 2019 Share Posted April 22, 2019 (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 April 22, 2019 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 22, 2019 Share Posted April 22, 2019 (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 April 22, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
rcmaehl Posted April 22, 2019 Author Share Posted April 22, 2019 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
rcmaehl Posted April 22, 2019 Author Share Posted April 22, 2019 (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 April 22, 2019 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now