Solved

Scripts for open a document a find its keyword

Posted on 2003-11-26
9
218 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

21 Experts available now in Live!

Get 1:1 Help Now