Xojo Conferences
MBSOct2019CologneDE

RBscript help (RB 4.02) (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Moving a line across a graphic
Next thread: Duplicating some IDE behavior


Alternative to FSpExchangeFiles?   -   Joerg Pressel
  RBscript help (RB 4.02)   -   David E. Garrett
   Re: RBscript help (RB 4.02)   -   Will Leshner
   smtp?   -   David E. Garrett

RBscript help (RB 4.02)
Date: 08.05.02 14:41 (Wed, 08 May 2002 07:41:56 -0600)
From: David E. Garrett
Hello all.

I am taking my first baby steps toward using RBscript. I am working on a
project for my chemistry students. It takes calculation based exam
questions I have and puts them online to allow them to practice. The idea
is to have it generate random numbers so each time the question is used it
is different. The project needs to take a formula and use it, and the
randomly generated numbers to calculate the correct answer.

To illustrate with a simple example:
The answer to 3.4 x 2.1 is _____.

The program will have stored 3.4 and 2.1 as hidden variables in a web form
which the student submits along with their answer. The project will be
able to extract text that says "a = 3.4" and "b = 2.1". The project will
also have a formula "a*b" that it uses to calculate the answer. Here is
where RBscript comes in. I can put all this information into an editfield
(or somewhere else appropriate) but I cannot for the life of me decode the
RBscript documentation to figure out how I pass the variable and the
calculations to RBscript and then get the result of the calculation back.
The documentation seems to assume you already know what you are doing.

I tried putting something like this into an editfield (where the program
builds the text in the editfield based on data it is given):
Dim a,b,r as double
a = 3.4
b = 2.1
r = a*b

and then in a button's action handler I put:
RBScript1.source = EditField2.text
RBScript1.run (or perhaps this is RBScript1.run() - I am uncertain -
neither works)

Near as I can tell this should make RBscript run the code in the
editfield. Clearly I need to do something with the Input and the Print
events in the RBscript to feed the information in and get the resutls out,
but I cannot figure out what it is.

Any hints? I find that the documentation never clearly spells out the
process involved to make this work.

Thanks,
Dave

-----------------------------------
David E. Garrett
Teacher & Technology Coordinator
Morinville Community High School
Phone: (780) 939-6891 email: <email address removed>
Fax: (780) 939-6896 http://www.mchs.gsacrd.ab.ca

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: RBscript help (RB 4.02)
Date: 08.05.02 16:19 (Wed, 8 May 2002 08:19:53 -0700)
From: Will Leshner
What, exactly doesn't work about it? I tried your code and it worked
fine with RBScript1.run. But you won't see anything happen, of course.
To see something happen you do need to do something with RBScript's
print event. For example, try this. In the 'print' event of RBScript1,
put :

MsgBox msg

and change the script to be:

sub foo
dim a, b, r as double
a = 3.4
b = 2.1
r = a * b
print Str(r)
end sub

You should get a message box with "7.14" in it.



On Wednesday, May 8, 2002, at 06:41 AM, David E. Garrett wrote:

> builds the text in the editfield based on data it is given):
> Dim a,b,r as double
> a = 3.4
> b = 2.1
> r = a*b
>
> and then in a button's action handler I put:
> RBScript1.source = EditField2.text
> RBScript1.run (or perhaps this is RBScript1.run() - I am uncertain -
> neither works)

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>