Do merge

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Do merge

Thierry-24
Hi all,

Can't find a way to make the following works :-(


--x is a string coming from outside
-- want to transform "x" to  x()
-- and execute it

do  merge( "[[x]]()" )

or

get merge( "[[x]]()" )
do it


Any hints ?

Regards,
Thierry

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Eric Chatonet
Bonjour Thierry,

Does the following would work for you:

on mouseUp
   local tName, tFunc
   -----
   put "test" into tName
   put tName & "()" into tFunc
   do "put" && tFunc
end mouseUp

function test
   return "You win"
end test

Le 28 mai 08 à 12:52, Thierry a écrit :

> Hi all,
>
> Can't find a way to make the following works :-(
>
>
> --x is a string coming from outside
> -- want to transform "x" to  x()
> -- and execute it
>
> do  merge( "[[x]]()" )
>
> or
>
> get merge( "[[x]]()" )
> do it
>
>
> Any hints ?
>
> Regards,
> Thierry

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: [hidden email]/
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Thierry-24
Bonjour Eric ,

Ok, then this one works:

     do "get " & merge("[[x]]()")

Merci.

So, what's wrong in my first way of writing ?

Thierry

>> do  merge( "[[x]]()" )
>>
>> or
>>
>> get merge( "[[x]]()" )
>> do it

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Eric Chatonet
Re Thierry,

Le 28 mai 08 à 14:03, Thierry a écrit :

> Bonjour Eric ,
>
> Ok, then this one works:
>
>     do "get " & merge("[[x]]()")
>
> Merci.
>
> So, what's wrong in my first way of writing ?
>
> Thierry
>
>>> do  merge( "[[x]]()" )
>>>
>>> or
>>>
>>> get merge( "[[x]]()" )
>>> do it

Your first two ways of writing assume both you want to execute a  
command.
Your new one addresses a function as expected.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: [hidden email]/
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Thierry-24

Le 28 mai 08 à 14:08, Eric Chatonet a écrit :

>> So, what's wrong in my first way of writing ?
>>
> Your first two ways of writing assume both you want to execute a  
> command.
> Your new one addresses a function as expected.

Ok, I understand the confusion,
so, I'll be happy with this one:

do merge( "get [[x]]()" )

Merci,
Thierry

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Eric Chatonet
Elegant :-)

Le 28 mai 08 à 14:19, Thierry a écrit :

> Le 28 mai 08 à 14:08, Eric Chatonet a écrit :
>
>>> So, what's wrong in my first way of writing ?
>>>
>> Your first two ways of writing assume both you want to execute a  
>> command.
>> Your new one addresses a function as expected.
>
> Ok, I understand the confusion,
> so, I'll be happy with this one:
>
> do merge( "get [[x]]()" )
>
> Merci,
> Thierry

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: [hidden email]/
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Ken Ray
In reply to this post by Thierry-24

> do merge( "get [[x]]()" )

There's one other option you haven't mentioned, and that's the "value"
function:

Using Eric's example:

on mouseUp
   local tName, tFunc
   -----
   put "test" into tName
   put value(tName & "()") into tResult
   answer tResult   -- answers "You win"
end mouseUp

function test
   return "You win"
end test

Ken Ray
Sons of Thunder Software, Inc.
Email: [hidden email]
Web Site: http://www.sonsothunder.com/


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Thierry-24

Le 28 mai 08 à 19:15, Ken Ray a écrit :

>
>> do merge( "get [[x]]()" )
>
> There's one other option you haven't mentioned,
> and that's the "value" function:

Thanks, but was trying to understand the merge function.

By the way, can someone show me an example of the
merge() with the <? ... ?> options.
Don't understand the Doc.

Regards,
Thierry

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Ken Ray
> By the way, can someone show me an example of the
> merge() with the <? ... ?> options.
> Don't understand the Doc.

Well, here's an example, but I don't use merge that often so I don't know
how applicable this might be:

put merge("[[2+2]] - Dated: <?return the date?>")

gives you:

  4 - Dated: 5/28/08

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: [hidden email]
Web Site: http://www.sonsothunder.com/


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

masmit
In reply to this post by Thierry-24
put merge("1+1 = <? return 1+1 ?>")
put merge("1+1 = [[1+1]]")

seem to produce the same result - I'm not quite sure what the use of  
it is, but there probably is one :)

Best,

Mark

On 28 May 2008, at 19:23, Thierry wrote:

>
> Le 28 mai 08 à 19:15, Ken Ray a écrit :
>
>>
>>> do merge( "get [[x]]()" )
>>
>> There's one other option you haven't mentioned,
>> and that's the "value" function:
>
> Thanks, but was trying to understand the merge function.
>
> By the way, can someone show me an example of the
> merge() with the <? ... ?> options.
> Don't understand the Doc.
>
> Regards,
> Thierry
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Do merge

Dom-2
In reply to this post by Thierry-24
Thierry <[hidden email]> wrote:

> By the way, can someone show me an example of the
> merge() with the <? ... ?> options.
> Don't understand the Doc.

a little late, but:

<script>

  get fld "fdate"
  convert it from long system date to dateitems
  put item 1 of it into tannee
  put item 2 of it into tmois
  if tmois <10 then put "0" before tmois
  put item 3 of it into tjour
  if tjour <10 then put "0" before tjour
 
  put merge("Nous sommes le [[tjour]]/[[tmois]]/[[tannee]]") into
tmessage
  put tmessage

</script>

assuming that the field "fdate" contains a regular date :-)

demo sample, after reading the more thorough study here:

"The Power of Merge
Create easy-read code using the Merge function
by Jan Schenkel"

in:

<http://www.runrev.com/newsletter/august/issue55/>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution