ap4119 发表于 2009-12-23 02:56:54

input中的BS鍵

請問1這段代碼如何讓BACK鍵可對INPUT1鍵SEND返回鍵用好久搞不定
2如何用窗口托放選取CASE $Button19寫入的檔案…謝謝


#include <GUIConstants.au3>
#include <file.au3>
#NoTrayIcon
#include "misc.au3"

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("強", 285, 681, 428, 22)
$Button1 = GUICtrlCreateButton("1", 32, 384, 51, 25, 0)
$Input1 = GUICtrlCreateInput("", 32, 592, 150, 30)
$Input=GUICtrlSetFont(-1, 15, 1000, "")

$Button2 = GUICtrlCreateButton("2", 88, 384, 51, 25, 0)
$Button3 = GUICtrlCreateButton("3", 144, 384, 51, 25, 0)
$Button4 = GUICtrlCreateButton("4", 200, 384, 51, 25, 0)
$Button5 = GUICtrlCreateButton("5", 32, 416, 51, 25, 0)
$Button6 = GUICtrlCreateButton("6", 88, 416, 51, 25, 0)
$Button7 = GUICtrlCreateButton("7", 144, 416, 51, 25, 0)
$Button8 = GUICtrlCreateButton("8", 200, 416, 51, 25, 0)
$Button9 = GUICtrlCreateButton("9", 32, 448, 51, 25, 0)
$Button10 = GUICtrlCreateButton("A", 32, 488, 51, 25, 0)
$Button11 = GUICtrlCreateButton("B", 88, 488, 51, 25, 0)
$Button12 = GUICtrlCreateButton("C", 144, 488, 51, 25, 0)
$Button13 = GUICtrlCreateButton("D", 32, 520, 51, 25, 0)
$Button14 = GUICtrlCreateButton("E", 88, 520, 51, 25, 0)
$Button15 = GUICtrlCreateButton("F", 144, 520, 51, 25, 0)
$Button16 = GUICtrlCreateButton("0", 32, 352, 51, 25, 0)
$Button17 = GUICtrlCreateButton("BACK", 180, 592, 51, 25, 0)

$Button18 = GUICtrlCreateButton("讀取MAC", 32, 624, 59, 25, 0)
$Button19 = GUICtrlCreateButton("寫入", 104, 624, 67, 25, 0)
$Group1 = GUICtrlCreateGroup("小鍵盤", 16, 328, 257, 241)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input3 = GUICtrlCreateInput("待開發", 16, 264, 121, 21)
$Button23 = GUICtrlCreateButton("。。", 144, 264, 35, 25, 0)



$Button20 = GUICtrlCreateButton("槍查版本", 216, 168, 75, 41, 0)
$Button21 = GUICtrlCreateButton("BRINGE", 216, 112, 83, 41, 0)
$Group2 = GUICtrlCreateGroup("檢查", 184, 88, 105, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input2 = GUICtrlCreateInput("ated", 32, 120, 121, 21)
$Button22 = GUICtrlCreateButton("QA", 32, 168, 123, 41, 0)
$Group3 = GUICtrlCreateGroup("QA", 16, 88, 161, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Edit1 = GUICtrlCreateEdit("", 16, 16, 249, 65)
GUICtrlSetData(-1, "燒完先檢查MODE在檢查版本")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg                               
               
                Case $GUI_EVENT_CLOSE
                        Exit
                        case $Button18
                        $sIP =(@IPAddress1)
       $sIP="10.10.10.254"
       ;$sIP="192.168.1.100"
$MAC = _GetMAC ($sIP)
If $MAC <> "00:00:00:00:00:00" Then

$MAC = GUICtrlSetData($Input1,$MAC)

$MAC=GUICtrlSetFont(-1, 15, 1000, "")
EndIf
case $Button19
       _FileCreate("E:\2341燒分位&MAC用\address")
$a=GUICtrlRead($Input1)

FileWrite("E:\2341燒分位&MAC用\address",$a)                       
                case $Button16
                        GUICtrlSetData($Input1,"0","$Input1")
                case $Button1
                        GUICtrlSetData($Input1,"1","$Input1")
                case $Button2
                        GUICtrlSetData($Input1,"2","$Input1")
                case $Button3
                        GUICtrlSetData($Input1,"3","$Input1")
                case $Button4
                        GUICtrlSetData($Input1,"4","$Input1")
                case $Button5
                        GUICtrlSetData($Input1,"5","$Input1")
                case $Button6
                        GUICtrlSetData($Input1,"6","$Input1")
                case $Button7
                        GUICtrlSetData($Input1,"7","$Input1")
                case $Button8
                        GUICtrlSetData($Input1,"8","$Input1")
                case $Button9
                        GUICtrlSetData($Input1,"9","$Input1")
                case $Button10
                       
                       
GUICtrlSetData($Input1,"A","$Input1")
                case $Button11
                        GUICtrlSetData($Input1,"B","$Input1")
                case $Button12
                        GUICtrlSetData($Input1,"C","$Input1")
                case $Button13
                        GUICtrlSetData($Input1,"D","$Input1")
                case $Button14
                        GUICtrlSetData($Input1,"E","$Input1")
                case $Button15
                        GUICtrlSetData($Input1,"F","$Input1")
                case $Button17
                        Send("")
                        ;$a = ControlGetFocus("強")






                       
                                ;send("{BS}")
               
                        Opt("MouseCoordMode", 0)
            ;MouseMove(175,600)
            ;MouseClick("left")
            send("{BACKSPACE}")
                        ;GUICtrlSetOnEvent ($Input1 , "{BACKSPACE}" )

                       

;========================================================================
          CASE $Button20
                          Opt("MouseCoordMode", 2)
MouseMove(350,200)
MouseClick("left")
send("{tab}")
send("{tab}")
send("{tab}")
send("{tab}")
send("{enter}")
         CASE $Button21
                          Opt("MouseCoordMode", 2)
MouseMove(350,140)
MouseClick("left")
case $Button22
        RUN("E:\QA_RT2880_V1_4_0_8\RT2880QA.exe")
                        WinWaitActive("RT2880 QA")
                        SEND("{PGDN}")
ControlClick("RT2880 QA","OK","Button1")
         

                        EndSwitch
WEnd





Func _GetMAC ($sIP)
Local $MAC;,$MACSize
Local $i,$s,$r,$iIP

$MAC = DllStructCreate("byte")
$MACSize = DllStructCreate("int")

DllStructSetData($MACSize,1,6)
$r = DllCall ("Ws2_32.dll", "int", "inet_addr", "str", $sIP)
$iIP = $r
$r = DllCall ("iphlpapi.dll", "int", "SendARP","int", $iIP,"int", 0,"ptr", DllStructGetPtr($MAC),"ptr", DllStructGetPtr($MACSize))
$s    = ""
For $i = 0 To 5
      If $i Then $s = $s & ""
      $s = $s & Hex(DllStructGetData($MAC,1,$i+1),2)
          
Next
Return $s
EndFunc

ap4119 发表于 2009-12-28 23:41:36

沒人理偶= =

sanmoking 发表于 2009-12-31 18:13:33

請問1這段代碼如何讓BACK鍵可對INPUT1鍵SEND返回鍵用好久搞不定
2如何用窗口托放選取CASE $Button19寫入的檔案…謝謝

楼主口语化的表达跟中华人民共和国标准普通话有点差别,看了两遍没看明白。。。。。

ap4119 发表于 2010-1-1 02:53:47

1.请问1这段代码如何让$Button17 键对INPUT1產生一個{"backspace"}指令
2.FileWrite后面如何用窗口托放选取要写入的档案
不好意思我是台灣來的朋友= =

sanmoking 发表于 2010-1-2 02:04:44

本帖最后由 sanmoking 于 2010-1-2 02:09 编辑

1.请问1这段代码如何让$Button17 键对INPUT1產生一個{"backspace"}指令
2.FileWrite后面如何用窗口托放选取 ...
ap4119 发表于 2010-1-1 02:53 http://www.autoitx.com/images/common/back.gif


    #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 515, 78, 192, 124, -1, 0x00000018) ;0x00000010使创建的窗体可接受文件拖放,0x00000008使创建的窗体位于顶层显示
$Input1 = GUICtrlCreateInput("Input1234567901234567890", 10, 15, 430, 21)
$Button1 = GUICtrlCreateButton("backspace", 440, 15, 70, 21, $WS_GROUP)
$Input2 = GUICtrlCreateInput("drag drop file", 10, 40, 430, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ;使$Input2可接受文件拖放
$Button2 = GUICtrlCreateButton("filewrite", 440, 40, 70, 21, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        GUICtrlSetData($Input1, StringTrimRight(GUICtrlRead($Input1), 1)) ;删除$Input1中最后一个字符
;~                     GUICtrlSetData($Input1,"")   ;删除$Input1中全部字符
                        ControlFocus ($Form1, "",$Input1) ;使输入焦点回到$Input1,因为点击$Button1的时候焦点会到$Button1上面
                Case $Button2
                        if StringRight(GUICtrlRead($Input2), 4) = ".txt" Then
                              MsgBox(4096, "drag drop file", GUICtrlRead($Input2) & @CR _
                              & "-----------------" & @CR & GUICtrlRead($Input1))
                              FileWrite(GUICtrlRead($Input2), GUICtrlRead($Input1))
                        Else
                              MsgBox(4096, "drag drop file", "只允许拖放txt文件。")
                        EndIf
                Case $GUI_EVENT_DROPPED
                        GUICtrlSetData($Input2, @GUI_DRAGFILE)
      EndSwitch
WEnd

ap4119 发表于 2010-1-3 00:16:17

真是太感謝了搞定了多謝大大幫忙
页: [1]
查看完整版本: input中的BS鍵