remin Posted February 7, 2020 Share Posted February 7, 2020 (edited) I use this function since many many years (hotkey: ctrl-g). Func _ClearAndPaste() ; CTRL+g ; serve _Clipboard.au3 in include Local $aClip _Clipboard_GetAll($aClip) ; save clipboard contents Local $sClip = ClipGet() ; get clipboard as plain text ClipPut($sClip) ; put clear text back on clipboard Send("^v") ; paste it _Clipboard_PutAll($aClip) ; restore previous contents (clears current contents) _Clipboard_MemFree($aClip) EndFunc It does not work anymore. It just paste the Rich text. Has anything changed in windows as far as the clipboard is concerned? ps: I did not change autoit version. Still the same as before (3.3.14.5) Edited February 7, 2020 by remin more info Link to comment Share on other sites More sharing options...
Danp2 Posted February 7, 2020 Share Posted February 7, 2020 Have you tried adding a delay between the ClipPut and the Send? I seem to recall a similar issue where I had to loop until the clipboard contents were actually updated and then proceed. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
remin Posted February 7, 2020 Author Share Posted February 7, 2020 (edited) Yes I tried it. Strange things are happening now: If I copy a formatted text and put the cursor a line below the formatted text and use the hotkey Ctrl-g the formatting is removed. If I put the cursor after the formatted text and use the same hotkey the formatting is not removed. Edited February 7, 2020 by remin Link to comment Share on other sites More sharing options...
Danp2 Posted February 7, 2020 Share Posted February 7, 2020 That sounds more like an issue with the program you are pasting into than the script. Have you tried the following -- ; send actual text instead of pasting it from the clipboard Send($sClip) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jdelaney Posted February 7, 2020 Share Posted February 7, 2020 (edited) You will get better help if you provide something that runs and reproduces your issue. The smallest amount of script possible. What does your string look like? I have no idea. What does your function do? No clue, you didn't provide it. Edited February 7, 2020 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
remin Posted February 9, 2020 Author Share Posted February 9, 2020 On 2/8/2020 at 12:25 AM, jdelaney said: You will get better help if you provide something that runs and reproduces your issue. The smallest amount of script possible. What does your string look like? I have no idea. What does your function do? No clue, you didn't provide it. It captures the clipboard text, removes the formatting and paste it in the text. Please see the comments tags after the code in above function. Link to comment Share on other sites More sharing options...
remin Posted February 9, 2020 Author Share Posted February 9, 2020 On 2/7/2020 at 10:21 PM, Danp2 said: That sounds more like an issue with the program you are pasting into than the script. Have you tried the following -- ; send actual text instead of pasting it from the clipboard Send($sClip) Thanks for your answer. I tried this, but nothing changes. I don't understand what's going on. The script doesn't work anymore (without me changing anything). Link to comment Share on other sites More sharing options...
Nine Posted February 9, 2020 Share Posted February 9, 2020 Can you make a runable script that replicates your problem, so we can test it on our own system... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
remin Posted February 10, 2020 Author Share Posted February 10, 2020 (edited) 17 hours ago, Nine said: Can you make a runable script that replicates your problem, so we can test it on our own system... Please find in attachment the script.clipb_remove_formatting.au3 _Clipboard.au3 Edited February 10, 2020 by remin Link to comment Share on other sites More sharing options...
Danp2 Posted February 10, 2020 Share Posted February 10, 2020 Like I stated previously, I believe this behavior is controlled by the program in use when you paste the string. For example, I experience the exact same behavior you describe when testing with MS Word. However, I can add the following line to "reset" the formatting before the paste occurs -- Send("^{SPACE}{SPACE}") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
remin Posted February 10, 2020 Author Share Posted February 10, 2020 1 hour ago, Danp2 said: Like I stated previously, I believe this behavior is controlled by the program in use when you paste the string. For example, I experience the exact same behavior you describe when testing with MS Word. However, I can add the following line to "reset" the formatting before the paste occurs -- Send("^{SPACE}{SPACE}") Thanks. If the formatted text is underlined the pasted text will start with an empty underline character. Link to comment Share on other sites More sharing options...
Danp2 Posted February 10, 2020 Share Posted February 10, 2020 @remin That's not what I experienced when testing with Word. The "extra" space prevents Word from applying the formatting from the preceding text. What application are you using? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
remin Posted February 10, 2020 Author Share Posted February 10, 2020 1 minute ago, Danp2 said: @remin That's not what I experienced when testing with Word. The "extra" space prevents Word from applying the formatting from the preceding text. What application are you using? I tested with WordPad Link to comment Share on other sites More sharing options...
Danp2 Posted February 10, 2020 Share Posted February 10, 2020 Word uses the Ctrl+Space shortcut to clear formatting. Obviously, that doesn't work if Wordpad doesn't offer the same functionality. I've shown you an example to make your script work with Word. You haven't told us the actual program you are using, so I don't see how we can be of further assistance. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
remin Posted February 10, 2020 Author Share Posted February 10, 2020 3 hours ago, Danp2 said: Word uses the Ctrl+Space shortcut to clear formatting. Obviously, that doesn't work if Wordpad doesn't offer the same functionality. I've shown you an example to make your script work with Word. You haven't told us the actual program you are using, so I don't see how we can be of further assistance. Thank you. I use it in all programs. Never had any problem before. Yesterday I added sleep() before an after the send command and it worked again but not in Wordpad. Not a problem. Thank you for your help. Have a nice day. 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