Author Topic: Call a function with an argument inside registry field  (Read 3402 times)

velasquez

  • Hero Member
  • *****
  • Posts: 501
Call a function with an argument inside registry field
« on: January 12, 2015, 02:08:39 PM »
I need to call a function with an argument inside field registry.

Your syntax is incorrect. It should be:
ValueData: {code:myfunction|myargument};

However, your function only appends the argument, so there is no need for it:
ValueData: {code:myfunction}myargument;

Better:
ValueData: {app}\MAyapp r4.0\myargument;

Please post future questions in the forum so that everyone can benefit from the discussion.

Hello Owen,
His answer was helpful with the function call.
What I need to pass to the function a variable I created in another point of my script.
ex:

Ex: myvariable1: = test_a.vlx
      myvariable2:  = test_b.vlx
      myvariable3:  = test_c.vlx

ValueData: {code:myfunction|myvariable..};

I'm not getting it.
Thanks

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3059
    • Outside The Box
Re: Call a function with an argument inside registry field
« Reply #1 on: January 12, 2015, 03:09:25 PM »
If the value is in a global variable, your function can refer directly to the global variable and ignore the argument.

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: Call a function with an argument inside registry field
« Reply #2 on: January 13, 2015, 03:18:52 AM »
If the value is in a global variable, your function can refer directly to the global variable and ignore the argument.

This I do not understand Owen.
You mean I need a function for each variable?

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3059
    • Outside The Box
Re: Call a function with an argument inside registry field
« Reply #3 on: January 13, 2015, 08:29:39 AM »
ValueData: {code:myFunction};

Code: (autolisp) [Select]
var myVariable1: String;

//set myVariable1 as required

procedure myFunction();
begin
  //do something with myVariable1
end;

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: Call a function with an argument inside registry field
« Reply #4 on: January 13, 2015, 08:33:25 AM »
ValueData: {code:myFunction};

Code: (autolisp) [Select]
var myVariable1: String;

//set myVariable1 as required

procedure myFunction();
begin
  //do something with myVariable1
end;

Ok Owen,
thank you