Forcing a variable to evaluate as an object reference

Jim Ault JimAultWins at yahoo.com
Mon Sep 11 12:32:14 EDT 2006


Since I do not know all the ways you tried, I will attempt to comment on the
version you offered
(I will use k instead of i since I find it easer to read)

put "red" into k
>put "field " & k into twhere
--will make twhere = "field red"
>      get the Language[glanguage] of twhere
--does not make sense, but should be
do (" get the Language[glanguage] of " &twhere)
--which is interpreted by Rev to execute the line...
"get the Language[glanguage] of field red"

------
put it into field k  --should work, as long as there *is* a field k
--your loop could be setting k = empty at some point so try

--before the repeat loop
filter field "langfields" without empty

--then in the repeat loop add
if there is not a field k then
   answer "Can't find field named " & k
   breakpoint
end if

Hope this helps

Jim Ault
Las Vegas

On 9/11/06 8:39 AM, "David Glasgow" <david at dvglasgow.wanadoo.co.uk> wrote:

> I have the strange feeling I really should know the answer to this, but
> my mind is blank.
> 
> I have written a routine for switching languages of the text contained
> in a number of fields (listed in field "langfields"). The fields are on
> various cards, and are listed in "langfields" in the form:
> 
> "Inst3" of card "Ranking" of this Stack
> 
> The different language texts are stored in a custom property set
> 'Language' in each of the respective objects.
> 
> When the script runs, the text is retrieved from the custom property
> set glanguage, but the "put it into field i" generates a 'no such
> object' error.  I have tried different forms of syntax, brackets and
> whatnot, but either get the no object error, or the text is put into
> the variable 'i' rather than into the relevant  'field i'.  I
> originally tried doing the get and put into the field  in one line, but
> broke it in to steps to see where it was failing.
> 
> on yeschangeit
>    global glanguage
>    put "changing it now"
>    repeat for each line i in field "langfields"
>      put "field " & i into twhere
>      get the Language[glanguage] of twhere
>      put it into field i
>    end repeat
> end yeschangeit
> 
> 
> Best Wishes,
> 
> David Glasgow
> Carlton Glasgow Partnership
> 
> http://www.i-psych.co.uk
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list