应该是这样的,哈,本来想测试下有没有迷惑,来测试前些日子无聊写的反迷惑呢,结查大失所望呀,居然没有!
不过,也测试了下把Include包入的所有变量和函数,还原为#include形式,效果还不错,至少不用手工动一下,反出来的直接就可以运行。
#region
#AutoIt3Wrapper_icon=hai.ico
#AutoIt3Wrapper_Res_Comment=tryhi
#AutoIt3Wrapper_Res_Description=www.autobatch.org
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=大海
#AutoIt3Wrapper_Res_Field=CompanyName|余秋海
#endregion
#include <GUIConstantsEx.au3>
#include <Array.au3>
#region ### START Koda GUI section ### Form=
$FORM1_1 = GUICreate("数据统计 我爱洁儿2.0", 0x000001A1, 0x0000026D, 0x00000150, 0x00000007)
$EDIT1 = GUICtrlCreateEdit("", 0x0000000C, 0x0000000C, 0x0000018F, 0x0000022C)
GUICtrlSetData(-0x00000001, "")
$BUTTONT = GUICtrlCreateButton("统一格式", 0x0000000D, 0x00000243, 0x0000004B, 0x00000019)
$BUTTONP = GUICtrlCreateButton("排序", 0x00000061, 0x00000243, 0x0000004B, 0x00000019)
$BUTTOND = GUICtrlCreateButton("单位转换", 0x000000B6, 0x00000243, 0x0000004B, 0x00000019)
$BUTTONF = GUICtrlCreateButton("分类汇总", 0x0000010A, 0x00000243, 0x0000004B, 0x00000019)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 0x00000001
$NMSG = GUIGetMsg()
Switch $NMSG
Case $GUI_EVENT_CLOSE
Exit
Case $BUTTONT
HUISE()
$A = GUICtrlRead($EDIT1)
$A = StringReplace($A, "-", " ")
$A = StringRegExpReplace($A, "(?m)^([^ ]+)(22)", "\1 \2 ")
$A = StringRegExpReplace($A, "(?m)^([^ ]+[\x41-\x80])(\d.+? )", "\1 \2")
$A = StringRegExpReplace($A, "(?m)^\s+", "")
$A = StringRegExpReplace($A, "( +)(?= )", "")
$A = StringRegExpReplace($A, "(?<= )( +)", "")
$A = StringRegExpReplace($A, " +", " ")
$A = StringUpper($A)
$ARRAY = StringRegExp($A, "\V+", 0x00000003)
For $I = 0x00000000 To UBound($ARRAY) - 0x00000002
For $J = $I + 0x00000001 To UBound($ARRAY) - 0x00000001
$TEMS = StringSplit($ARRAY[$I], " ")
$TEMS2 = StringSplit($ARRAY[$J], " ")
$XINI = StringReplace($TEMS[0x00000001], " ", "")
$XINJ = StringReplace($TEMS2[0x00000001], " ", "")
If $XINI = $XINJ Then
If StringLen($TEMS[0x00000001]) > StringLen($TEMS2[0x00000001]) Then
$ARRAY[$J] = StringReplace($ARRAY[$J], $TEMS2[0x00000001], $TEMS[0x00000001])
ElseIf StringLen($TEMS[0x00000001]) < StringLen($TEMS2[0x00000001]) Then
$ARRAY[$I] = StringReplace($ARRAY[$I], $TEMS[0x00000001], $TEMS2[0x00000001])
EndIf
EndIf
Next
Next
For $I = 0x00000000 To UBound($ARRAY) - 0x00000002
For $J = $I + 0x00000001 To UBound($ARRAY) - 0x00000001
$TEMS = StringRegExp($ARRAY[$I], "^([^ ]+) \S+ ", 0x00000003)
If @error Then ContinueLoop
$TEMS2 = StringRegExp($ARRAY[$J], "^([^ ]+) \S+ ", 0x00000003)
If @error Then ContinueLoop
$XINI = StringReplace($TEMS[0x00000000], " ", "")
$XINJ = StringReplace($TEMS2[0x00000000], " ", "")
If $XINI = $XINJ Then
If StringLen($TEMS[0x00000000]) > StringLen($TEMS2[0x00000000]) Then
$ARRAY[$J] = StringReplace($ARRAY[$J], $TEMS2[0x00000000], $TEMS[0x00000000])
ElseIf StringLen($TEMS[0x00000000]) < StringLen($TEMS2[0x00000000]) Then
$ARRAY[$I] = StringReplace($ARRAY[$I], $TEMS[0x00000000], $TEMS2[0x00000000])
EndIf
EndIf
Next
Next
$A = ""
For $I = 0x00000000 To UBound($ARRAY) - 0x00000001
$A &= $ARRAY[$I] & @CRLF
Next
GUICtrlSetData($EDIT1, $A)
BAISE()
MsgBox(0x00000000, "完成", "统一格式完成")
Case $BUTTONP
HUISE()
$A = GUICtrlRead($EDIT1)
$ARRAY = StringRegExp($A, "\V+", 0x00000003)
_ARRAYSORTS($ARRAY)
$A = ""
For $I = 0x00000000 To UBound($ARRAY) - 0x00000001
$A &= $ARRAY[$I] & @CRLF
Next
GUICtrlSetData($EDIT1, $A)
BAISE()
MsgBox(0x00000000, "完成", "排序完成")
Case $BUTTOND
HUISE()
$A = GUICtrlRead($EDIT1)
$ARRAY = StringRegExp($A, "\V+", 0x00000003)
Global $ARRAY2[UBound($ARRAY)][0x00000004]
For $I = 0x00000000 To UBound($ARRAY) - 0x00000001
$TEM = StringSplit($ARRAY[$I], " ")
For $J = 0x00000000 To 0x00000003
$ARRAY2[$I][$J] = $TEM[$J + 0x00000001]
Next
Switch $ARRAY2[$I][0x00000001]
Case "千米"
$ARRAY2[$I][0x00000001] = "米"
$ARRAY2[$I][0x00000002] = Number($ARRAY2[$I][0x00000002]) * 0x000003E8
Case "扎"
$ARRAY2[$I][0x00000001] = "米"
$ARRAY2[$I][0x00000002] = Number($ARRAY2[$I][0x00000002]) * 0x00000064
Case "箱"
$ARRAY2[$I][0x00000001] = "米"
$ARRAY2[$I][0x00000002] = Number($ARRAY2[$I][0x00000002]) * 0x0000016D
Case "米"
Case Else
MsgBox(0x00000000, "有问题", "存在部分单位无法识别:" & $ARRAY2[$I][0x00000001], 0x00000001)
EndSwitch
Next
For $K = 0x00000000 To UBound($ARRAY) - 0x00000001
$SPLIT = StringSplit($ARRAY2[$K][0x00000000], " ")
$ISNUM = StringRegExp($SPLIT[$SPLIT[0x00000000]], "^[\d.]+$")
If $ISNUM Then
If Number($SPLIT[$SPLIT[0x00000000]]) <= 0x00000023 Then
$ARRAY2[$K][0x00000001] = "扎"
$ARRAY2[$K][0x00000002] /= 0x00000064
EndIf
EndIf
Next
$A = ""
For $I = 0x00000000 To UBound($ARRAY) - 0x00000001
For $J = 0x00000000 To 0x00000003
$A &= $ARRAY2[$I][$J] & " "
Next
$A &= @CRLF
Next
GUICtrlSetData($EDIT1, $A)
BAISE()
MsgBox(0x00000000, "完成", "单位转换完成")
Case $BUTTONF
Global $HUIZONG[0x00000001][0x00000004]
$TM = 0x00000000
For $I = 0x00000000 To UBound($ARRAY2) - 0x00000001
If $ARRAY2[$I][0x00000000] = $HUIZONG[$TM][0x00000000] Then
$HUIZONG[$TM][0x00000002] += $ARRAY2[$I][0x00000002]
$HUIZONG[$TM][0x00000003] += $ARRAY2[$I][0x00000003]
Else
ReDim $HUIZONG[UBound($HUIZONG) + 0x00000001][0x00000004]
$TM += 0x00000001
For $II = 0x00000000 To 0x00000003
$HUIZONG[$TM][$II] = $ARRAY2[$I][$II]
Next
EndIf
Next
$A = ""
For $I = 0x00000001 To UBound($HUIZONG) - 0x00000001
For $J = 0x00000000 To 0x00000003
$A &= $HUIZONG[$I][$J] & " "
Next
$A &= @CRLF
Next
GUICtrlSetData($EDIT1, $A)
EndSwitch
WEnd
Func _ARRAYSORTS(ByRef $ARRAY)
For $I = 0x00000000 To UBound($ARRAY) - 0x00000002
For $J = $I + 0x00000001 To UBound($ARRAY) - 0x00000001
$FENI = StringRegExp($ARRAY[$I], "[^\d\.]+|[\d\.]+", 0x00000003)
$FENJ = StringRegExp($ARRAY[$J], "[^\d\.]+|[\d\.]+", 0x00000003)
$FEN = UBound($FENI)
If UBound($FENI) < UBound($FENJ) Then $FEN = UBound($FENJ)
For $K = 0x00000000 To $FEN - 0x00000001
If $K > UBound($FENJ) - 0x00000001 Then
JIAOHUAN($ARRAY[$I], $ARRAY[$J])
ExitLoop
ElseIf $K > UBound($FENI) - 0x00000001 Then
ExitLoop
EndIf
If StringRegExp($FENI[$K], "[^\d\.]+") Then
If StringRegExp($FENJ[$K], "[\d\.]+") Then
JIAOHUAN($ARRAY[$I], $ARRAY[$J])
ExitLoop
Else
If StringCompare($FENI[$K], $FENJ[$K]) = 0x00000001 Then
JIAOHUAN($ARRAY[$I], $ARRAY[$J])
ExitLoop
Else
If StringCompare($FENI[$K], $FENJ[$K]) = 0x00000000 Then ContinueLoop
EndIf
ExitLoop
EndIf
Else
$ISNUM = StringRegExp($FENJ[$K], "[\d\.]+")
If $ISNUM And (Number($FENI[$K]) > Number($FENJ[$K])) Then
JIAOHUAN($ARRAY[$I], $ARRAY[$J])
ExitLoop
Else
If $ISNUM And (Number($FENI[$K]) = Number($FENJ[$K])) Then ContinueLoop
EndIf
ExitLoop
EndIf
Next
Next
Next
EndFunc ;==>_ARRAYSORTS
Func JIAOHUAN(ByRef $A, ByRef $B)
Local $TEMP
$TEMP = $A
$A = $B
$B = $TEMP
EndFunc ;==>JIAOHUAN
Func BAISE()
GUICtrlSetState($BUTTOND, 0x00000040)
GUICtrlSetState($BUTTONF, 0x00000040)
GUICtrlSetState($BUTTONP, 0x00000040)
GUICtrlSetState($BUTTONT, 0x00000040)
EndFunc ;==>BAISE
Func HUISE()
GUICtrlSetState($BUTTOND, 0x00000080)
GUICtrlSetState($BUTTONF, 0x00000080)
GUICtrlSetState($BUTTONP, 0x00000080)
GUICtrlSetState($BUTTONT, 0x00000080)
EndFunc ;==>HUISE
|