Jump to content

simple text box


Recommended Posts

Filewritelog should work fine... I ran this code three times and it just appended the log lines to the same file (and did not create a new one). What code did you use for filewrite log? Are you sure you made it attempt to write to the same file each time?

#include <file.au3>
;
_FileWriteLog("c:\my.log","Text 1")
;
_FileWriteLog("c:\my.log","Text 2")

Running this three times resulted in one file, named c:\my.log ofcourse, containing:

2007-03-22 18:50:11 : Text 1

2007-03-22 18:50:11 : Text 2

2007-03-22 18:50:59 : Text 1

2007-03-22 18:50:59 : Text 2

2007-03-22 18:51:08 : Text 1

2007-03-22 18:51:08 : Text 2

thanks again. i've done some programming b4 but never like this. i am having a ball trying to figure this stuff out and ireally appreciate all your help.

i got it to work after I used ur suggestion. but its still overwriting the previous entry. i would like it to record each one like urs did.

how can i change the format for the date? i tried _datetimeformat, but it always returns the same format YYYY/MM/DD i want it to be MM/DD/YYYY.

Edited by controlledchaos
Link to comment
Share on other sites

thanks again. i've done some programming b4 but never like this. i am having a ball trying to figure this stuff out and ireally appreciate all your help.

i got it to work after I used ur suggestion. but its still overwriting the previous entry. i would like it to record each one like urs did.

how can i change the format for the date? i tried _datetimeformat, but it always returns the same format YYYY/MM/DD i want it to be MM/DD/YYYY.

Ok, glad to be helpful.

Does this little example help you? It will keep asking for a login name, give an error if nothing was entered, and if something was entered it will APPEND (not overwrite! this is the 2nd parameter to the FileOpen function) to the log file. When you press cancel it will quit. Enter a couple of names and then check the created log file.

While 1
    $login = InputBox("Login","Please enter your login name:") ; <-- loginname is stored in $input
    If @error = 1 Then ; <-- user pressed cancel, see InputBox help
        ExitLoop
    EndIf
    If $login<>"" Then ; <-- only act if something was actually entered
        $file = FileOpen("c:\my.log",1)
        FileWriteLine($file,@MDAY&"-"&@MON&"-"&@YEAR&" - "&@HOUR&":"&@MIN&":"&@SEC&" | Login name entered: "&$login)
        FileClose($file)
    Else ; <-- give an error if "" (meaning nothing) was entered
        MsgBox(16,"error","You need to enter a login name!")
    EndIf
WEnd

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

god ur good! thanks that worked!

i had already figured out how to append the file instead of overwriting it. i had forgotten about the mode. :D

Well I might know some theory (since I am mostly a Java programmer), but I don't have that much AutoIt experience... I guess I'm just good at searching help files :P (And I can still type English even though I'm slightly drunk on friday night... :whistle:)

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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...