Solved

Scripts for open a document a find its keyword

Posted on 2003-11-26
9
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Independent Software Vendors: 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

623 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