program builder Posted April 4, 2009 Share Posted April 4, 2009 Lets say I have a notpad that has this written in it 1 note pad saying number one 2 notepad sayig number 2 is there anyway i can write a code that says something like open("file.text") find("1") nextline = ("copy") close("file.text") filewrite("file.html/paste") and get the words written in the text file to go into the new html document? obvourse that wouldn't be the accaul code, but is there any way to do it? Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 $sStr = FileRead("C:\Some\File.txt") $sHTML = "<html><head></head><body>" & @LF $sHTML &= _Find("1") & @LF & "</body></html>" $hFile = FileOpen("C:\Some\File.htm", 2) FileWrite($hFile, $sHTML) FileClose($hFile) Func _Find($sWhatToFind) $aFound = StringRegExp($sStr, "(?i)(?m:^)(.*" & $sWhatToFind & ".*)", 1) If Not @Error Then Return $aFound[0] Return "" EndFunc George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 WhatToFind? is there any way that i can tell it to just write the intire next line? what I am trying to do is make it to where I don't have to add all the words to the program. if i can just add numbers to the program, I can do it alot faster. Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 (edited) WhatToFind?is there any way that i can tell it to just write the intire next line?what I am trying to do is make it to where I don't have to add all the words tothe program. if i can just add numbers to the program, I can do it alot faster.That is pretty much what he did, but alternatively, you can use FileReadLine()or you can format it like an .ini and use IniRead() Edited April 4, 2009 by maqleod [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 (edited) I used this text from your post to test with ; open("file.text") find("1") nextline = ("copy") close("file.text") filewrite("file.html/paste") ; The _Find function returned find("1") If it's the following line that you want then change $aFound = StringRegExp($sStr, "(?i)(?m:^)(.*" & $sWhatToFind & ".*)", 1) To $aFound = StringRegExp($sStr, "(?i)(?m:^).*" & $sWhatToFind & ".*\v(.*)", 1) Edited April 4, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 (edited) That worked; thank you for helping me out. Edited April 4, 2009 by program builder Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 That worked; thank you for helping me out.You're welcome George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 (edited) Sorry, but i found out it's not going to work. every time I try to put a new word into the html with this code, it copies over what was just written. I need it to put words in, every time I use it, not copy over each thing I say, and only have one word in the html file. Is there another code, that would work? Edited April 4, 2009 by program builder Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 Sorry, but i found out it's not going to work. every time I try to put a new word into the html with this code, it copies over what was just written. I need it to put words in, every time I use it, not copy over each thing I say, and only have one word in the html file. Is there another code, that would work?try using FileWriteLine() instead of FileWrite() [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 I tryed that and it didn't work. Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 I tryed that and it didn't work.only other thing I can think to try is a bit messier, but it should work: _FileCountLines and _FileWriteToLine - but not in overwrite mode, to find and write to the last line [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 only other thing I can think to try is a bit messier, but it should work: _FileCountLines and _FileWriteToLine - but not in overwrite mode, to find and write to the last lineI don't want to do counttoline or filewritetoline because every time i tryed to add that same word again, it would probibly just copy over its own word, and not even put it as the next word. Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 I don't want to do counttoline or filewritetoline because every time i tryed to add that same word again, it would probibly just copy over its own word, and not even put it as the next word.if you don't use _FileWriteToLine() in overwrite mode it will not overwrite. [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 $sStr = FileRead("C:\Some\File.txt") $sHTML = "<html><head></head><body>" & @LF For $1 = 1 To 20;; Change this to suit your purposes $sText = _Find("1");& @LF & "</body></html>" If $sText Then $sHTML &= $sText & @LF Else ;; Put Some error code here (Like ExitLoop) EndIf Next $hFile = FileOpen("C:\Some\File.htm", 2) FileWrite($hFile, $sHTML & "</body></html>) FileClose($hFile) Func _Find($sWhatToFind) $aFound = StringRegExp($sStr, "(?i)(?m:^)(.*" & $sWhatToFind & ".*)", 1) If Not @Error Then Return $aFound[0] Return "" EndFunc George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
program builder Posted April 4, 2009 Author Share Posted April 4, 2009 (edited) it is not working. What I am trying to do, is create a web-browser, where you can view pages that people create without any form of connection whatsoever. So what I am going to do is put every word in the english dictionary, as well as every persons first name and last name, numbered 1 through whatever example 1 aardvark 2 ext 3 another name and then people can create a website, and the numbers will be the address to get to it. I would like to also put about 50,000 sayings into it, so that it will shortan the address, and i would like to be able to turn the address into like 123.456.789. if you get the picture. thanks for helping. And if you know of a simpler way to do this please let me know. I am going to probably find a list of english words online, and then find a program out there that will number each one of them. like number one on line 1 number 2 on line three, ext, ext. if any of you would want to help me create this, I will start a chat about it, so please let me know. Edited April 4, 2009 by program builder Link to comment Share on other sites More sharing options...
maqleod Posted April 4, 2009 Share Posted April 4, 2009 it is not working. What I am trying to do, is create a web-browser, where you can view pages that people create without any form of connection whatsoever. So what I am going to do is put every word in the english dictionary, as well as every persons first name and last name, numbered 1 through whateverexample1aardvark2ext3another nameand then people can create a website, and the numbers will be the address to get to it. I would like to also put about 50,000 sayings into it, so that it will shortan the address, and i would like to be able to turn the address into like 123.456.789. if you get the picture. thanks for helping. And if you know of a simpler way to do this please let me know. I am going to probably find a list of english words online, and then find a program out there that will number each one of them. like number one on line 1 number 2 on line three, ext, ext. if any of you would want to help me create this, I will start a chat about it, so please let me know.honestly, I would look into using a database, look at the SQLite UDFs, you might find it easier to do this sort of thing that way [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 Do you have any idea how many words are in the english language?This site only contains the words form 2 to 16 letters and you can see how long those files are.http://www.theargon.com/achilles/wordlists/. Also you would be better off to number the begining of each line instead of inserting a line above it (thereby doubling the number of lines). DataBase or separate array's based on the first letter would be the way to go. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2009 Share Posted April 4, 2009 (edited) Here is a short example of what I mean by the line numbering.1 aardvark2 aardwolf3 aaron4 aback5 abacus6 abaft7 abalone8 abandon9 abandoned10 abandonment11 abandons12 abase13 abased14 abasement15 abash16 abashedWorking from that (my full list is over 58000 words), the regexp becomes simple. by the way, I created the list by first writing a list to an array and adding the number + space to the array elements. so it would be possible to just call the array elements by number as well.Edit: The list is British spelling only with hyphens removed. If you also want American spellings then they would have to be added. Edited April 4, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2009 Developers Share Posted April 4, 2009 *click* because you are on your own on this one as you made a claim for it somewhere else. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts