Solved

Scripts for open a document a find its keyword

Posted on 2003-11-26
9
221 Views
Last Modified: 2010-04-05
anyone has scripts that can search for keywords for a document?  or  scripts that can search a document by giving a phrases or sentences in the document, e.g. advanced search function in windows.

thank yuou!!!
0
Comment
Question by:jiekuan
  • 4
  • 3
  • 2
9 Comments
 
LVL 2

Expert Comment

by:TheLeader
ID: 9830025
it needs more points than you just set
but heres a solution from million ;)

procedure findmore;
begin
   find (Masked {.txt,log,...) files
   open each file
   search the word
   if matched word then exit
   else
   findmore
end
hope it helped...
0
 

Author Comment

by:jiekuan
ID: 9833467
TheLeader, the algorithm you post is correct, can i have more precise solution, maybe the exact code , thank you. btw i have increased point to 100.
0
 

Author Comment

by:jiekuan
ID: 9833476
e.g.  what is the code for  "search the word" ...etc
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
TheLeader earned 100 total points
ID: 9835033
well i made it very Simple,to let you change the code easily
if you would like the complete project by Email, its ok
any way this is the code

{**********************************************}

unit fileU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, FileCtrl, StdCtrls;

type
  TForm1 = class(TForm)
    DriveComboBox1: TDriveComboBox;
    DirectoryListBox1: TDirectoryListBox;
    FileListBox1: TFileListBox;
    FilterComboBox1: TFilterComboBox;
    Button2: TButton;
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

Function SearchWord(F,Word : String): Boolean;
Var
  Temp : String;
  FileName : TextFile;
  I : Integer;
Begin
  Assign(Filename,F);
  Reset(Filename);
  While Not EOF(Filename) Do
  Begin
    Readln(Filename,Temp);
    I := Pos(Word, Temp);
    IF I > 0 Then
    Begin
      Result := True;
      Close(Filename);
      Exit;
    End;
  End;
  Result := False;
  Close(Filename);
End;

procedure TForm1.Button1Click(Sender: TObject);
Var I : Integer;
begin
IF filelistbox1.Items.Text <> '' Then
For I := 0 To Filelistbox1.Items.Count-1 DO
  IF SearchWord(DirectoryListBox1.Directory +'\' + Filelistbox1.Items.Strings[i]
                ,Edit2.Text) Then
  Begin
    Edit3.Text := 'YES';  // yes I Found the word
    Filelistbox1.Selected[I] := true; // to show you which file it has the word
    Break;
  End
  Else
    Edit3.Text := 'No' // No I Did't Found it
else
  edit3.Text := 'I Can''t make a search'; // Theres No Files
//  Edit2.Text := ;
End;

end.
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9844332
"jiekuan" accept my answer or leave a comment !!!
0
 

Author Comment

by:jiekuan
ID: 9894263
sorry to TheLeader, i have been overseas for past one week. not accessible to internet
0
 

Expert Comment

by:plovel
ID: 9919056
TheLeader, em..   what i wan is to open document files ( .txt and .doc) and examine all words inside the docuemnt. then find out the keyword of the document ( i.e.  most occurence frequencies, any other criteria )..
0
 

Expert Comment

by:plovel
ID: 9934275
check your email, i have sent you a tutorial file for this.
0
 

Author Comment

by:jiekuan
ID: 9934320
TheLeader, can i have your email address, so that i can consult you for more, thank you
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 151
Controlled Assessment GCSE - desperate help needed 4 110
Tvertscrollbox like a whatsapp layout 5 50
Delphi, TImage, Png 2 17
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question