-
Posts
104 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Fr33b0w's Achievements

Adventurer (3/7)
4
Reputation
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Nine reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Hi sorry for bumping an old post but again i have a problem because site code changed. Everything worked fine but now there is a new line of code which unable this regex to work. Instead of "author_id" as closure now there is sometimes "like_count" instead of author_id which is still there but after much more code I dont need to extract. I did try to use delimiter in RegEx but I guess regex is not easy for me... Can someone just give me a suggestion how to make a regex which will say: Get text from here to (here or here). I did try to put it like this: Global $InputDatab = StringRegExp($InputDataa, '(?<=\"text\": \").*?(?=\", \"author_id\|like_count\")', 3) ...but it didnt work. Line instead of this was taking data from "text:" to "timestamp" Global $InputDatab = StringRegExp($InputDataa, '(?<=\"text\": \").*?(?=\", \"timestamp\")', 3) Here is an example of text which is in .info.json: So, now there are two lines which can be a closure for getting text: ', "like_count":' and ', "author_id":' How can I add in RegEx code that would do what i want? I did try it on my own with examples I found online but it does not work... Again much thanks in advance for this. Sorry, I just tried a bit more and solved a problem. Correct line is: Global $InputDatab = StringRegExp($InputDataa, '(?<=\"text\": \").*?(?=\", \"author_id|\", "like_count\")', 3) Thanks, sorry!
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Thanks. I decided to use second example, which I can see its better, but far away from my level of knowledge. And it works even better then the first one, but with much more difficulty to play with it. This way it looks like script is playing with me.... Problem is that in this case I cant add @CRLF after every set of text which is find and I don't know how to do that. I did try to use StringReplace function to replace every @CRLF with two, so I will get a blank line after every part of text that is found.... But I am not good with arrays and RegEX... Got nothing... I am still using FindFile instead of _FileListToArray as you have been suggested, but thats only because I would like to make this code work on field where I am less uncomfortable and after that I could try to do it another way. Just... for someone this is a piece of cake and for me is rest of that cake... How to add @CRLF or @CR that will work? #include <String.au3> #include <Array.au3> #include <File.au3> Local $search = FileFindFirstFile("*.info.json") DirCreate(@ScriptDir & "\comments\") Local $dir = @ScriptDir & "\comments\" If $search = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.") Return False EndIf While 1 Local $file = FileFindNextFile($search) If @error Then ExitLoop Local $target = StringReplace($file, '.info.json', '.txt') Local $InputDataa = FileRead($file) Global $InputDatab = StringRegExp($InputDataa, '(?<=\"text\": \").*?(?=\", \"timestamp\")', 3) ;_ArrayDisplay($InputDatab) _FileWriteFromArray($dir & $target,$InputDatab, 1) WEnd Exit
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Sorry... Still have some problems with this. It wont process all files... Did try to rename them, did try to change the code. but it wont work... It process 223 files of 327 and I dont know why... Script I am trying to use is: #include <String.au3> #include <Array.au3> Local $search = FileFindFirstFile("*.info.json") DirCreate(@ScriptDir & "\comments\") Local $dir = @ScriptDir & "\comments\" If $search = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.") Return False EndIf While 1 Local $file = FileFindNextFile($search) If @error Then ExitLoop Local $target = StringReplace($file, '.info.json', '.txt') Local $InputData = FileRead($file) $InputData = StringReplace($InputData, ', "', ',"') $InputData = StringReplace($InputData, '": ', '":') Local $textArray = _StringBetween($InputData, '"text":', ',"') If IsArray($textArray) Then For $i = 0 To UBound($textArray) - 1 FileWriteLine($dir & $target, @CRLF & " * " & $textArray[$i] & @CRLF) Next EndIf Local $timestampArray = _StringBetween($InputData, '"timestamp":', ',"') If IsArray($timestampArray) Then For $i = 0 To UBound($timestampArray) - 1 FileWriteLine($dir & $target, @CRLF & " * " & $textArray[$i] & @CRLF) Next EndIf FileClose($dir & $target) WEnd Exit I added files which I am trying to scrap... I let them be in a same folder where designated files are... Files are in attachment... Thanks. test.zip
-
Fr33b0w reacted to a post in a topic: FileFindNextFile fails to detect final file in subdirectory
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Fr33b0w reacted to a post in a topic: [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
-
Thank You very much VIP. This solve my probem and do exactly what I wanted to achieve. It was not that simple I thought it could be, so sorry for that. I am learning from your example. i wish you good and healthy life. Reedit: Thanks Subz! This regex I can understand and learn from it. Guys, thanks a lot. You made my day.
-
There must be a very simple solution for this "problem". I know how I would do it if there is just a few but I need to do it for every instance and it might be 1000 of them. I guess it is just a few lines of code. i am not so good with regular expressions so solution without it for my better understanding would be much appreciated. I use autoit for a long time but I am not an expert and I am recovering from corona illness, haven't been coding for some time, etc. So, if any good soul would give me a hint, comments that I would like to extract are between "text": " and ", "timestamp": . Anyone? Thanks!
-
Fr33b0w reacted to a post in a topic: The Missing Mouse
-
At this point that is science fiction to me (and I don't know much about science fiction yet). It would take ages really. Line 583 (File "L:\autoit\scripts_date\#examples_en\Audio Visualization with GDI+ Bass\Visualization.au3"): $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) $aRet = DllCall(^ ERROR Error: Variable used without being declared. I did try to change some of it (like Melba suggested) but had no luck in getting it to work. Still learning and looking at examples, will leave this a side. Maybe sometime in the future I would be able to get what is wrong with it.
-
Can someone update this please so some of us less experienced can enjoy this too