Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Text variables
PostPosted: October 22nd, 2009, 12:00 pm 
Offline

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

Is there any way to cut part of a text variable, or to count its length? Trying to produce a tabulated set of results, and can't seem to find any way to ensure two variables always are the same length?

eg of 2 current variables:

Paul Smith 5 times tables 17 out of 20
Sarah-Louis Jones 8 times tables 5 out of 20

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


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 22nd, 2009, 12:56 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Use length to find the length and substring to extract.

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: October 22nd, 2009, 1:36 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Expanding on that idea...

Set a dummy variable to have a value of say 22 'spaces'. Then when you've determined the length of 'Paul Smith' is 10, you replace the first 10 chars of the dummy. Alternatively, you could forget the dummy var and just pad the Paul Smith value with 22-10 space characters. (presumably you'd have to use ascii code or esc char for that?)

Another way to create tabulated results is to line up several ListBox objects. They can be without borders. Can hide the scrollbar. Can synchronize their vertical scroll positions using opus script. If you use Arrays for this, then you will have an easy way to define and recall these SETS by the array index number. Several prior Posts on array and object-oriented etc.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject:
PostPosted: October 22nd, 2009, 2:14 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Expanding further...

"Paul Smith\t5 times tables\t17 out of 20"

tab or \t or if you're old enough in the UK tab a delightful clear sugar free drink.

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: Text Variables
PostPosted: October 22nd, 2009, 2:54 pm 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Thanks very much. Do I have to enter a script action? If so, for a variable X, what do I type into the script box to find its' length?


Also, is there any command that will move, say the first two characters of a variable into another variable?

Thanks!

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


Top
 Profile Visit website  
 
 Post subject: Variables
PostPosted: October 22nd, 2009, 5:20 pm 
Offline

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

I tried setting a variable, a, to equal Paul Smith\t5 times tables\t17 out of 20 but when I did so, I didn't get anything tabbed, it just showed:

Paul Smith\t5 times tables\t17 out of 20

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


Top
 Profile Visit website  
 
 Post subject: Variable Length
PostPosted: October 26th, 2009, 8:35 pm 
Offline

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

You wrote:

Use length to find the length and substring to extract

What do I need to type into the script dialogue box to use these commands? If I want to find out the length of a variable (say called variablea), and to get the result into another variable (say variableb) - what should I enter?

Many thanks

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


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 27th, 2009, 12:08 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
"Paul Smith\t5 times tables\t17 out of 20"

It's not a literal - you need to evaluate it in a script or use / assign to an expression.

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: Text Variables
PostPosted: October 27th, 2009, 1:21 am 
Offline

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

I've never used scripting and have no idea what to enter into the script dialogue to get this to work. I followed the instructions as I understood them, and don't know what you mean when you say I need to evaluate it in a script or use / assign to an expression

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


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 27th, 2009, 8:39 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
In a script object or script action do something like:

myOutput = "Paul Smith\t5 times tables\t17 out of 20"


Then simply use the variable as normal.

___________________________________________________________

Opus uses expressions in various places including when you right click in a text box and 'Insert Variable' or when you create an action - 'Programming - Variables - Set Variable to Expression'

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: tEXT vARIABLES
PostPosted: October 27th, 2009, 9:25 am 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Thanks Mack - I'll give it a try!

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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 48 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