Jump to content
Sign in to follow this  
BeZ

Creating a log

Recommended Posts

BeZ

I would like to make a scrip log file out of this:

#include <GUIConstants.au3>
;#NoTrayIcon

Dim $button_start
Dim $prix
dim $cout

MsgBox(0, "Script", "Starting Script")

Bloquage ()

Func Bloquage ()

    GuiCreate("blocked", 1024, 768, 0, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $button_start = GUICtrlCreateButton("Click to start", 452, 374, 120)
    GUICtrlCreateInput ( "Last name", 452, 326, 120, 20)
    GUICtrlCreateInput ( "First name", 452, 350, 120, 20)
    
    While 1
        GUISetState()
        
        $msg = GUIGetMsg()
        
        Select
            Case $msg = $button_start
                ExitLoop
        EndSelect
    WEnd

EndFunc
Exit

I want "First name" and "Last name" to be stored in a log file (anything.log if im right). How can I do this ?

Thanks for the help, BeZ

Share this post


Link to post
Share on other sites
BPBNA

Use GUICtrlRead to get the entered information and write it to a file with either FileWriteLine or _FileWriteLog.

Share this post


Link to post
Share on other sites
Xenobiologist

HI,

what about starting with the tut? :P

#include <GUIConstants.au3>
#include <File.au3>
;#NoTrayIcon

Dim $button_start
Dim $prix
dim $cout

MsgBox(0, "Script", "Starting Script")

Bloquage ()

Func Bloquage ()
    GuiCreate("blocked", 1024, 768, 0, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $button_start = GUICtrlCreateButton("Click to start", 452, 374, 120)
    $lname = GUICtrlCreateInput ( "Last name", 452, 326, 120, 20)
    $fname = GUICtrlCreateInput ( "First name", 452, 350, 120, 20)
    
    While 1
        GUISetState()
        $msg = GUIGetMsg()
        Select
            Case $msg = $button_start
                _FileWriteLog(@ScriptDir & "\my.log","Lastname : " & GUICtrlRead($lname) & " | " & "First name : " & GUICtrlRead($fname))
                ExitLoop
        EndSelect
    WEnd
EndFunc
Exit

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
BeZ

So easy to understand and works so well, thanks Mega.

Sad I didn't find it myself :P I searched in the function reference for word "log" and did'nt see filewritelog :nuke:... So many well hidden things.

BeZ

Edited by BeZ

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.