converting validate.containsimage to user code

Class library usage, coding and language questions.
Posts: 5
Joined: Tue Jul 19, 2011 9:28 pm

converting validate.containsimage to user code

Post by jminch270159 » Tue Aug 23, 2011 9:49 pm

Trying to use validate.containsimage

I am trying to generate two image based validation steps, convert them to code, then change them to return boolean values and then in the usercode of another recording, invoke those validate.containsimage calls from the user code not the recording.

As soon as I delete the validate from the rxrec, it deletes the compressed image dim from the vb module and the image find options.

From within a recording module, I click record
i click image based check mark and validate
I click in my system under test GUI
I crop to the area that I want
That writes the #Region "Image Feature Data" that contains the variable as compressed image and the variable as Imaging.FindOptions
I right click on the validate.containsimage in the .rxrec and convert to user code.
I add the two parameters I need to make validate.containsimage return a boolean value, "{0}", false,
Hit F8 everything builds.

I copy this validate.containsimage further up in my UserCode.vb in the if statement that I want, but now that this validation is being done in my user code as part of a conditional, I don't want these validate statements to run in their original form in the .rxrec. If I delete the entries in .rxrec, the variables Dim'd in the vb of the rxrec disappear, namely the compressed image and imaging.findoptions.

Is my only choice to comment the contents of the usercode generated when converting the validate to user code or disabling the line in the .rxrec?

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

Re: converting validate.containsimage to user code

Post by Support Team » Wed Aug 24, 2011 1:40 pm


Which version of Ranorex have you installed? If you are working with an older version please update to the new 3.0.5, there we have fixed some code generation issues.
If you want to use the compressed image and imaging.findoptions, after you have deleted the UserCode action in your recording, you have to manually copy these two variables to your Recording.UserCode file.
After you have copied it, it should run as expected.

Ranorex Support Team