Jump to content

Storing input in a log for later retrieval


shanet
 Share

Recommended Posts

Hey AutoIT people,

I am creating software in which the user is asked for the following pieces of information:

date:hour:minute -- Title --- Description -- priority

(alarm time) (alarm name) (alarm details) (priority of alarm).

The date is selected from a GUI date control, the time is input manually however I may consider changing that. The priority is selected from a dropdown list in which there are seven choices and they all are assigned their own respective number.

Many alarms may be created so the challenge is to be able to insert an entry into a log file, for the sake of this thread it should be appdata/log.log

I would like it inserted in such a format that you can easily retrieve all the data and display it as different records, be able to manipulate/delete the data and the alarm should go off at the specified time.

If we were to view the current alarms from within the software, for example, it would print out into an edit control or something similar like such:

Date Time to go off Title Description Priority

15/12/07 3:15 PM Test Alarm This alarm is a test alarm. High

14/01/08 11:00 AM Test no. 2 This is our second test High

alarm.

I would like to be able to

cater for returns like

above and be able to

differentiate them from a

different record.

15/11/08 3:00 PM Test 3 Our third record. Low

As you can see in record two, the user entered a return, which I would like to be able to cater for by inserting an @CR/@LF in (whichever) in.

I hope this is all understandable?

Many thanks to you all.

shanet

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
Link to comment
Share on other sites

Here's a start for you. Not sure if it's what you needed, but it should give you a good idea of how to start.

$sInput = InputBox("Add Timer", "Format:" & @CRLF & "mm/dd/yyyy hh:mm:ss 'title' 'description' 'priority'", "12/11/2010 12:34:00 'Test' 'A Test Timer' 'High'")
FileWrite("log.log", $sInput)

$sRead = FileReadLine("log.log")
$aDetails = StringRegExp($sRead, "(\d{1,2}/\d{1,2}/\d{4}) (\d{2}:\d{2}:\d{2}) '(.+)' '(.+)' '(.+)'", 1)
MsgBox(0, "FileRead", "Date: " & $aDetails[0] & @CRLF & _
                    "Time: " & $aDetails[1] & @CRLF & _
                    "Title: " & $aDetails[2] & @CRLF & _
                    "Description: " & $aDetails[3] & @CRLF & _
                    "Priority: " & $aDetails[4])

FileDelete("log.log")

Look in the help file for FileReadLine to see how to use it to read the whole file. Currently this reads 1 line and does not support multiline parameters.

Edited by darkjohn20
Link to comment
Share on other sites

!!! I DIDNT REPLY!!! :x

Anyway, thanks DarkJohn, but I did figure it out.

Thankyou anyway for your assistance, it is greatly appreciated.

shanet

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
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...