09-07-2007, 12:52 AM
how can i remove 1 line from a text document without opening it
removing a line from a text document
|
09-07-2007, 12:52 AM
how can i remove 1 line from a text document without opening it
09-07-2007, 12:59 AM
Kevin Wrote:how can i remove 1 line from a text document without opening itcould you please explain what your trying to do? I'm totally lost with this question, maybe if I understood, I could help, not being rude or anything, I just want to help you, I just don't understand. ------ edit: you mean to remove a sentence in a notepad .txt file without even opening it up ?
09-07-2007, 01:09 AM
i am checking a inside a file for a text then trying 2 remove that text from the file.But the catch is the file isn't open at all
09-07-2007, 01:10 AM
i know how 2 find the specific text inside the file just not how 2 remove it
09-07-2007, 01:14 AM
Kevin Wrote:i know how 2 find the specific text inside the file just not how 2 remove ithock: can you post your code? I may be able to make a str for the text found & delete it. just need 2 get started off with the code :lol: --- edit: because idk how 2 get the text from a non-open file, & it would make it much easier to expierment with deleteing the found text if I knew how to get the text. :lol: --- edit again: you don't gotta post the whole code, just show me how to get the text of a file not opened, & I can come up with something most likely to delete the specified text.
09-07-2007, 01:42 AM
09-07-2007, 01:44 AM
09-07-2007, 02:42 AM
I have never tried something like this before but I would say try using something like this:
For end of macro: ,if b=s ,,a.findreplace(b) ,a.setfile("$Desktop$\test.txt" -1) I don't know if this would work or not but it might be worth a shot.
Taking on Quick Macros one day at a time
09-07-2007, 03:14 AM
not quite. it did delete the entry after it added everything else again but the orignal line was still there
09-07-2007, 03:25 AM
ok i managed 2 delete the line but it is replace but a blank line now
09-07-2007, 03:29 AM
i got it had 2 delete the file first
ty for your help
09-08-2007, 06:42 AM
ok it works but only problem is it leaves a blank line in the file
09-08-2007, 06:50 AM
09-08-2007, 03:14 PM
Check this post out it will show you how to delete a line without leaving a blank line.
http://www.quickmacros.com/forum/showthread.php?tid=497
09-08-2007, 05:00 PM
str a You must have Member function str.RemoveLineN (To add new Member function) while QM window is active press and release (Ctrl+Alt+N) this will add a new Member function make sure you name the new Member function (str.RemoveLineN), and add the below code to it. str.RemoveLineN function# lineindex [nlines]
09-09-2007, 03:59 AM
ty for your rsponse i looked at that and tried it and again for some reason i have 2 dlete the file and resave it also had 2 add a code 2 count the lines but that was no biggie.if i don't delete the file it adds every other name again and doesn't delete the entry i wanted except on the when it adds all the lines in the file again 2 the file
09-09-2007, 04:11 AM
If you use flag (-1) with setfile it will append the text to the file not replace it like you're wanting to do, don't use any flag at all. As far as the counting I dont know why you would have to do that, numlines() will do that for you.
09-09-2007, 04:19 AM
ok ty yeah once i removed the flag it works without deleting but i have 2 get the line count cause the entry could be on any line. maybe line 5 our could be line 25 u never know.so i just made it count the line so i had the line number 2 delete.Cause it won't let me use anything but a number or an integer in this line
a.RemoveLineN(x)<-----x being an integer
09-09-2007, 04:26 AM
Sounds like you have it then ?
09-09-2007, 04:33 AM
yes i do tyvm.I didn't use the numblines line cause i wasn't sure how 2 implement it.So that's why i had 2 adapt it 2 count the lines
09-09-2007, 06:26 AM
Glad I could help.
09-25-2007, 05:43 AM
i'm having a problem saving a file if the text begins with things like this
**== ^^ any thoughts why?
09-25-2007, 07:44 AM
what is happening is if the text of the window starts with characters like that i can't save the file name as that text of the window
09-25-2007, 08:20 AM
Member function str.ReplaceInvalidFilenameCharacters. Create it using menu File -> New -> New Member Function.
function# [$replaceto] |
« Next Oldest | Next Newest »
|