Jump to content

vinnyMS

Active Members
  • Posts

    63
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vinnyMS's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. the source file is attached result: @NPC_RedPlayer @NPC_Main_0_0 @NPC_Main_0_1 @NPC_Main_0_2 @NPC_Main_0_3 @NPC_Main_0_4 @NPC_Buy @NPC_Sell @NPC_TQuest @NPC_TQuest_1 01Meet_Bichon1-0.txt result.txt
  2. i have a script that is supposed to extract text that includes or starts with the "@" character but it doesn't seem to work what is the problem with the regex? #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() ; Error monitoring. This will trap all COM errors while alive. ; This particular object is declared as local, meaning after the function returns it will not exist. Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oDictionary = ObjCreate("Scripting.Dictionary") Local $mypath = @ScriptDir Local $aFiles = _FileListToArrayRec($mypath, "*.txt", 1, 1) Local $aWords If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "No files found") Exit Else MsgBox($MB_SYSTEMMODAL, "Found", $aFiles[0] & " files") EndIf Local $aWords For $i = 1 To $aFiles[0] $aWords = StringRegExp(FileRead($aFiles[$i]), "(?mi)^\s*(@.*)$", 3) ; change pattern to fit your definition of "word Local $iError = @error If $iError = 0 Then For $Word In $aWords $oDictionary.add($Word, $Word) Next Else ;;MsgBox($MB_SYSTEMMODAL, "Error", $aFiles[$i] & " - " & $i & @CRLF & "error: " & $iError) EndIf Next $aWords = $oDictionary.Items FileWrite("New AutoIt v3 Script - acomercial.txt", _ArrayToString($aWords, @CRLF)) EndFunc ;==>_Example ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
  3. post 1 is to create two lists, the before list and the after list
  4. Not exactly homework That script was to use to extract text from hundreds of files and create a text list based on file content. Then the text extracted was to be replaced with text in another language. Extracted as Chinese and replaced by English. This way I could translate all those files by replacing the text from Chinese to English This other script is to create lists of top frequency to again replace from numbers to words. I work a lot with text file editing. I have all sort of ideas about programs
  5. it's for reading EEG in plain text
  6. Sorry to bother, I'm not a programmer so it's very difficult to create to me. It requires a lot of edits. Plz help
  7. i have a script that counts the word frequency and displays it in an array table i need it to write the results in a text file instead of an array table here's the script #Include <Array.au3> #Include <Debug.au3> #include <Constants.au3> #include <AutoItConstants.au3> Example() Func Example() $s = FileRead("2.txt") ProgressOn ( "Word Frequency", "Counting", "Loading", Default, Default, 18 ) Local $w = StringRegExp($s, "(?s)(\b[[:alpha:]]{2,}\b)", 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 ProgressSet (( $i/(UBound($w) - 1)) * 100, "processed", "word frequency" ) StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended Next ProgressSet(100, "Done", "Complete") _ArraySort($w, 1, 0, 0, 1) _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ; _DebugArrayDisplay($w, "Title", "|0:1") ; _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) $sMessage = "" SplashTextOn("Counting words", $sMessage, -1, -1, -1, -1, $DLG_TEXTLEFT, "") For $i = 1 To 0 $sMessage = $sMessage & $i & @CRLF Next ProgressOff() EndFunc ;==>Example
  8. i have a word frequency counter script. the problem is that it counts 1 letter words and numbers i need the script to list only 2 or more letter words with no numbers #Include <Array.au3> #Include <Debug.au3> #include <Constants.au3> #include <AutoItConstants.au3> Example() Func Example() $s = FileRead("2.txt") ProgressOn ( "Word Frequency", "Counting", "Loading", Default, Default, 18 ) Local $w = StringRegExp($s, '(?is)(\b\w+\b)(?!.*\b\1\b)', 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 ProgressSet (( $i/(UBound($w) - 1)) * 100, "processed", "word frequency" ) StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended Next ProgressSet(100, "Done", "Complete") _ArraySort($w, 1, 0, 0, 1) _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ; _DebugArrayDisplay($w, "Title", "|0:1") ; _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) $sMessage = "" SplashTextOn("Counting words", $sMessage, -1, -1, -1, -1, $DLG_TEXTLEFT, "") For $i = 1 To $w $sMessage = $sMessage & $i & @CRLF Next ProgressOff() EndFunc ;==>Example
  9. it works, freezes for 10 seconds but loads
  10. i tried it again, it works with less content, if there's thousands of words it doesn't show progress it says "not responding" for many minutes here's what i have #Include <Array.au3> #Include <Debug.au3> #include <Constants.au3> #include <AutoItConstants.au3> Example() Func Example() $s = FileRead("book.txt") ProgressOn ( "Word Frequency", "Counting", "Loading", Default, Default, 18 ) Local $w = StringRegExp($s, '(?is)(\b\w+\b)(?!.*\b\1\b)', 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 ProgressSet (( $i/(UBound($w) - 1)) * 100, "processed", "word frequency" ) StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended Next _ArraySort($w, 1, 0, 0, 1) _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ; _DebugArrayDisplay($w, "Title", "|0:1") ; _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ProgressOff() EndFunc ;==>Example
  11. #Include <Array.au3> #Include <Debug.au3> #include <Constants.au3> #include <AutoItConstants.au3> Example() Func Example() $s = FileRead("2.txt") ProgressOn("word frequency", "Increments every row", "0%", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) Local $w = StringRegExp($s, '(?is)(\b\w+\b)(?!.*\b\1\b)', 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended ProgressSet($i, $i & "%") Next _ArraySort($w, 1, 0, 0, 1) _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ProgressSet(100, "Done", "Complete") ; _DebugArrayDisplay($w, "Title", "|0:1") ; _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ProgressOff() EndFunc ;==>Example i almost got it working with a minor bug in percent value how to fix it?
  12. is it possible to add the progress bar and make it work for each array row result counting min/max rows completed
  13. i have this script that i need a progress bar about #Include <Array.au3> #Include <Debug.au3> #include <Constants.au3> $s = FileRead("book.txt") Local $w = StringRegExp($s, '(?is)(\b\w+\b)(?!.*\b\1\b)', 3) _ArrayColInsert($w, 1) For $i = 0 to UBound($w)-1 StringRegExpReplace($s, '(?i)\b' & $w[$i][0] & '\b', $w[$i][0]) $w[$i][1] = @extended Next _ArraySort($w, 1, 0, 0, 1) _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) ; _DebugArrayDisplay($w, "Title", "|0:1") ; _DebugArrayDisplay($w, "Title", "|0:1", $ARRAYDISPLAY_NOROW) plz help
  14. thanks a lot it works
×
×
  • Create New...