如何删除重复 [英] How to remove duplicate

查看:73
本文介绍了如何删除重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我用这段代码自动将另一个应用程序的数据打印到记事本:





I used this code to print data from another application to notepad automatically:

IntPtr h = p.MainWindowHandle;
SetForegroundWindow(h);                                       
SendKeys.SendWait(Clipboard.GetText(TextDataFormat.Text));
Clipboard.Clear();





它在第一次尝试时工作正常,但它为下次尝试添加了重复值。



我尝试过的事情:



这是我得到的发送键:



1次尝试

13.00

第二次尝试

223.00但是它必须打印23.00



it works fine for the first attempt but it adds duplicate value for the next attempt.

What I have tried:

this is what i get from the sendkeys:

1 attempt
13.00
2nd atttempt
223.00 but it has to print 23.00

推荐答案

尝试:

Try:
IntPtr h = p.MainWindowHandle;
SetForegroundWindow(h);                                       
SendKeys.SendWait("^a{DEL}^v");
Clipboard.Clear();



这应该选择窗口中的所有文本( ^ a = Ctrl + a ),删除它( {DEL} = 删除),然后粘贴剪贴板的内容( ^ v = Ctrl + v )。


That should select all text in the window (^a = Ctrl+a), delete it ({DEL} = Delete), and then paste the contents of the clipboard (^v = Ctrl+v).


这篇关于如何删除重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆