[Mesquitelist] script with mesquites
Wayne Maddison
wmaddisn at interchange.ubc.ca
Thu Sep 11 20:51:08 PDT 2008
I believe Cuong has figured this out (based on off-list emails), but
I'll answer this for the sake of everyone else on the list.
First, I'll explain why this doesn't work:
tell mesquite.trees.SimulatedTreeBlocks.SimulatedTreeBlocks;
setNumberTrees 10;
endTell;
"mesquite.trees.SimulatedTreeBlocks.SimulatedTreeBlocks" is the name
of a kind (or class) of modules. It is not referring to a specific
instance of this kind. In any run of Mesquite there could be several
instances of this kind of module: one could be operating within one
tree window, another could be operating within another tree window.
You need to specify which instance of this kind of module you want.
Why did your second snippet of script work? Here it is:
getEmployee #mesquite.minimal.ManageTaxa.ManageTaxa;
tell It;
newTaxa 10 Species;
endTell;
All commands in the script are being sent to whichever object you are
currently "telling". This is usually some module or another.
Presumably in the context of this second snippet, you are speaking to
the file coordinator module. The getEmployee command takes as its
argument a kind of module. It says "return to me the instance of
this kind of module that is your employee". Thus this command does
return a particular instance, which can temporarily be referred to by
"It". Thus, you really are commanding an instance in the second
"tell".
By the way, you can store "it" for later use as follows:
getEmployee #mesquite.minimal.ManageTaxa.ManageTaxa;
Object.taxonManager *it;
.
.
.
tell *Object.taxonManager;
newTaxa 10 Species;
endTell;
Wayne
At 5:16 AM -0500 14.8.2008, Cuong Than wrote:
>Hello all,
>
>I have a very hard time using the scripting language of Mesquite. I
>don't think the documentation on it is good and detailed. Here are some
>problems I don't know to deal with, and I hope some of you can help me.
>
>- How can change the object to which I will send command to? As I know
>from the documentation, it can be done with a 'tell' command. However,
>this simply doesn't work in many cases. For example, I want to create a
>block of trees, and I send the following script to Mesquite:
>
> tell mesquite.trees.SimulatedTreeBlocks.SimulatedTreeBlocks;
> setNumberTrees 10;
> endTell;
>
>Mesquite says it cannot execute the script returns a null object.
>
>- In another script, I want to create a group of 10 taxa:
>
> getEmployee #mesquite.minimal.ManageTaxa.ManageTaxa;
> tell It;
> newTaxa 10 Species;
> endTell;
>
>
>It worked, but I don't know why.
>
>I would like to thank you in advance for your help.
>_______________________________________________
>Mesquitelist mailing list
>Mesquitelist at mesquiteproject.org
>http://mesquiteproject.org/mailman/listinfo/mesquitelist
--
--------------------------------------------------------
Wayne Maddison
Professor and Canada Research Chair
Depts. of Zoology and Botany and
Biodiversity Research Centre
& Director
Beaty Biodiversity Museum
6270 University Boulevard
University of British Columbia
Vancouver, BC V6T 1Z4 Canada
email: wmaddisn at interchange.ubc.ca FAX: +1 604 822-2416
Mesquite: http://mesquiteproject.org
MacClade: http://macclade.org
Salticidae: http://salticidae.org
Tree of Life: http://tolweb.org
Beaty Biodiversity Museum: http://beatymuseum.ubc.ca
Home page: http://salticidae.org/wpm/home.html
More information about the Mesquitelist
mailing list