参考になるかは不明ですが、大昔に作ったスクリプトです。
#uselib "user32"
#cfunc SetClipboardViewer "SetClipboardViewer" int //hwnd;return g_hNextWnd
#func OpenClipboard "OpenClipboard" int //hwnd
#cfunc GetClipboardData "GetClipboardData" int //(CF_TEXT);return hText
#func CloseClipboard "CloseClipboard" //NONE
#func ChangeClipboardChain "ChangeClipboardChain" int,int //hwnd,g_hNextWnd
#uselib "kernel32"
#cfunc GlobalLock "GlobalLock" int //hText;return pText
#func GlobalUnlock "GlobalUnlock" int //hText
#cfunc GlobalSize "GlobalSize" int //pText;return TextSize
g_hNextWnd=SetClipboardViewer(hwnd)
oncmd gosub *WM_DRAWCLIPBOARD,0x0308
onexit *exit
stop
*WM_DRAWCLIPBOARD
OpenClipboard hwnd
hText=GetClipboardData(1)//CF_TEXT
if hText !=0{
pText = GlobalLock(hText)
//mes GlobalSize(pText)
sdim string,GlobalSize(pText)+1
dupptr string,pText,GlobalSize(pText)+1,2
GlobalUnlock(hText)
}
title ""+strlen(string)+"文字"
CloseClipboard
return
*exit
ChangeClipboardChain hwnd,g_hNextWnd
end