能力不够,一句正则无法准确获取,只能用笨办法了.
也许问题还很多,见谅
最近很忙,除了工作的事情以外,还要看球.太累了
#include <array.au3>
$file = FileOpenDialog("GBK2Bin", @ScriptDir, "Au3 File(*.au3)")
If @error Then Exit
$SoureCode = FileRead($file)
$NeedChange = StringRegExp($SoureCode, "(['"&'"])([^\1]*?)\1', 4)
For $i=0 to UBound($NeedChange)-1
$temp=$NeedChange[$i]
If StringRegExp($temp,'[\x{4e00}-\x{9fa5}]',0) Then
$Bin=StringToBinary($temp)
$SoureCode=StringReplace($SoureCode,$temp,"BinaryToString('" & $Bin & "')", 1, 1)
EndIf
Next
;~ For $i = 0 To UBound($NeedChange) - 1
;~ $Bin = StringToBinary(StringRegExpReplace($NeedChange[$i], '^["' & "'](.*?[\x{4e00}-\x{9fa5}]+.*?)[" & '"' & "']$", "$1"))
;~ $SoureCode = StringReplace($SoureCode, $NeedChange[$i], "BinaryToString('" & $Bin & "')", 1, 1)
;~ Next
;~
Local $var = FileSaveDialog("另存为.", @ScriptDir, "AU3脚本 (*.au3)", 2)
If Not @error Then
If Not StringRegExp($var, '.+\.au3$', 0) Then $var = $var & ".au3"
$fileopen = FileOpen($var, 2)
FileWrite($fileopen, $SoureCode)
EndIf
回复 18# 3mile
谢谢大师,比之前要好,不过A版也写了个该工具,不报啥错的,力荐,再次感谢您!辛苦了
http://www.autoitx.com/thread-32868-1-1.html
页:
1
[2]