Solved

Scripts for open a document a find its keyword

Posted on 2003-11-26
9
219 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Dbf export problem to a Visual Foxpro application 6 161
add combobox item based on numbers 9 122
Delphi - replicating a form 8 65
tidtcpserver connection lost handle 2 70
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now