Copy link to clipboard
Copied
I am using Captivate 9 and executing a JavaScript from within an advanced action.
What is the correct syntax for comparing two variables in a conditional statement?
e.g To check equality I have successfully used the syntax..... if(x == y){
var z = 1;
}
however when I try to check for the arithmetic operator ...."is less than", Captivate 9 will not allow me to "update" the script....
e.g. I tried..... if(x < y){
var z = y;
}
I know that an advanced action script does not offer a "<" arithmetic operator Does that mean that javascript that is executed within an advanced action, also will not allow the "is less than" arithmetic operation??
Thank you for your assistance.
Copy link to clipboard
Copied
You can use less than in an advanced action.
Certain characters can't be used in the JavaScript window. your best bet is to put the script in the html head or an external js file.
X < Y is the same thing as Y > X though if it will allow you to use the greater than symbol.
Copy link to clipboard
Copied
Thank you.
Copy link to clipboard
Copied
You do underestimate advanced/shared actions. Most logical parameters are available.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Some work around: write out the code in an external editor first, then replace < by < (HTML Number for '<') or < (HTML Name for '<') before copying code to the Script Window in an Advanced Action. On saving the Script Window, those strings will be properly escaped and converted to the '<' character. Note that you'll have to cover all '<' character occurrences in the code at once in every copy and past action. You can't just edit/add one of several occurrences that way, so it's probably good advise to always copy the entire code to a blank Script Window in one shot. You can also type the HTML Number/Name strings directly into the Script Window, but again you'd have to make sure to enter all occurrences in one shot. See https://forums.adobe.com/message/10709838