Page 1 of 1

Blockfile 写入和读取遇到的一些问题及临时解决方法

Posted: Jan 08 2019, 13:05
by ttttaaaa
例如:

Code: Select all

("userid":([0-9]+{1,9})\2,*,"user_name":"([^"]+)\3")\1(^$TST((\2)=$LST(listname)))$ADDLSTBOX(listname, List, $WESC(##\3\n\2))
直接使用 \3\n\2 会造成 Blockfile 无法即时更新,导致前面的 $TST() 失效从而反复写入同样内容。重载列表也无效,除非重启 prox 或重载 !!!config!!!。

解决办法是分成两次来写。两次写入是同时的所以第二个直接用 $ADDLST() 即可。
为了避免分开写 username 的最后一个字符编码出现缺漏问题需要在 \3 后面随便多加个字符(比如#)

Code: Select all

$ADDLSTBOX(listname, $WESC(##\3#))$ADDLST(VGIdiots, \2)
也可以用 proxomitron 的隐藏命令 $EXEC() 调用其他程序来完成。
http://search.lores.eu/proxomitron_powerusing.htm wrote: 1. The syntax is: $EXEC(filename.ext).
2. It is working with every extension which is executable by windows.
3. It is working with extensions associated with programs ( so Faultlog.txt
opens in notepad ).
4. Folders opened by explorer ( escaped backslashes! ).
5. In its path-walk the first is Proxomitron's own directory, then the regular
check.
将需要执行的文件或脚本放入 proxo 所在目录即可。

例如,以指定编码查看过滤列表指定行:

Code: Select all

$EXEC(ReadSpecificLine.ahk)
From: https://autohotkey.com/board/topic/9240 ... e-updates/

Code: Select all

FileRead, AllLines, *P65001 listname   ; Read ALL lines into AllLines in UTF-8[*P65001]
StringGetPos, LastLineNr, AllLines,`n, R2, ; Get position of last line[R2 to avoid last blank line]
StringTrimLeft, LastLine, AllLines, %LastLineNr% ; Remove everything before last line
StringReplace, LastLine, LastLine, `n ; Remove line break
MsgBox, %LastLine%
例如,将过滤内容显示到警告窗口再用脚本获取($EXEC() 好像不支持传递参数)

Code: Select all

("userid":([0-9]+{1,9})\2,*,"user_name":"([^"]+)\3")\1(^$TST((\2)=$LST(listname)))$EXEC(Addtofile.ahk)$ALERT($WESC(##\3)\n\2)
Addtofile.ahk 内容:

Code: Select all

WinWait, The Proxomitron Says...
ControlGetText, Text, Static2
MsgBox, 4,, 是否新增名单?
IfMsgBox Yes
{
	FileAppend,
	(
	`n%Text%
	), listname
}
else
{
	SplashTextOn,,25, title, 取消
	Sleep 1000
	SplashTextOff
}