Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 8:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Is there a script I can use to change the font of a particul
PostPosted: February 11th, 2008, 10:09 pm 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Hi

Am creating a phonics package for schools, and due to my character set, I need the ability to change font if a specific letter (k) appears in a text box. I know how to search for the letter K, but have no idea of any scripting to change the font. Any help would be appreciated!

Thanks,

Paul

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 12th, 2008, 6:51 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Use SetSelectionStyle()

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: SetSelectionStyle()?
PostPosted: February 12th, 2008, 11:26 am 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Hi

I have never used a script before, so whilst I know how to trigger it, I don't know any of the syntax involved. What do I need to put in the brackets to (a) select which text box to work with, and (b) which font to change to?

Thanks,

_Paul

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 12th, 2008, 2:23 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Paul,

The Opus help is very good at explaining script commands, but here's a function that will change the selected text's type face:


Quote:
//This is the function you call to change the type face
function changeStyle()
{
//You don't need this line as you are already selecting the K's. This simply selects all the text
//in the box.
myText.SetSelection(0,-1)

//this creates a new object to hold the properties for the typeface.
//You can include all properties here - size / bold / face / etc
var newStyle = new Object()
//This is the type face proeperty. Use the name of the font form the Font Folder in the control panel
newStyle.fontname = "Cooper Black"

//This changes the text style that is selected (highlighted) to the new style
myText.SetSelectionStyle(newStyle)

}


NOTE: The myText is the name of the object (textbox) on the page NOT a variable storing text!!!

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 12th, 2008, 2:50 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
THis is an example.I hope that will make it clear.


You do not have the required permissions to view the files attached to this post.

_________________
Win windows 7
Opus Pro 9.5


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 50 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group