variable interpolation problem b30

Need help with a script? This is the place to discuss how to get your code running!

variable interpolation problem b30

Postby vinnie-bob » Thu Jan 11, 2018 1:29 pm

OK, create a new field on a card and enter some text (one, two, three) one word on each line.

Make a button with script:
Code: Select all
on mouseUp
  find word "two" in cd fld 1
  put foundline() into targetLine
  set the textstyle of targetLine to bold
end mouseUp


Click button and I get "SC Error 2: can't understand arguments" and it seems the problem is the last line of the script.
Foundline returns "line 2 of card field 1" and if you enter "set the textstyle of line 2 of cd fld 1 to bold" in the message box and hit return, that works. Somehow the interpreter is choking on interpolation of targetLine, I think.

Can anyone confirm?


----------------

System info:
Software:

System Software Overview:

System Version: macOS 10.13.2 (17C205)
Kernel Version: Darwin 17.3.0

Hardware:

Hardware Overview:

Model Name: MacBook Pro
Model Identifier: MacBookPro13,3
Processor Name: Intel Core i7
Processor Speed: 2.9 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 8 MB
Memory: 16 GB
Boot ROM Version: MBP133.0233.B00
------
vince
------
User avatar
vinnie-bob
 
Posts: 221
Joined: Sun Jul 06, 2008 10:55 am
Location: Des Moines, Iowa, USA

Re: variable interpolation problem b30

Postby johnjohnston1 » Thu Jan 11, 2018 9:51 pm

Hi Vince,
I see the same thing in SC 4.7.3
I think you need to use do
Code: Select all
do "set the textstyle of " & targetline & " to bold"

Which works here in 4.7.3

Cheers

John
User avatar
johnjohnston1
 
Posts: 196
Joined: Sun Jul 06, 2008 10:42 am
Location: Glasgow, UK

Re: variable interpolation problem b30

Postby vinnie-bob » Fri Jan 12, 2018 7:06 pm

Thanks, John. Roundabout, but works.
------
vince
------
User avatar
vinnie-bob
 
Posts: 221
Joined: Sun Jul 06, 2008 10:55 am
Location: Des Moines, Iowa, USA


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest

cron