ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner


(1/2) > >>


Mouser asked me an addnote tool for his Farr tool...
Here's the beast that can be compiled there :

--- ---' // ------------------------------------------------------------------
' // Addnote -clip|-timestamp|-top YOURMESSAGE_UNDERSCORES_MEAN_CRLF :)
' // ------------------------------------------------------------------

Dim $szCmd1, $szCmdFull, %fp, $szTemp
Begin Const
    file = ".\addnote.txt"
    sepa = "------------------------------------"
End Const

    szCmd1 = LCase(Command(1))
    szCmdFull = Remove(Command(-1), szCmd1)
    szCmdFull = Replace(szCmdFull, "_", CRLF)
    szCmdFull = Trim(szCmdFull)
    szCmdFull = Replace(szCmdFull, ch34 & ch34, "")
    If Left(szCmdFull, 1) = ch34 AndAlso Right(szCmdFull, 1) = ch34 Then szCmdFull = Mid(szCmdFull, 2, StrLen(szCmdFull) - 2)
    szCmdFull = Trim(szCmdFull)
    If StrLen(szCmdFull) = 0 Then ExitProgram(-1)
    Select Case szCmd1
        Case "-clip"
            fp = FileOpen(file, APPEND)
            FilePrint(fp, szCmdFull)
            FilePrint(fp, sepa)
        Case "-timestamp"
            'March 12, 2006 - 19:35:27 PM
            fp = FileOpen(file, APPEND)
            FilePrint(fp, GetMonth(Time(6)) & " " & Time(7) & ", " & Time(5) & " - " & _
            Time(1) & ":" & Time(2) & ":" & Time(3) & " " & Time(4))
            FilePrint(fp, szCmdFull)
            FilePrint(fp, sepa)
        Case "-top"
            fp = FileOpen(file, BINARY_INPUT)
            szTemp = FileGet(fp, FileLen(file))
            fp = FileOpen(file, OUTPUT)
            FilePrint(fp, szCmdFull)
            FilePrint(fp, sepa)
            FilePrint(fp, szTemp)
    End Select
End If

Function  $GetMonth(ByVal  %iMonth)
    Select Case iMonth
        Case 1
            Return "January"
        Case 2
            Return "February"
        Case 3
            Return "March"
        Case 4
            Return "April"
        Case 5
            Return "May"
        Case 6
            Return "June"
        Case 7
            Return "July"
        Case 8
            Return "August"
        Case 9
            Return "September"
        Case 10
            Return "October"
        Case 11
            Return "November"
        Case 12
            Return "December"
    End Select
End Function

So mouser?

let me try it and report.. i think this will make a kickass addon for FARR.

working great so far (no pun intended).

in fact this is something that i think is so useful that im going to make a video demo movie of the latest farr and show it being used along with calc.

i have 3 requests though if possible:
1) make it parse all commandline arguments (ie until no more args starting with -); that way we can do addnote -top -clip blah blah
2) the first argument should be filename (or make it work like -file "filenamegoeshere"); this is very important, since people need to be able to specify custom files and where they should go.
3) the use of _ for newlines is not good; can we use the standard \n please?

Hi mouser,

Yes, all is possible in FBSL!

1) To get Commandlines ytou can use this :

For i = 0 to CommandCount()
  szCmd = Command(i)
Next i

And then you can parse each one starting with wanted keywords and so on...

2) no problem, you have to document it :)

3) just do this mod :
instead of :
szCmdFull = Replace(szCmdFull, "_", CRLF)

type this :
szCmdFull = Replace(szCmdFull, "\n", CRLF)

But, actually i'm at office... so i have to work before playing, but you can add these mods yourself ;)

Maybe I missed something... what does "AddNote" do?



[0] Message Index

[#] Next page

Go to full version