回复 17# txm888
能力不够,一句正则无法准确获取,只能用笨办法了.
也许问题还很多,见谅
最近很忙,除了工作的事情以外,还要看球.太累了
#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[UBound($temp)-1],'[\x{4e00}-\x{9fa5}]',0) Then
$Bin=StringToBinary($temp[UBound($temp)-1])
$SoureCode=StringReplace($SoureCode,$temp[0],"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
|