Jump to content

IniWrite On Next Line


Recommended Posts

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


Test ()
Func Test()
$Form1 = GUICreate("Form1", 414, 212, 1449, 1197)

$Group1 = GUICtrlCreateGroup("Group1", 0, 0, 201, 161)
Global $Combo1 = GUICtrlCreateCombo("", 0, 16, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Data = GUICtrlSetData($Combo1, "Combo 1|Combo 2|Combo 3")
Global $Input1 = GUICtrlCreateInput("", 0, 48, 201, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Group2", 210, 0, 200, 160)
    Dim $LABELS[20]
    Local $DIRECTORY    = @ScriptDir & "\Test.ini"
    Local $SECTION      = IniReadSection($DIRECTORY, "Section 1")
    Local $RESULTS      = ""
    For $r = 1 To $SECTION[0][0]
        $RESULTS &= $SECTION[$r][1] & @CRLF
    Next
    $RESULTS = StringTrimRight($RESULTS, 1)
    For $N = 0 To 10
        $LABELS[$N] = GUICtrlCreateLabel($RESULTS, 220, 15, 200, 100)
    Next
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button1 = GUICtrlCreateButton("Save", 80, 170, 121, 33)
$Button2 = GUICtrlCreateButton("Exit", 210, 170, 121, 33)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button1
                _WriteData ()
            Case $Button2
                Exit
        EndSwitch
    WEnd
EndFunc

_WriteData ()
Func _WriteData ()
Local $TestData = GUICtrlRead($Combo1)
Local $TestInput = GUICtrlRead($Input1)
Local $Directory    = @ScriptDir & "\Test.ini"

IniWrite ($Directory, "Section 1", "", "" & $TestData & "       " & $TestInput & @CRLF & "")
EndFunc

Hello Friends,
  Perhaps one of you can assist me. Currently I have a semi-working script. The goal of this script is to write the values of the combo box into an INI file and read said INI files. So far it does this.. but the issue is, It writes over line 1. The goal is to write on a new line each time to create a continuous log of submitted data.

Link to comment
Share on other sites

.INI file format and implied characteristic aren't suited to accumulate log data. You're better trying .log files and associated functions.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Well this puts a serious wrench in the system. As the program would read the .ini file in order show me the information that was logged without having to actively open the log file. Would you mind providing me with a quick little snippet of how you would go about this scenario based on my example? I'm completely out of ideas here.

I was able to get a working log file. However, it doesn't do what I need it to do and it breaks the readini function.

Link to comment
Share on other sites

How much data?  I would think a map would serve the same purpose, and would only need to write to file in chunks (as memory warranted).  Depending on how you structure your map you can dump to .ini, dump it to an array, and then even lose your gd mind and call them back with dot notation......I have some old functions here:

 

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Thank you once again for your input iamtheky.  I'll have to look at your script again - tomorrow, with a fresh brain. 

To answer your question, the amount of data (in my opinion) would be small. Three names, Two Dates, and a phone number per entry. Now, if the question is rather how many entries that will vary month to month but approximately 110 per month.

Link to comment
Share on other sites

Bouncing that data between maps and files would be easy at that size.  Just so I don't immediately create an edge case, can you provide a couple of sample entries?  While using beta functions and a notation that will be deprecated is not ideal, my solutions are nothing if not unwieldy.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

QA Agent Score Dates   IEA Agent Team Lead   Phone Number  Call Details
John Doe 11/02/2017 1:01P   Joe Agent Boss Jane   123-456-7890 10/10/10 7:32A
John Doe 11/02/2017 1:15P   Tom Agent Boss Jane   789-123-4567 1/12/15 9:02A
Jane Doe 11/02/2017 1:30P   Lisa Agent Boss Sam   456-789-1234 4/15/17 3:23P

 


Something of this nature. Ideally the data per entry would be pulled from a combination of combo and input boxes.

Link to comment
Share on other sites

  • 2 weeks later...

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

×
×
  • Create New...