Make variable in UserCode file available in recoding module

Ranorex Studio, Spy, Recorder, and Driver.
caleb
Posts: 24
Joined: Mon Jul 08, 2013 3:35 am

Make variable in UserCode file available in recoding module

Post by caleb » Mon Sep 30, 2013 10:42 pm

Hi

I have come across this problem several times and it's not too difficult to work around but I wondered if there is a way to have a variable (say a string value) that a UserCode method has set and make it available in the recoding module so that I can send that as an argument to another user code method while keeping the obvious flow of the program within the recording module.

for example in my recording module I want something like this
UserCode FindX()
UserCode UseXToSetY(X, Y)

however this is not as simple as the example makes it appear because the UseXToSetY function is a commonly used function in the parent class of the user module that includes FindX.

hopefully that actually makes sense to someone, I'm not looking for a work around I can already do that I just wondered if there is a simple solution that I am missing.

Thanks

Caleb

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Make variable in UserCode file available in recoding module

Post by Support Team » Tue Oct 01, 2013 3:33 pm

Hello,

You could create a recording variable (X and Y) in your recording module and set the value of it in a User Code method. In another User Code method, you could pass the value of your variable as an argument to your method.
public void FindX()
{
	X = "2";     	
}

public void UseXtoSetY(string myX, string myY)
{
	Y = myX;       	
}
Please let me know if this is what you want.

Regards,
Markus (T)