Jump to content

GUICtrlCreateInput Problem


Fire
 Share

Recommended Posts

Hi to everybody.

I write simple GUI program.(with Koda GUI builder)

But i have trouble with my script: =>When i try to click OK button my input for ex. sometext(on stdin $file) will not saved correctly to generated

TEST.TXT(stdout) file.

After this i open my generated file named TEST.TXT and i saw other data for exam. 3 and 4 numbers,and my text =>sometext(what i typed) is not saved to file.

What is the trouble i`m unable to know.I check all reference but again i`m unable find what is the trouble:(

Pliz help me found where is my mistakes.Thanks to all whoever take own gold time for help me.

My code below:

#include <GUIConstants.au3>
#NoTrayIcon
Run("cmd.exe /c if exist TEST.txt (ren test.txt test_%random%_%date%_file.txt) ")

; Graphical user interface created with KODA
$Form1 = GUICreate("TEST!", 633, 447, 380, 237)
GUISetBkColor(0xFF0000)
$Label1 = GUICtrlCreateLabel("Daxil Et", 216, 88, 218, 17)
GUICtrlSetBkColor(-1, 0xD4D0C8)
$file = GUICtrlCreateInput("", 176, 152, 305, 21)
$Button1 = GUICtrlCreateButton("OK", 248, 272, 161, 33, 0)
GUISetState(@SW_SHOW)
;EOF of GUI which created with KODA
$testfile = "TEST.TXT"

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


case $Button1
    Filewrite($testfile, $file & @CRLF)
    MsgBox(0, "Created", "TEST.TXT was created!")
    Run("cmd.exe /c start TEST.txt & exit")
    Exit
EndSwitch

WEnd
[size="5"] [/size]
Link to comment
Share on other sites

I didn't understand your description, but the variable $file is just the control ID of the Input control. To get the text from that control use GuiCtrlRead():

Case $Button1
    Filewrite($testfile, GuiCtrlRead($file) & @CRLF)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...