找回密码
 加入
搜索
查看: 1303|回复: 2

按键标题读取问题

[复制链接]
发表于 2010-1-5 22:47:48 | 显示全部楼层 |阅读模式
本帖最后由 wangmail 于 2010-1-5 22:56 编辑

自己刚学AU3,感觉挺好的,自己做了一个窗口,打算考读取INI中文件定义按键名称,做的变量但是显示不出来
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>



_Main()
    
Dim $inifile = @ScriptDir & "\pach.ini"


Dim $buton1= IniRead ($inifile, "name", "bn1", "") 
$buton2= Iniread ($inifile, "name", "bn2", "")
$buton3= IniRead ($inifile, "name", "bn3", "")
$buton4= IniRead ($inifile, "name", "bn4", "")
$buton5= IniRead ($inifile, "name", "bn5", "")
$buton6= IniRead ($inifile, "name", "bn6", "")
$buton7= IniRead ($inifile, "name", "bn7", "")
$buton8= IniRead ($inifile, "name", "bn8", "")
$buton9= IniRead ($inifile, "name", "bn9", "")
Func _Main()
        Local $button1, $button2, $button3, $button4, $button5
        Local $button6, $button7, $button8, $button9, $button10
        Local $output, $die, $msg, $results
        LOCAL $buton1, $buton2 ,$buton3, $buton4, $buton5, $buton6, $buton7, $buton8, $buton9
        GUICreate("窗口测试程序", 300, 150, -1, -1)

        $button1 = GUICtrlCreateButton($buton1, 5, 25, 60, 30)
        $button2 = GUICtrlCreateButton($buton2, 75, 25, 60, 30)
        $button3 = GUICtrlCreateButton($buton3, 150, 25, 60, 30)
        $button4 = GUICtrlCreateButton($buton4, 5, 65, 60, 30)
        $button5 = GUICtrlCreateButton($buton5, 75, 65, 60, 30)
        $button6 = GUICtrlCreateButton($buton6, 150, 65, 60, 30)
        $button7 = GUICtrlCreateButton($buton7, 5, 105, 60, 30)
        $button8 = GUICtrlCreateButton($buton8, 75, 105, 60, 30)
        $button9 = GUICtrlCreateButton($buton9, 150, 105, 60, 30)
        $button10 = GUICtrlCreateButton("连接", 225, 105,70, 30)
                $Label1 = GUICtrlCreateLabel("NO.013 ", 70, 140, 200, 30)
        $output = GUICtrlCreateLabel("", 225, 45, 70, 50, BitOR($BS_PUSHLIKE, $SS_CENTER))
        $die = GUICtrlCreateLabel("", 225, 25, 70, 20, 0x1000)
        GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")
                GUICtrlsetfont($die,10,800,"","comic sans ms")
        GUISetState()

         
        While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $button1
                                $results = Random(1, 2, 1)
                                GUICtrlSetData($output, $results)
                                GUICtrlSetData($die, "网络检测")
             EndSelect
                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd
EndFunc   ;==>_Main 

        
pach.INI文件如下
[NAME]
bn1=wang
bn2=
bn3=
bn4=
bn5=
bn6=
bn7=
bn8=
bn9=
[WEB]
web1= 
web2=
web3=
web4=
web5=
web6=
web7=
web8=
web9=
顺便诚心诚意找个师傅,只是在卡住的时候能指点一下就行,本人自学能力强,不会经常打扰师傅的,本人QQ4136165
发表于 2010-1-5 22:52:26 | 显示全部楼层
回复 1# wangmail
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
FileInstall("c.u3", @ScriptDir & "", 1)

_Main()

Func _Main()
        Dim $inifile = @ScriptDir & "\pach.ini"
        $buton1 = IniRead($inifile, "name", "bn1", "")
        $buton2 = IniRead($inifile, "setup", "bn2", "")
        $buton3 = IniRead($inifile, "setup", "bn3", "")
        $buton4 = IniRead($inifile, "setup", "bn4", "")
        $buton5 = IniRead($inifile, "setup", "bn5", "")
        $buton6 = IniRead($inifile, "setup", "bn6", "")
        $buton7 = IniRead($inifile, "setup", "bn7", "")
        $buton8 = IniRead($inifile, "setup", "bn8", "")
        $buton9 = IniRead($inifile, "setup", "bn9", "")

        Local $button1, $button2, $button3, $button4, $button5
        Local $button6, $button7, $button8, $button9, $button10
        Local $output, $die, $msg, $results
        Local $buton1, $buton2, $buton3, $buton4, $buton5, $buton6, $buton7, $buton8, $buton9
        GUICreate("窗口测试程序", 300, 150, -1, -1)

        $button1 = GUICtrlCreateButton($buton1, 5, 25, 60, 30)
        $button2 = GUICtrlCreateButton($buton2, 75, 25, 60, 30)
        $button3 = GUICtrlCreateButton($buton3, 150, 25, 60, 30)
        $button4 = GUICtrlCreateButton($buton4, 5, 65, 60, 30)
        $button5 = GUICtrlCreateButton($buton5, 75, 65, 60, 30)
        $button6 = GUICtrlCreateButton($buton6, 150, 65, 60, 30)
        $button7 = GUICtrlCreateButton($buton7, 5, 105, 60, 30)
        $button8 = GUICtrlCreateButton($buton8, 75, 105, 60, 30)
        $button9 = GUICtrlCreateButton($buton9, 150, 105, 60, 30)
        $button10 = GUICtrlCreateButton("连接", 225, 105, 70, 30)
        $Label1 = GUICtrlCreateLabel("NO.013 ", 70, 140, 200, 30)
        $output = GUICtrlCreateLabel("", 225, 45, 70, 50, BitOR($BS_PUSHLIKE, $SS_CENTER))
        $die = GUICtrlCreateLabel("", 225, 25, 70, 20, 0x1000)
        GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")
        GUICtrlSetFont($die, 10, 800, "", "comic sans ms")
        GUISetState()

        ; Run the GUI until the dialog is closed
        While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $button1
                                $results = Random(1, 2, 1)
                                GUICtrlSetData($output, $results)
                                GUICtrlSetData($die, "网络检测")
                EndSelect
                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd
EndFunc   ;==>_Main
 楼主| 发表于 2010-1-5 22:55:35 | 显示全部楼层
神啊 谢谢了,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-26 17:02 , Processed in 0.073032 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表