Page 1 of 1

Is it possible to Call UserCodeItem with parameters ?

Posted: Fri Sep 02, 2011 3:11 pm
by Patrik
Hello,

is it somehow possible to call a UserCodeItem with parameters ?

For example, i have written a timer as an UserCodeItem... Now i want to start and stop the timer at different positions in the same the RecordingModule. I want to call my timer function with on parameter (name of the timer) - but i haven't fount a way to do this yet.

I need somthing like the Action "RunApplication" where i can enter arguments in the column:
usercode.JPG
Thanks and best regards,
Patrik

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Fri Sep 02, 2011 4:56 pm
by Support Team
Hi,

this feature request is on our road-map already and will be available in one of our future releases.

Kind regards,
Tobias
Support Team

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Mon Sep 05, 2011 8:10 am
by Patrik
Hello Tobias,
thanks for information - sounds good :)
Best regards.
Patrik

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Mon Jan 16, 2012 12:06 pm
by PeterM
Hello,

I currently have the 3.0.5 version installed, but I cannot see this feature.
Looked through the release notes, but couldn't find this in later versions neither.
Is there a way to call the user code with parameter(s) or is it not imlpemented yet?

Many thanks in advance
Peter

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Mon Jan 16, 2012 5:55 pm
by Support Team
PeterM wrote:Is there a way to call the user code with parameter(s) or is it not imlpemented yet?
Sorry, this feature is still not available, since unfortunately it is a little more complicated to implement than it may look like :? However, it is still on our wanted-features list and we are currently evaluating, how we can make this feature fit best into the current Ranorex infrastructure.

Alternatively, you can meanwhile achieve a similar functionality by using variables and binding these variables to parameter. See following section in the Ranorex User Guide for more information:
http://www.ranorex.com/support/user-gui ... html#c2985

Regards,
Alex
Ranorex Team

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Tue Jan 17, 2012 11:26 am
by PeterM
Hi Alex,

Thanks for the reply. I read the article you referenced, but not sure how it would do the trick, so if you have some more info on that, I'd appreciate it.
Anyway, will try to get around it ;).

Thanks
Peter

Re: Is it possible to Call UserCodeItem with parameters ?

Posted: Tue Jan 17, 2012 3:48 pm
by Support Team
Hi,

As workaround you have to create a global parameter with the value you wanted to assign to the User Code method, and a Module Variable.
Now you have to bind the global parameter to the specific module variable, because you have access to the module variable through your User Code method.
This enables you to get the value from the global parameter via the module variable.

Regards,
Markus
Ranorex Support Team