Jamie,
You need to keep track of the previous text of the object, this will enable
you to find the object in the WIN_INFO_TABLE of your Layout.
Below is some code that does a similar job. The SubstGenericText(sText)
function should be replaced by some code that checks if the value of sText
is the one you're looking to substitute.
Best regards
Erik
Erik R Nielsen
Senior Consultant
Atkins Transport Planning
Euston Tower
286 Euston Road
London NW1 3AT
* Tel : 020 712 12393
* Fax : 020 712 12111
E-mail: [EMAIL PROTECTED]
www.atkinsglobal.com
Sub SubstGenericTextInLayout()
OnError Goto ErrHap
Dim iWin, i,j as Integer
Dim sWin, sText as String
Dim oOld, oNew as Object
Dim aLay as Alias
Dim oFont as Font
Dim fSpacing,fAngle,x1,y1,x2,y2 As Float, iJustify As Integer,sJustify as
String
' Print Chr$(12)
Set CoordSys Layout Units "cm"
iWin = FrontWindow()
if WindowInfo(iWin,WIN_INFO_TYPE) = WIN_LAYOUT then
sWin = WindowInfo(iWin,WIN_INFO_Table)
Select * From sWin
aLay = sWin+".obj"
j = SelectionInfo(SEL_INFO_NROWS)
Fetch First From sWin
oNew = aLay
i=0
Do while (i<j)'Not EOF(sWin) 'l
i=i+1
if ObjectInfo(oNew,OBJ_INFO_TYPE) = OBJ_TYPE_TEXT Then
sText = ObjectInfo(oNew,OBJ_INFO_TEXTSTRING)
sText = SubstGenericText(sText)
'''Put this code in an If Then End If Condition.
oFont = ObjectInfo(oNew,OBJ_INFO_TEXTFONT )
fSpacing = ObjectInfo(oNew,OBJ_INFO_TEXTSPACING )
iJustify = ObjectInfo(oNew,OBJ_INFO_TEXTJUSTIFY )
sJustify = StringJustify(iJustify)
x1 = ObjectGeography(oNEw,OBJ_GEO_MINX)
y2 = ObjectGeography(oNEw,OBJ_GEO_MINY)
x2 = ObjectGeography(oNEw,OBJ_GEO_MAXX)
y1 = ObjectGeography(oNEw,OBJ_GEO_MAXY)
fAngle = ObjectGeography(oNEw,OBJ_GEO_TEXTANGLE)
Create Text Into Variable oNew sText (x1,y1) (x2,y2) FONT oFont
SPACING fSpacing JUSTIFY Left Angle fAngle
Do Case iJustify
Case 0
Create Text Into Variable oNew sText (x1,y1) (x2,y2) FONT oFont
SPACING fSpacing JUSTIFY Left Angle fAngle
Case 1
Create Text Into Variable oNew sText (x1,y1) (x2,y2) FONT oFont
SPACING fSpacing JUSTIFY Center Angle fAngle
Case 2
Create Text Into Variable oNew sText (x1,y1) (x2,y2) FONT oFont
SPACING fSpacing JUSTIFY Right Angle fAngle
End Case
Update sWin Set obj = oNew WHere RowId = i
oOld = aLay
sText = ObjectInfo(oOld,OBJ_INFO_TEXTSTRING)
'''
End If
Fetch Next From sWin
oNew = aLay
Loop
Select * From sWin Where 1=2
End If
Exit Sub
ErrHap:
Print Err() + ":" + Error$()
End Sub
This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12334