SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SIL Editor ExportTo automation method

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Tue Sep 23, 2008 11:37 am    Post subject: SIL Editor ExportTo automation method Reply with quote

Using automation I can export a SIL file to a SIB file:

Code:
    FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile(SILFILENAME, 'Captions', False);
      FIntf.ExportTo(SIBFILENAME, etSIB);   
    finally
      FIntf := UnAssigned;
    end;


Can a SIB file be exported to an SIL file using automation? In the SIL Editor itself, SIL appears as an option when exporting manually.

If not, is there any other way of performing this automatically?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Wed Sep 24, 2008 6:21 am    Post subject: Re: SIL Editor ExportTo automation method Reply with quote

Just use the same code:
Code:
    FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile([b]SIBFILENAME[/b], 'Captions', False);
      FIntf.ExportTo([b]SILFILENAME[/b], etSIB);   
    finally
      FIntf := UnAssigned;
    end;


Actually, etSIB is incorrectly declared. Sad It must be etTsiLang which "tells" SIL Editor to perform the conversion from one format to another.
Back to top
View user's profile Send private message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Wed Sep 24, 2008 9:00 am    Post subject: Reply with quote

Hi.

Do you mean like this:

Code:
FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile(SIBFILENAME, 'Captions', False);
      FIntf.ExportTo(SILFILENAME, etTsiLang);
    finally
      FIntf := UnAssigned;
    end;


because this produces a compiler error:

undeclared identifier 'etTsiLang'

Which is what I get if I try using etSIL to go from a SIB to a SIL:

Code:
FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile(SIBFILENAME, 'Captions', False);
      FIntf.ExportTo(SILFILENAME, etSIL);
    finally
      FIntf := UnAssigned;
    end;


undeclared identifier 'etSIL'

Using v5.0.0.2 of the TsiLangFiles Editor, with v6.3 TsiLang Components Suite. The type library produced imported from SILEditor.exe only declares these types:

Code:
// Constants for enum TExportType
type
  TExportType = TOleEnum;
const
  etCSV = $00000000;
  etHTML = $00000001;
  etDOC = $00000002;
  etXLS = $00000003;
  etSIB = $00000004;
  etXML = $00000005;


i.e. no etSIL or etTsiLang.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Wed Sep 24, 2008 11:15 am    Post subject: Reply with quote

No, I mean to use exactly etSIB when exporting to SIL file too. It is just incorrectly declared in our code for SIL Editor type library.
Back to top
View user's profile Send private message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Wed Sep 24, 2008 11:21 am    Post subject: Reply with quote

OK thanks. I re-read your post after I posted, and realised that is probably what you meant.

Unfortunately, I can't seem to export from a SIB file at all. The code I gave above for exporting a SIL file to a SIB file works fine every time. In fact, exporting from a SIL file to any other format works using the automation method.

However, given a SIB file, the ExportTo method simply does nothing, no matter which export type I choose. The call to EditFile() correctly opens the SIB file in SIL Editor, but the next line just does nothing. I have tried etSIB, etHTML, etXLS and etCSV with no resulting file.

Any ideas? Thank you.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Wed Sep 24, 2008 12:40 pm    Post subject: Reply with quote

The following code works just fine:
Code:

procedure TForm1.TntButton1Click(Sender: TObject);
var
   FIntf: Variant;
begin
  FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile(Edit1.Text, 'Captions', False);
      FIntf.ExportTo(Edit2.Text, 4);
    finally
      FIntf := UnAssigned;
    end;
end;

Except there will be a prompt for a Delimiter for SIL file.
Back to top
View user's profile Send private message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Wed Sep 24, 2008 12:50 pm    Post subject: Reply with quote

From what I can tell, that is exactly the same as:

Code:
procedure TForm1.TntButton1Click(Sender: TObject);
var
   FIntf: Variant;
begin
  FIntf := CreateOleObject('SILEditor.SilEditorIntf');
    try
      FIntf.EditFile(Edit1.Text, 'Captions', False);
      FIntf.ExportTo(Edit2.Text, etSIB);
    finally
      FIntf := UnAssigned;
    end;
end;


I tried it and it behaved the same, just did nothing. No file is created.
Back to top
View user's profile Send private message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Tue Sep 30, 2008 11:48 am    Post subject: Reply with quote

If anyone is interested, Igor has made a new version of the SIL Editor available (v5.0.0.3) which corrects this:

Igor Siticov wrote:
Please try to download updated version of SIL Editor from our site. We've found small piece of code that might cause such behavior and fixed it.


The only thing is that converting a SIB to a SIL, although it now works, asks for the delimiter to be entrered. SIL to SIB doesn't ask.
Back to top
View user's profile Send private message
jsweby



Joined: 21 May 2008
Posts: 32

PostPosted: Thu Oct 02, 2008 8:15 am    Post subject: Reply with quote

Igor Siticov wrote:
We will update SIL Editor to don't ask for delimiter when used from COM


v5.0.0.4 of SILEditor.exe provides this functionality. However, now the delimiter returns to the default ~!@#, which isn't the delimiter I had originally specified.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Oct 02, 2008 9:29 am    Post subject: Reply with quote

When exporting to SIL from SIB using COM service SIL Editor doesn't ask for delimiter and as result it uses the default one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group