Highlighted
Super Contributor.. Super Contributor..
Super Contributor..
554 views

Truclient 12.53 Chrome regex in if statement

I am rescripting a script that worked in LR12.0 in 12.53 in the Chrome protocol.

In the LR12.0 script I had:
1) Get Visible Text from [label] into variable1
2) if (variable1=/some of the text in the label/)
           do commands

   else
           do other commands

The same code doesn't work in LR 12.53/Truclient/Chrome.

I made sure that the variable1 is saving the text that I want it to.
The single equals sign bombs out, and jumps to the Catch Error in the script. so I changed to double equal (which sounds better since it's an equality check).
What happens in this script is that it will just not recognise the if varialble and do the "do other commands"

Any ideas?

(I am trying to re-run the scipt I recorded against Chrome in IE mode, but appears I'm getting a lot or unrecognised items. Had hoped that it would be a lot more seamless playing on different browsers.)

Tags (1)
0 Likes
2 Replies
Highlighted
Contributor.
Contributor.

Re: Truclient 12.53 Chrome regex in if statement

Hi,

Please try to run the same code in the console of the browser and see if you get true statement.

If you does, please verify that variable1 get the right value, and try to use variable1.indexOf(/some of the text in the label/)!=-1, since if the string is not equal, it will not return true.

 

Please update me if these solution helped you.

Thanks.

Lital

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Truclient 12.53 Chrome regex in if statement

Please try to run the same code in the console of the browser and see if you get true statement.

If you does, please verify that variable1 get the right value, and try to use variable1.indexOf(/some of the text in the label/)!=-1, since if the string is not equal, it will not return true.

I'm not sure you you mean by running the same code in the console of the browser?

To confirm that the variable is being filled correctly, i put in an alert(variable1). This did not come up when in develop mode. Is this a quirke on Chrome? it works in IE. But when I ran it in load mode I could see that the variable was being outputted correctly.

I've been trying to use the indexOf() but it's not working. It's saying that that is it not a function. I've tried:

variable1.IndexOf(/text/)

and

variable1.IndexOf("text")

 

I was caught out with the new feature in LR12.53 of the drop down which I can pick: Plain view, Javascript, and Parameter Name.

Is there something else like that is blocking me?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.