IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#30377 - 09/21/09 10:20 PM Variable Bold
BWW Offline
OL Guru

Registered: 02/26/04
Posts: 120
Loc: Bryan, Texas
We have a issue where we receive a string of text like this...

"This is a test This is a test This is a test"

Is there a way using talk to bold the text between the and ?

Top
#30378 - 09/22/09 09:44 AM Re: Variable Bold
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
BWW,

Here's a sample PressTalk object code that you could use:
Code:
define(&i, integer, 0)
define(&bolding, boolean, False)
define(&writing, boolean, True)
define(&data, string, '')

&data := @(1,1,100)

for(&i,1,1,length(&data))
  if(mid(&data, &i, 1) = '<')
    &writing := False
  endif()
  if(not(&writing))
    if(mid(&data, &i, 2) = '/b')
      &bolding := False
    elseif()
      if((mid(&data, &i, 1) = 'b') and not(mid(&data, &i-1, 1) = '/'))
        &bolding := True
      endif()
    endif()
    if(mid(&data, &i, 1) = '>')
      &writing := True
    endif()
  elseif()
    if(&bolding)
      setstyle(&Style1.b)
    elseif()
      setstyle(&Style1)
    endif()
    show(mid(&data, &i, 1))
  endif()
endfor()
The "data" variable contains the string, which could be any strings from your data(in this case, it's the first line, columns 1 to 100). It calls the style "Style1.b" to make it bold, and just "Style1" to make it normal.

Hope that helps.

Regards,
Rapha

Top
#30379 - 09/22/09 10:57 AM Re: Variable Bold
BWW Offline
OL Guru

Registered: 02/26/04
Posts: 120
Loc: Bryan, Texas
Cool! That looks like it will work.

Brandon

Top