找回密码
 加入
搜索
查看: 5331|回复: 12

[AU3基础] 大家帮帮忙 业主资料查询

  [复制链接]
发表于 2014-2-25 20:44:27 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\xp\my documents\form1.kxf
$Form1_1 = GUICreate("业主资料查询", 219, 156, 273, 446)
$Input1 = GUICtrlCreateInput("", 16, 32, 121, 21)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label1 = GUICtrlCreateLabel("请输入:", 16, 8, 52, 17)
$Button1 = GUICtrlCreateButton("搜索", 152, 32, 50, 25)
$Edit1 = GUICtrlCreateEdit("", 16, 72, 185, 45)
GUICtrlSetData(-1, "张小龙 钟小华 钟小明")
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###[/code]读取 C:\DOCUME~1\ADMINI~1\LOCALS~\Temp\myfile.ini

读取【字段名】等于输入的号码则在$Edit1文本框中显示A的值,也就是业主姓名
 楼主| 发表于 2014-2-25 20:45:29 | 显示全部楼层
我是新手,大家可以帮帮忙么?
 楼主| 发表于 2014-2-25 20:47:51 | 显示全部楼层
myfile.ini配置文件
[32191101]
a=徐小明

[32191102]
a=韩婆 韩海

[32191103]
a=梁凤

[32191104]
a=郭明 张芳

[32191201]
a=胡冰王

[32191202]
a=何明霞 胡宇宇

[32191203]
a=叶平平
发表于 2014-2-26 12:39:46 | 显示全部楼层
本帖最后由 xms77 于 2014-2-26 12:49 编辑

楼主你的ini文件好像应该这样写:
[a]
32191101=徐小明
32191102=韩婆 韩海
32191103=梁凤

代码如下:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\xp\my documents\form1.kxf
$Form1_1 = GUICreate("业主资料查询", 250, 180, 273, 446)
$Input1 = GUICtrlCreateInput("", 16, 32, 121, 21)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label1 = GUICtrlCreateLabel("请输入:", 16, 8, 52, 17)
$Button1 = GUICtrlCreateButton("搜索", 152, 32, 50, 25)
$Edit1 = GUICtrlCreateEdit("", 16, 72, 200, 60)
GUICtrlSetData(-1, "张小龙 钟小华 钟小明")
GUISetState(@SW_SHOW)
Local $Name

While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = $GUI_EVENT_CLOSE 
                        Exit
                Case $msg = $Button1
                        $Name = IniRead(@ScriptDir & '\myfile.ini','a',GUICtrlRead($Input1),"未搜到")                        
                        GUICtrlSetData($Edit1, @CRLF & $Name,1)
    EndSelect        
        Sleep(100)
WEnd
发表于 2014-2-26 12:56:10 | 显示全部楼层
回复 1# kehongpc
这种查询最好用数据库来解决
发表于 2014-2-26 13:35:10 | 显示全部楼层
myfile.ini配置文件
[32191101]
a=徐小明

[32191102]
a=韩婆 韩海

[32191103]
a=梁凤

[321911 ...
kehongpc 发表于 2014-2-25 20:47


你这种写法是你们体育老师教的?
发表于 2014-2-26 15:55:39 | 显示全部楼层
有数据库么?
 楼主| 发表于 2014-2-26 21:15:21 | 显示全部楼层
回复 5# xms77
可是我不懂
 楼主| 发表于 2014-2-26 21:16:03 | 显示全部楼层
回复 7# haopp1
没有,只是想利用读取INI文件来实现
 楼主| 发表于 2014-2-26 21:35:53 | 显示全部楼层
回复 4# xms77
谢谢大哥的指点,写得真的很好,只是查询起来有点慢,不知道有没有什么办法能读取得快一点呢?
发表于 2014-2-27 09:56:44 | 显示全部楼层
用数据库吧
发表于 2014-2-27 13:17:56 | 显示全部楼层
用SQLITE\MDB数据库或EXCLE文件吧
或者比较流行XML
发表于 2014-2-27 14:37:17 | 显示全部楼层
回复 9# kehongpc


    那要写多长的INI啊 数据少的时候还可以 但是多了的话 AU3会死掉的  建议使用个数据库
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 04:47 , Processed in 0.085747 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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