Jump to content
Sign in to follow this  
Fire

GUICtrlCreateInput Problem

Recommended Posts

Fire

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]

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Fire

PsaltyDS Thank you very much.Solved.Thanks again.


[size="5"] [/size]

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.