;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Clipboard.ico #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include _Singleton(StringReplace(@ScriptFullPath,'\','_')) TraySetIcon(@ScriptDir &'\Clipboard.ico') HotKeySet("^!{INSERT}",'openF') HotKeySet("!`",'ListClips') Dim $pathAutoItExe='c:\installs\Autoit3\AutoIt3.exe' Dim $pathNotepad='c:\installs\notepad++\notepad++.exe' If Not FileExists($pathAutoItExe) Then E($pathAutoItExe) If Not FileExists($pathNotepad) Then E($pathNotepad) Dim $pathMyDoc=@MyDocumentsDir If StringRight(@ScriptName,3)=='exe' And StringInStr(@ScriptFullPath,@UserProfileDir)==0 Then If Not FileExists($pathMyDoc) Then $pathMyDoc = RegRead('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','Personal') If FileExists($pathMyDoc) And FileCopy(@ScriptFullPath,$pathMyDoc,1) Then Sleep(1000) Run($pathMyDoc&'\'&@ScriptName,$pathMyDoc) EndIf Sleep(1000) Exit EndIf ;~ If StringRight(@ScriptName,3)=='exe' And StringInStr(@ScriptFullPath,@UserProfileDir) Then RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run','clipmon','REG_SZ','"'& $pathAutoItExe &' '& @ScriptFullPath &'"') Dim $a,$f=$pathMyDoc & '\clipmon_'&@UserName&'_'&@YEAR&'.txt',$b=StringRight(FileRead($f),102400),$c While 1 $c = ClipGet() If StringLen($c)>2 And StringInStr($a,$c)=0 And StringInStr($b,$c)=0 Then ;~ FileWriteLine($f,@YEAR &'-'& @MON &'-'& @MDAY &'_'& @HOUR &':'& @MIN &@LF& $c) IniWrite($f,@ComputerName &' '& @YEAR &'/'& @MON &'/'& @MDAY, @TAB& @HOUR &':'& @MIN &':'& @SEC,$c) ToolTip(StringLeft($c,100),Default,Default,'ClipMon') Sleep(2000) $b &= $c & @TAB $a = $c If StringLen($b) > 204800 Then $b = StringRight($b,102400) Else $a = $c EndIf Sleep(500) ToolTip('') WEnd Func ListClips() ;~ Return ShellExecute('notepad.exe') ;~ Local $f=@ScriptDir & '\clipmon_'&@UserName&'_'&@YEAR&'.txt',$b=StringRight(FileRead($f),102400) Local $a_clips = StringSplit($b,@LF,2) ;~ MsgBox(0,$f,StringLeft($b,100),'test ListClips') If IsArray($a_clips) Then _ArrayReverse($a_clips) ;~ _ArrayDisplay($a_clips,$f,"",16) _ArrayDisplay($a_clips,$f) EndIf EndFunc Func openF() Local $exe='wordpad.exe' If FileExists('C:\installs\notepad++\notepad++.exe') Then $exe='C:\installs\notepad++\notepad++.exe' ShellExecute($exe,$f,@ScriptDir) EndFunc Func E($s) MsgBox(64,@ScriptFullPath,$s) Exit -1 EndFunc Func quit() ToolTip('exit...') Sleep(2000) Exit EndFunc