Removal of ByRef when creating using code causes a problem

Class library usage, coding and language questions.
KJG
Posts: 18
Joined: Wed Jul 18, 2018 9:08 am

Re: Removal of ByRef when creating using code causes a problem

Post by KJG » Wed Sep 05, 2018 3:47 pm

Ah - I found the problem.

I was mapping the actual variable in my recording e.g.
UserCode SetVarTo() $MyVar NewValue

Whereas this sub actually takes the name, not the variable - I should have read this more carefully. So this works ...
UserCode SetVarTo() MyVar NewValue

Yippee! Thanks for all your help. This will hopefully make my upgrade somewhat easier now.

Regards.

KJG
Posts: 18
Joined: Wed Jul 18, 2018 9:08 am

Re: Removal of ByRef when creating using code causes a problem

Post by KJG » Wed Oct 03, 2018 12:31 pm

thanks for your help.
I think I have this working now by putting the code into a user code collection. I can then access this from where I need it.
This still means I have to find all the references to my existing usercode but that is just a bit of a repetitive but simple job.

So I am still confused why the initial calls

SetValue( variablename, newValue ) based upon
Sub SetValue(Byref variable, newVal)

changed in the Ranorex generated code after upgrade to
variable = SetValue(newValue)
Function SetValue(newValue) as variant

or similar.

Anyway, I think I have my answer now.

I do wonder if this is an ability which could be made available anyway in recordings. Say, SetVariable Variable Value.
Another useful one would be ConcatVariable.
This would save any delving into code at all, and still allow the generic elements to be used.

Thanks for your patience.

User avatar
RobinHood42
Posts: 324
Joined: Fri Jan 09, 2015 3:24 pm

Re: Removal of ByRef when creating using code causes a problem

Post by RobinHood42 » Thu Oct 04, 2018 11:40 am

Hi,

I'm glad that I could help. For improvements and feature requests, please use the UserVoice.

Cheers,
Robin