AutoIt3(au3)源码-字符转换工具

tech2022-11-05  128

;没有设置错误陷阱,仿牛族字符转换.因为牛族老是被金山灭掉,所以就自己仿了个.功能简单只是Ascii与char的互转而已. ;#Region**** 参数创建于 ACNWrapper_GUI **** #AutoIt3Wrapper_OutFile=字符转换.exe #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** 参数创建于 ACNWrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <array.au3> #Region ### START Koda GUI section ### Form=d:\程\字符转换\字符转换.kxf $Form1_1 = GUICreate("字符转换", 623, 538, 192, 114, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME)) $Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 225);ID=3 ;GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Ascii to Char ↓", 88, 248, 113, 41, $BS_MULTILINE);ID=4 $Edit2 = GUICtrlCreateEdit("", 8, 304, 601, 225);ID=5 ;GUICtrlSetData(-1, "Edit2") $Button2 = GUICtrlCreateButton("清空", 368, 248, 105, 41);ID=6 $Button4 = GUICtrlCreateButton("退出", 504, 248, 105, 41);ID=7 $Button3 = GUICtrlCreateButton("Char to Ascii ↑", 224, 248, 113, 41);ID=8 $Label1 = GUICtrlCreateLabel("分隔符:", 24, 248, 43, 17);ID=9 $Input1 = GUICtrlCreateInput("", 16, 264, 57, 21);ID=10 分隔符 GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1;Ascii to Char $NumOfLine = "";存储输入的数据 $string = "";输出 $splitflag = GUICtrlRead(10, 0) For $x = 0 To _GUICtrlEdit_GetLineCount(3) - 1 $NumOfLine = _GUICtrlEdit_GetLine(3, $x) $array = StringSplit($NumOfLine, $splitflag, 1);此时$NumOfLine[0]=数组元素的总数, _ArrayDelete($array, 0);所以用_ArrayDelete函数将$NumOfLine[0]的值删除 _ArrayAdd($array, "13") ;为实现换行,添加一个换行符至$array数组末尾. For $a In $array If $a <> "" Then If $a <> "13" Then $string = $string & Chr($a) Else $string = $string & @CRLF EndIf EndIf GUICtrlSetData(5, $string) Next Next Case $Button2;清空 GUICtrlSetData(3, "") GUICtrlSetData(5, "") GUICtrlSetData(10, "") Case $Button3;Char to Ascii $string = "" $NumOfLine = "" For $x = 0 To _GUICtrlEdit_GetLineCount(5) $NumOfLine = StringStripWS(StringStripCR(_GUICtrlEdit_GetLine(5, $x)), 8) For $a = 1 To StringLen($NumOfLine) $string = $string & Asc(StringMid($NumOfLine, $a)) & " " Next $string = $string & @CRLF GUICtrlSetData(3, $string) Next Case $Button4;退出 Exit EndSwitch WEnd
最新回复(0)