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

[AU3基础] [已解决]请高手帮我看一下这段代码,为什么变量无法读取呢 (附AU3文件)

[复制链接]
发表于 2010-6-27 16:19:54 | 显示全部楼层 |阅读模式
本帖最后由 elexy 于 2010-6-30 11:14 编辑

在输入框里输入任意内容后点按钮,变量无法读取,请教高手如何解决???
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <RichEditConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("为什么变量不显示出来呢?", 300, 280)

$Button1 = GUICtrlCreateButton("写入文本", 150, 180, 60, 20)


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$sidin = GUICtrlCreateInput("",20,220,120,20)
$sid = GUICtrlRead($sidin)

While 1
        $nMsg = GUIGetMsg()
        Sleep(50)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        MsgBox(4096, "autoit", $sid)
                        $file = FileOpen("test.txt", 10)
                        FileWriteLine($file, "insert" & $sid & "痛苦")
                        FileClose($file)
        EndSwitch
WEnd

本帖子中包含更多资源

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

×
发表于 2010-6-27 16:58:44 | 显示全部楼层
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <RichEditConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("这样就显示出来了哦!", 300, 280)

$Button1 = GUICtrlCreateButton("写入文本", 150, 180, 60, 20)
$sidin = GUICtrlCreateInput("", 20, 220, 120, 20)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
        $nMsg = GUIGetMsg()
        Sleep(50)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $sid = GUICtrlRead($sidin)
                        MsgBox(4096, "autoit", $sid)
                        $file = FileOpen("test.txt", 10)
                        FileWriteLine($file, "insert" & $sid & "痛苦")
                        FileClose($file)
        EndSwitch
WEnd

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2010-6-27 18:44:44 | 显示全部楼层
新手!!学习了,谢谢!!
发表于 2010-6-27 20:11:37 | 显示全部楼层
读取数据写错了
 楼主| 发表于 2010-6-27 20:56:42 | 显示全部楼层
谢谢hnzzlzj ,问题解决!!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-3 17:10 , Processed in 0.082545 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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