Forum Discussion

MOHIN_PASHA's avatar
MOHIN_PASHA
New Contributor
11 months ago
Solved

How to convert the Strings to Objects so that the actions can be taken on the objects

Hi All,

 

I am trying to pass the strings as part of the objects but it is object not found error.

For eg: 

I have a combo  box which as 17 items in it. I have written a while loop to loop through all the items and select them. After selecting them, I am trying to verify the object with the selected item. This object varies whenever while loop iterates.

 

pallet_selected = "Pallet"+IntToStr(pallete_number+1)

Regions.pallet_selected.Check(imageCaptureAreaForPallet)

 

Here the pallet_selected varies every time. How can I convert this string into the Object.?

  • Try using the eval() method. For example,

    var obj = eval("Regions.Pallet" + IntToStr(pallete_number + 1));
    obj.Check(imageCaptureAreaForPallet);

5 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Try using the eval() method. For example,

    var obj = eval("Regions.Pallet" + IntToStr(pallete_number + 1));
    obj.Check(imageCaptureAreaForPallet);
    • MOHIN_PASHA's avatar
      MOHIN_PASHA
      New Contributor

      Not working as I have tried. By the way I'm automating desktop application using python script.