About Registration Send E-mail to author

Smart HTML Editor Quick Start - Step 3

[Step 1] [Step 2] [Step 3] [Step 4] [Step 5]

Press "CTRL+E" to show the Pascal Script Editor. Create new script (press "CTRL+N"). Into editor type the following:

Program th_tag;
var
  Form: TForm;
  OkButton, CancelButton: TButton;
  Edit: TEdit;
  L1: TLabel;
  SF: TSF;                   

procedure buttonclick(sender: TObject);
begin
  SF.AddText('</TH>');
  Form.Close;
end;

procedure OkButtonClick(sender: TObject);
begin
  sf.AddText(Edit.Text+'</TH>'); 
  Form.Close;
end;

Begin
  SF:=TSF.Create;
  sf.AddText('<TH>');
  Form := TForm.Create(self);
  Form.Width := 410;
  Form.Height := 130;
  Form.BorderStyle := bsDialog;
  Form.BorderIcons := [biSystemMenu];
  Form.Caption := 'Set "TH" tag elements';
  Form.Position := poScreenCenter;
  L1 := TLabel.Create(Form);
  with L1 do
    begin
      Top := 10;
      Left := 20;
      Caption := 'Enter header of the table column';
      Parent := Form;
    end;
  Edit := TEdit.Create(Form);
  with Edit do
    begin
      Font.Name := 'Tahoma';
      SetBounds(10,30,380,50);
      Parent := Form;
    end;
  CancelButton := TButton.Create(Form);  
  with CancelButton do
    begin
      Left := 310;  
      Top := 65;
      Width := 80;
      Height := 24;
      Caption := '&Cancel';
      OnClick := @buttonclick;
      Parent := Form;  
      Default := False;
    end;
  OkButton := TButton.Create(Form);  
  with OkButton do
    begin
      Left := 220;
      Top := 65;
      Width := 80;
      Height := 24;
      Caption := '&OK';
      OnClick := @OkButtonClick;
      Parent := Form;  
      Default := True;
    end;  
  Form.ShowModal;
  while Form.Visible  do
  begin
    Application.HandleMessage;
  end;
  SF.Free;
  Form.Release;
End.  

You can also copy-paste this source:). Save this script as ht.ps into the "Scripts" subfolder in the Smart HTML Editor program folder. After this you can compile and run this script (press F9) button. The script is showing into the Scripts Panel, and compiled code place into ht.cps file.

New ht.ps script is running!!!

Now, we can add this script into autoreplacement patterns - open the patterns.ini file into Smart HTML Editor program folder and add this lines into the end of file:

   ,th|=th.ps
   <th|=th.ps

After this save the file patterns.ini and you can use autoreplace function for the "<TH>" tag.

ht.ps script in autoreplacement function

Prewiew this (CTRL+W), and lets go to the next step - add preview into Opera functionality.

Copyright © Dmitry Spitsyn, 2007

[Step 1] [Step 2] [Step 3] [Step 4] [Step 5]

Sponsors: