SuperEdi

User: Guest

Search

Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Juke
QBrowser
Raduga (English)
Song Requester

Automation

Posted on: SuperEdi

From Message

Neil Martin

2003-05-22 01:55:02

Automation

I want to use SuperEdi as the target for log information. As such I want to use the automation capabilities to write the log information using vbs. I can't see how I can move the selection or change the insertion point in the document. The selection always gets overwritten. I dont't want to have to get the document text, append the text the set the document text.

thanks for any help
Neil

Wolfgang Loch

2003-05-22 05:02:28

Re: Automation

The idea is to set insertion point (Seletion.CurrentColumn/Seletcion.CurrentLine) to the end of the document and then set Selection.Text to the text to be appendend. Before you append another text, move the insertion point again to the document end.

Alternately you can use the Console object for log output. Here you can simply use the Console.WriteLine function.

Neil Martin

2003-05-22 08:32:54

Re: Automation

Wolfgang,

I've included a small script that highlights the problem - I cant move the selection.
Am I doing something wrong?

Dim app
Set app = CreateObject("SuperEdi.Application")
app.Visible = true
app.Documents.Add

Dim doc
Set doc = app.ActiveDocument

doc.Text = "Line 1" & vbcr

Dim sel
Set sel = doc.Selection
sel.CurrentLine = 1 ' this works - I see the cursor moved to the next line

sel.Text = "Line 2" & vbcr ' this works

' The following doesn't work - I can't move the selection to the end of the
' document
sel.CurrentLine = 2
sel.CurrentColumn = 0

sel.Text = "Line 3" & vbcr ' This overwrites line 2

Wolfgang Loch

2003-05-22 14:51:48

Re: Automation

You are right, it doesn't work, because you can't get rid of the selection. Writing to the FirstLine, LastLine, FirstColumn and LastColumn has actually no effect.
I just fixed this and uploaded version 3.2.5:
http://www.wolosoft.com/files/SuperEdi-3.2.5U.exe

Now you can change the selection and append text like this:

doc.Text = ""

InsertText "Line 1" & vbcr
InsertText "Line 2" & vbcr
InsertText "Line 3" & vbcr

Sub InsertText( Text )
Dim sel
Set sel = doc.Selection
sel.Text = Text
sel.FirstLine = sel.LastLine
sel.FirstColumn = sel.LastColumn
End Sub

Post a reply to this message: