Source language: Translate to:

Delete Name In Text Line

General questions about NeoBook

Moderator: Neosoft Support

Delete Name In Text Line

Postby StarterPack » Tue Apr 19, 2016 12:22 am

Hi Guys,

If I have an external .txt file with names:
John
Peter
Robert
Anne
Gary

What script do I use to search for lets say; Anne in the text file and then delete that name.
Thank You
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Delete Name In Text Line

Postby mishem » Tue Apr 19, 2016 12:34 am

Using the plugin hpwControl

Code: Select all
hpwLineNumber "The path to the file" "Anne" "" "[Num]"
FileDelLine "The path to the file" "[Num]"


or without the plugin

Code: Select all
FileRead "The path to the file" "All" "[Text]"
SearchStr "Anne" "[Text]" "[SearchStr]" ""
StrDel "[Text]" "[SearchStr]" "4" "[Text]"
FileWrite "The path to the file" "All" "[Text]"


or

Code: Select all
FileRead "The path to the file" "All" "[Text]"
StrReplace "[Text]" "Anne" "" "[Text]" ""
FileWrite "The path to the file" "All" "[Text]"


or

Code: Select all
FileRead "The path to the file" "All" "[Text]"
StrReplace "[Text]" "Anne[#13][#10]" "" "[Text]" ""
FileWrite "The path to the file" "All" "[Text]"


Can be used ListBox.
Can be used StrParse.
etc.
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: Delete Name In Text Line

Postby StarterPack » Tue Apr 19, 2016 5:48 am

Hi mishem

Thank You For Your Quick Reply!
I'll Check Which One Works For Me. Thanks Again!!!
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Delete Name In Text Line

Postby StarterPack » Tue Apr 19, 2016 9:32 am

Hi mishem

I've tested it and it works fine when i loaded the text file in a "TextEntry"

but what i need is..

When i startup my program it loads A.txt file into [ListBox]
example:
Anne
Albert
Aubrie
etc
In ListBox 'Double Click" i add
SetVar "[TextName]" ""
StrIns " [ListBox1]" "[TextName]" "" "[TextName]"
This will load the name that i double click in the ListBox to [TextName]

Now when i click a buttom it must search for the [TextName] name in A.txt and delete it from the text file.
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: Delete Name In Text Line

Postby mishem » Tue Apr 19, 2016 11:43 am

Image

Image
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: Delete Name In Text Line

Postby StarterPack » Tue Apr 19, 2016 1:53 pm

Mishem

Thank you so much! This works great!
There will only be a problem if you SORT the ListBox, is there a way around that?
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: Bing [Bot] and 2 guests