找回密码
 加入
搜索
查看: 2300|回复: 3

[AU3基础] [已解决]如何从txt文件导入数据

[复制链接]
发表于 2010-9-20 22:33:11 | 显示全部楼层 |阅读模式
本帖最后由 731106 于 2011-3-31 12:50 编辑

如何把txt文件中的数据导入到GUI的文本框中,是通过浏览导入(看图):

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-9-20 23:02:57 | 显示全部楼层
本帖最后由 minghui 于 2010-9-20 23:04 编辑

#include <GUIConstants.au3>
;#include <ButtonConstants.au3>
;#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 288, 433, 427, 173)
$Edit1 = GUICtrlCreateEdit("", 152, 8, 129, 393)
GUICtrlSetData(-1, "")
$Label1 = GUICtrlCreateLabel("请导入代码:", 52, 16, 88, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("浏   览", 56, 48, 65, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button1
                        $message = "浏览文件"
                        $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
                        $sFile = FileOpenDialog($message, $MyDocsFolder, "文本文件 (*.txt)", 1 + 1)
                        _GUICtrlEdit_SetText($Edit1, FileRead($sFile))
        EndSwitch
WEnd


是不是这样呢

评分

参与人数 2金钱 +30 收起 理由
liufenglg + 10
水木子 + 20

查看全部评分

发表于 2010-9-21 17:58:47 | 显示全部楼层
2楼很强....
发表于 2012-12-15 13:54:23 | 显示全部楼层
好的代码需要学习,谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-29 15:32 , Processed in 0.117316 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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