Jump to content

Func _log($read) how to $read with differnt methods


Recommended Posts

/?

Do you want _log() to take three different strings and combine them?

Or do you want _log to be called three different times, combine the values as you go, and display them at the end? If so, it will need logic to determine when to display the MsgBox.

You're going to need to be more specific.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

exactly

You skipped an important part: "If so, it will need to determine when to display the MsgBox."

This will display and reset every third call:

_data()

Func _data()
    _log("1")
    _log("2")
    _log("3")
EndFunc

Func _log($read)
    Global $s_Text, $i_Count

    $s_Text &= $read
    $i_Count += 1

    If $i_Count >= 3 Then
        MsgBox(64, "", $s_Text)
        $i_Count = 0
        $s_Text = ""
    EndIf
EndFunc

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Or maybe use an existing Global:

Global $s_Text

_data()

Func _data()
    _log("1")
    _log("2")
    _log("3")
    _log("45")
    _log("6")
    _log("", True); Display and clear
    _log("7")
    _log(); Just display
EndFunc

Func _log($read = "", $f_Clear = False)
    If $read <> "" Then
        $s_Text &= $read & @CRLF
    Else
        MsgBox(0x40, 'Title', $s_Text)
    EndIf
    If $f_Clear Then $s_Text = ""
EndFunc

You could also add time stamps to make it a really useful log, but that gets close to just reinventing _FileWriteLog(), which I use extensively in all my maintenance scripts.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...