一応こんなの作ってみましたが、どうでしょうか?
'QGREPの検索語の直前に文字列を挿入
#comment
・QGREP.INIから自動的に最新の履歴を取得するので、検索終了後、検索結果
をQXで開いた状態で実行する。
・2行連結には対応していない。
#comment
const c$ = "◎" '挿入する文字列
proc main
dim ini$,case,regexp
dim s$,ss$,item$[10],i,case_sensitive,line,byte,top
if @hwnd = 0 then exit proc
'QGREPをQXと別のディレクトリにインストールしている場合は
'QGREP.INIをフルパスで指定する。(例)ini$ = "C:\QGREP\QGREP.INI"
ini$ = @@QxDirectory$+"\QGREP.INI"
if dir$(ini$) = "" then
call msgbox("QGREP.INIがありません。",MB_ICONINFORMATION)
exit proc
end if
s$ = getprofile$("search","string0",ini$) '最新の検索履歴を取得
if s$ = "" then
call msgbox("履歴がありません。",MB_ICONINFORMATION)
exit proc
end if
case = val(getprofile$("search","Case",ini$))
regexp = val(getprofile$("search","Regular",ini$))
i = 1
do while s$ <> ""
if instr(s$," ") = 0 then
ss$ = s$
s$ = ""
else
ss$ = left$(s$,instr(s$," ")-1)
s$ = mid$(s$,instr(s$," ")+1)
end if
if ss$ <> "and" and ss$ <> "or" and ss$ <> "not" \
and ss$ <> "(" and ss$ <> ")" then
item$[i++] = ss$
end if
loop
@@ReplaceStringMulti
case_sensitive = @@FindCaseSensitive
if case = 0 then
@@FindCaseSensitive = 1
else
@@FindCaseSensitive = 0
end if
i = 1
if regexp = 1 then
@@FindRegExp = 1:@@FindRegExp = -2
do while item$[i] <> ""
@@ReplaceStringMulti "\("+item$[i]+"\)",c$+"\1"
i++
loop
else
do while item$[i] <> ""
@@ReplaceStringMulti item$[i],c$+item$[i]
i++
loop
end if
@Redraw = 0:@UndoBlock = 1
line = @Line:byte = @BytePos:top = @TopLine
@MoveFileTop 'ファイルの先頭から実行
@ReplaceStringMultiExec 1
@Line = line:@BytePos = byte:@TopLine = top
@Redraw = 1:@UndoBlock = 0
@@FindCaseSensitive = case_sensitive
end proc |