//QM v2.9. Do not edit with text editor!!! //
7     2
‘=gÏFƒ£xžî§­w8„&WBëŠ"ùÛ{„¯Ÿþ
  Clipboard_copy @10 8 36DEE56A 0
 \Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

int action=wParam
UDTRIGGER& p=+lParam
 out action

sel action
	case 1 ;;Properties dialog init
	goto properties_dlg
	
	case 2 ;;Properties dialog OK
	p.tdata.getwintext(id(3 p.hwnd))
	p.tdata.escape(1); p.tdata-"''"; p.tdata+"''"
	
	case 3 ;;validate trigger string
	str s1(p.tdata) s2
	s1.trim(34); s1.escape(0)
	findrx "" s1 0 128 s2; err out _error.description; ret
	ret 1
	
	case 4 ;;apply all triggers
	int am=WM_APP
	int h=win("QM Clipboard Triggers" "#32770")
	if(!h) ;;launch trigger engine
		mac "clipboard_copy_triggers"
		opt waitmsg 1
		h=wait(30 WC win("QM Clipboard Triggers" "#32770"))
	else if(!p.niids) am+1
	SendMessage h am 0 &p ;;create table
	
	case 5 ;;icon
	ret GetFileIcon("$qm$\copy.ico")
	
	case 6 ;;help
	QmHelp "IDP_PCRE"
ret

 properties_dlg
str controls = "3"
str e3
e3=p.tdata
e3.trim(34); e3.escape(0)
ret ShowDialog("Clipboard_copy" &Clipboard_copy &controls p.hwnd 1 WS_CHILD)

 BEGIN DIALOG
 0 "" 0x10000040 0x0 0 0 227 151 ""
 4 Static 0x54000000 0x0 2 2 226 12 "Run when clipboard text matches this regular expression"
 3 Edit 0x54231044 0x200 2 14 226 66 ""
 5 Button 0x54032000 0x0 2 82 20 14 "RX"
 6 Static 0x54000000 0x0 0 130 228 22 ""
 END DIALOG
 DIALOG EDITOR: "" 0x2030009 "*" "" ""

ret
 messages
sel message
	case WM_INITDIALOG
	case WM_DESTROY
	case WM_COMMAND goto messages2
ret
 messages2
sel wParam
	case EN_CHANGE<<16|3 ;;show rx error
	s1.getwintext(id(3 hDlg))
	findrx "" s1 0 128 s2; err _s=_error.description
	_s.setwintext(id(6 hDlg))
	
	case 5 RegExpMenu id(3 hDlg)
ret 1

  clipboard_copy_triggers  40 36DEBC20 0
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

 hidden dialog
hDlg=ShowDialog("clipboard_copy_triggers" &clipboard_copy_triggers 0 0 1)
MessageLoop

 BEGIN DIALOG
 0 "" 0x80C80040 0x100 0 0 223 135 ""
 END DIALOG
 DIALOG EDITOR: "" 0x2030009 "*" "" ""

ret
 messages
sel message
	case WM_INITDIALOG
	int-- t_hwndnext t_started
	t_hwndnext=SetClipboardViewer(hDlg)
	t_started=1
	_s="QM Clipboard Triggers"; _s.setwintext(hDlg)
	SetTimer hDlg 23 1000 0
	
	case WM_APP
	CCT_table +lParam
	case WM_APP+1
	DestroyWindow hDlg
	
	case WM_DESTROY
	CCT_table
	ChangeClipboardChain hDlg t_hwndnext
	PostQuitMessage 0
	
	case WM_CHANGECBCHAIN
	if(wParam=t_hwndnext) t_hwndnext=lParam
	else if(t_hwndnext) SendMessage t_hwndnext message wParam lParam
	
	case WM_TIMER
	sel wParam
		case 23 ;;auto restore if another viewer did not remove itself correctly
		if(!GetClipboardViewer) t_hwndnext=SetClipboardViewer(hDlg)
	
	case WM_DRAWCLIPBOARD ;;clipboard contents changed
	if(!t_started) ret
	SendMessage t_hwndnext message wParam lParam
	CCT_event
	

  CCT_table  8 36DEB2A2 0
 /
function [UDTRIGGER&p]

type CCT_ITEM @iid ~rx
ARRAY(CCT_ITEM)+ __cct

if(!&p) __cct=0; ret
__cct.create(p.niids)
int i
for(i 0 __cct.len)
	CCT_ITEM& r=__cct[i]
	r.iid=p.iids[i]
	r.rx.getmacro(r.iid 2)
	r.rx.gett(r.rx 1 " " 2)
	r.rx.trim(34); r.rx.escape(0)
	
  CCT_event  8 36DD6977 0
str s.getclip; err ret
 out s

if(__cct.len=1) ;;!!rem
	_s.getmacro(__cct[0].iid 2); err
	if(!_s.len) __cct=0

int i
for(i 0 __cct.len)
	CCT_ITEM& r=__cct[i]
	if(dis(r.iid) or dis&16) continue
	if(findrx(s r.rx)>=0 or (!s.len and !r.rx.len))
		mac r.iid
	
err+

  CCT_protect @15 "clipboard_copy_triggers" 8 36DEBBC2 0
mes "This thread is used for clipboard copy triggers." "" "i"

  file  268501056 0

  