Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/03/2017 in all areas

  1. argumentum

    _NetStat_GetData

    ..you reminded me of a silly story: http://sirkan.iit.bme.hu/~kapolnai/fun/bitchecker.html
    1 point
  2. Here is another method for multiple searches. HotKeySet("{ESC}", "Terminate") ; Press Esc key to exit script. Global $sFileName = "281478146260429_chatlog.txt" Global $sSearch4 = "tips you" Global $sSearch5 = "bank credits" Global $sSearch6 = "trade with you" Global $sSearch7 = "you tell" Global $sSearch8 = "to a duel" _FileDeleteLines() AdlibRegister("_FileDeleteLines", 10 * 1000) ; Run the function, _FileDeleteLines(), every 30 secs While Sleep(100) WEnd Func _FileDeleteLines() Local $sFileContents = FileRead($sFileName) Local $hFileOpen = FileOpen($sFileName, 2) ; $FO_OVERWRITE (2) = Write mode (erase previous contents) ; RE Replace pattern is brilliantly created here: https://www.autoitscript.com/forum/topic/191336-split-csv/?do=findComment&comment=1372474 FileWrite($hFileOpen, StringRegExpReplace($sFileContents, _ '(?m)^.*(\Q' & $sSearch4 & "\E|\Q" & $sSearch5 & "\E|\Q" & $sSearch6 & "\E|\Q" & $sSearch7 & "\E|\Q" & $sSearch8 & _ '\E.*\R?)(*SKIP)(?!)|^.*\R*', "")) ; This part of the RE pattern :- ; "(\Q' & $sSearch4 & "\E|\Q" & $sSearch5 & "\E|\Q" & $sSearch6 & "\E|\Q" & $sSearch7 & "\E|\Q" & $sSearch8 & '\E.*\R?)" ; "(....)" The first open bracket and the last closing bracket encase all the searches into one group. ; "|" means "or". So each search is separated and connected with an "or". ; "\Q'....\E" means all characters between "\Q" and "\E" are taken as literal characters. ; Meaning of this part of the RE pattern :- ; Find (match) the literal characters in $sSearch4 or $sSearch5 or $sSearch6 or $sSearch7 or $sSearch8. FileClose($hFileOpen) EndFunc ;==>_FileDeleteLines Func Terminate() AdlibUnRegister("_FileDeleteLines") Exit EndFunc ;==>Terminate
    1 point
  3. PD, Try it like this...(not tested) HotKeySet("{ESC}", "Terminate") ; Press Esc key to exit script. Global $sFileName = "281478146260429_chatlog.txt" Global $asearch[5] $asearch[0] = "tips you" $asearch[1] = "bank credits" $asearch[2] = "trade with you" $asearch[3] = "you tell" $asearch[4] = "to a duel" _FileDeleteLines() AdlibRegister("_FileDeleteLines", 10 * 1000) ; Run the function, _FileDeleteLines(), every 30 secs While Sleep(100) WEnd Func _FileDeleteLines() Local $sFileContents = FileRead($sFileName) Local $hFileOpen = FileOpen($sFileName, 2) ; $FO_OVERWRITE (2) = Write mode (erase previous contents) For $1 = 0 To UBound($asearch) - 1 $sFileContents = StringRegExpReplace($sFileContents, '(?m)^.*\Q' & $asearch[$1] & '\E.*\R?(*SKIP)(?!)|^.*\R*', "")) Next FileWrite($hFileOpen, $sFileContents) FileClose($hFileOpen) EndFunc ;==>_FileDeleteLines Func Terminate() AdlibUnRegister("_FileDeleteLines") Exit EndFunc ;==>Terminate kylomas
    1 point
  4. therefore: MsgBox(0, '', (( 12.7 * 100 ) - ( 12.4 * 100)) / 100 ) You have to make all real to integers. Once you're done, put it back as real.
    1 point
×
×
  • Create New...