Auch von Dll-, COM- und OOP-phobikern beherrschbar.
LogAppend().ahk
Code: Select all
If (A_ScriptName = "LogAppend().ahk") { ; test section. Change filename accordingly or remove this section.
Random, num, 1, 10000
LogAppend() ; func call to create a default file (that is named <YYYYMMDD>.log) to add a timestamp to it.
LogAppend("This is today's random number:`t" . num,"myOwn.log") ; func call to create "myOwn.log" and to add the specified content to it.
ExitApp
} ; end of test section.
LogAppend(string="",filename="") {
filename := (filename = "") ? SubStr(A_Now,1,8) . ".log" : filename ; creating a default filename if no filename has been specified with the functions call
string := (string = "") ? A_Now : string ; creating a default file content (here a timestamp) if no content has been specified with the functions call ; edit the current log
FileRead, content,% filename ; so read its content (if a file already exists) ...
FileMove,% filename,% filename ".bak", 1 ; save the current file (if existing) as a backup (that file will be overwritten each time!)
FileAppend,% string "`r`n" content,% filename ; write/create an updated file with its content in ascending order
SoundBeep
}
FlipContent().ahk
Code: Select all
If (A_ScriptName = "FlipContent().ahk") { ; test section. Change filename accordingly or remove this section.
MsgBox % ClipBoard := FlipContent(ClipBoard)
SoundBeep
ExitApp
} ; end of test section.
FlipContent(clipB) {
content := StrSplit(clipB,"`n")
cnt := content.MaxIndex()
Loop % content.MaxIndex() {
newContent .= content[cnt] "`n"
cnt--
}
Return % newContent
}