Sign in to follow this  
Followers 0
star2

[ HELP ] how can I send text from these GUI controls to a inf file

19 posts in this topic

#1 ·  Posted (edited)

hi guys this is the new question again

I have Input + Edit control, wich I want to export text intered inside them to a [ test.inf ] file with a certain path

using the GUI button

I need to know how to do this with ur help ppl

here's my GUI

#include <GUIConstants.au3>
GUICreate  ("test", 300,250)
GUISetFont (12)

GUICtrlCreateLabel ("one line input",4,4)
$put1 = GUICtrlCreateInput ("",4,25,200,25)

GUICtrlCreateLabel ("Multi line input",4,60)
$put2 = GUICtrlCreateEdit ("",4,80,150,100)

$send = GUICtrlCreateButton ("send all to file",4,215,150,25)


GUISetState ()

While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

note:

what I need is when I press the GUI button it will create a file named test.inf replacing any existed file containing the text entered inside the [ input + edit controls ]

let's see who's ganna save the day

...

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstants.au3>

GUICreate("test", 300, 250)
GUISetFont(12)
GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData()
WEnd

Func SendMyData()
    FileDelete('test.inf')
    $data = GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    FileWrite('test.inf', $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc

Edited by Zedna

Share this post


Link to post
Share on other sites

thank u so much

I love the way u made it very simple

thank u again

it worked just fine

thanks

I would realy love to get ur help regarding how to make a select file button

cuse my GUI will select the user file and replace it with another

but I don't wanna bother u now

thanks alot


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

with this code the top input field works..

#include <GUIConstants.au3>
$nr = 0
GUICreate("test", 300, 250)
GUISetFont(12)
GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData()
WEnd

Func SendMyData()
    $nr =+ 1
    FileDelete('test.inf')
    $data = GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    IniWrite( "test.inf", "TMPSection", $nr, $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc

have to look into why the bottom one doesnt work correctly..


Share this post


Link to post
Share on other sites

to get the user file, make sure the filename is created with

@username

then you can do this without a selection box for the file, let the script decide by the user that launched it, which file to select..


Share this post


Link to post
Share on other sites

I would realy love to get ur help regarding how to make a select file button

cuse my GUI will select the user file and replace it with another

but I don't wanna bother u now

thanks alot

Look into HelpFile at FileSaveDialog() function

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

thanks for all the replies

here's the GUI

#include <GUIConstants.au3>

#include <GUIConstants.au3>

GUICreate("test", 500, 100)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 210, 25, 150, 25)
GUISetState()


While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
            EndIf
WEnd

what I want is to select an *.bmp image using the select button and the input control will be = image path

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

GUICreate("test", 500, 100)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 210, 25, 150, 25)
GUISetState()


While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
                If Not @error Then GUICtrlSetData($put1,$sFile)
            EndIf
WEnd


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

oo welcome piccaso

I new it and I really love it when u come along and do ur magic

thank you

I want to ask u one more question

if I added a save button and wanted it to save a copy of the selected image to a spicific path can u help with this

#include <GUIConstants.au3>

GUICreate("test", 500, 100)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 210, 25, 150, 25)
$save = GUICtrlCreateButton("Save", 210, 55, 150, 25)
GUISetState()


While 1
    $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE Then ExitLoop
            if $msg = $open Then
                $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)")
                If Not @error Then GUICtrlSetData($put1,$sFile)
            EndIf
WEnd
Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

Something like this?

#include <GUIConstants.au3>

GUICreate("test", 500, 100)
GUISetFont(12)
GUICtrlCreateLabel("please select your picture", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
$open = GUICtrlCreateButton("select picture", 210, 25, 150, 25)
$save = GUICtrlCreateButton("Save", 210, 55, 150, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $open
            $sFile = FileOpenDialog("open image", @DesktopDir, "images (*.bmp)")
            If Not @error Then
                GUICtrlSetData($put1, $sFile)
            EndIf
        Case $save
            If GUICtrlRead($put1) <> "" Then
                $sDest = FileSaveDialog("Save Image", @DesktopDir, "Images (*.bmp)", 16)
                If Not @error Then
                    FileCopy($sFile, $sDest, 9)
                EndIf
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

thank you big daddy

actually I've used this way

FileCopy ($sFile ,@DesktopDir & '\new.inf',1)

it's very simple

cause I wanted the save button to save a copy without showing a save dialog and it worked just fine

thank you again

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

thank you big daddy

actually I've used this way

FileCopy ($sFile ,@DesktopDir & '\new.inf',1)

it's very simple

cause I wanted the save button to save a copy without showing a save dialog and it worked just fine

thank you again

Correct me if I'm wrong, but isn't that what big_d used??

Share this post


Link to post
Share on other sites

Correct me if I'm wrong, but isn't that what big_d used??

yes he did and I used his way that's why I'm thankful to him !!

I only declared that I made it without the save dialog

and I thank big-daddy and u also Bert


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

yes he did and I used his way that's why I'm thankful to him !!

I only declared that I made it without the save dialog

and I thank big-daddy and u also Bert

:shocked: Good job on finding the answer in the end :(

Share this post


Link to post
Share on other sites

:shocked: Good job on finding the answer in the end :(

Gosh, the others do the work and you even get some praise, wow. :P

Share this post


Link to post
Share on other sites

Gosh, the others do the work and you even get some praise, wow. :shocked:

oo just give me a break I'm new here and I'm trying to learn cause Autoit is great

I've only started using it few days after joining the forum :">


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites

oo just give me a break I'm new here and I'm trying to learn cause Autoit is great

I've only started using it few days after joining the forum :">

I just was having some fun with Bert about his praised effort.

Looks like you made some typo's in your code in the other topic. With a nice editor like Scite4AutoIt3, then making simple typo's should not happen too easy. Have a good look on the download page for it if you need to. AutoIt is great and if you commit time to learning then you will be much better latter on. :shocked:

Share this post


Link to post
Share on other sites

I just was having some fun with Bert about his praised effort.

Looks like you made some typo's in your code in the other topic. With a nice editor like Scite4AutoIt3, then making simple typo's should not happen too easy. Have a good look on the download page for it if you need to. AutoIt is great and if you commit time to learning then you will be much better latter on. :)

I thought the (praised) thing was about me - anyway thanks for the advice ...


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

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  
Followers 0