Sign in to follow this  
Followers 0
Werner

Using GUI for data entry and saving to csv

4 posts in this topic

Hi All

I have a simple question: What command do I use to click on a button and save the contents of the unbound controls on an AutoIT GUI to a csv file?

I am trying to make a tiny application that will capture a few lines of input and saving it for email to a database.

Your help will be much appreciated.

Werner

Share this post


Link to post
Share on other sites



Werner

First, welcome to the AutoIt forums.

When you post here it always helps if you have had a go at solving your problems beforehand. Having some code to work on is a great help - and no-one here is too keen to help the "code it for me" brigade.

First, you need to have an idea of how AutoIt works and how to create and interact with a basic GUI. Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here.

Then you can look at how to read controls and write the results to a file. None of this is difficult, but requires some application - by you.

So, give it a go yourself and come back with your code if you run into problems.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi All

I have a simple question: What command do I use to click on a button and save the contents of the unbound controls on an AutoIT GUI to a csv file?

I am trying to make a tiny application that will capture a few lines of input and saving it for email to a database.

Your help will be much appreciated.

Werner

Here's a small example just to get you started.

;Includes
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

;Create GUI
$GUI= GuiCreate("Input window", 300, 150)
GUICtrlCreateLabel("1", 10, 33)
GUICtrlCreateLabel("2", 10, 63)
$Input_1 = GUICtrlCreateInput("",30,30,240,20)
$Input_2 = GUICtrlCreateInput("",30,60,240,20)
$Save = GUICtrlCreateButton("Save", 80, 100, 140,30)
;Display GUI
GUISetState()

;Start Main loop
While 1
    Switch GuiGetMsg();Get activity from GUI
        Case $GUI_EVENT_CLOSE ;Exit when X button is pressed
            Exit
        Case $Save ;When saved is pressed
            $Line = "1: " & GUICtrlRead($Input_1) & @CRLF & "2: " & GUICtrlRead($Input_2);Read the inputs and format output
            $FILE = FileOpen(@desktopdir&"\Saved Example.txt",1) ;Open the file in write mode
            FileWrite($File, $Line); write to the opened file
            FileClose($File);Close the File
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Melba23 and Paulie. Thank you very much.

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