• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Beware of escape-sequence control code when using javascript window in adobe captivate

New Here ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

I've been a little surprised by something about to use javascript in captivate.
If you know of any of the following issues, or if anyone has had a similar experience, I'd like to hear some information about them.

All of the javascript below works perfectly fine in a typical console. (Obviously...)

1.This javascript is not working.
var uVarTest1 = "Hello";
var uVarTest2 = "World!";
alert(uVarTest1 + "\\n" + uVarTest2);

2.This works.
var uVarTest1 = "Hello";
var uVarTest2 = "World!";
alert(uVarTest1 + " " + uVarTest2);

I wondered if, perhaps, I shouldn't write control code directly in the alert parameters, so I did the following.

3.This doesn't work.
var uVarTest1 = "Hello\\nWorld!";
alert(uVarTest1);

4.This works.
var uVarTest1 = "Hello World!";
alert(uVarTest1);

I was perplexed... I also ran the following tests, just to be sure.

5.This doesn't work.
//This is just a comment!
//Hello \n World!
var uVarTest1 = "Hello World!";
alert(uVarTest1);

6.This works
//This is just a comment!
//Hello n World!
var uVarTest1 = "Hello World!";
alert(uVarTest1);

In other words, when you type in the javascript window, the control code seems to be interpreted immediately. Even if you are commenting out it !!
This means it's not a simple matter of not being able to carriage return.

This could be a surprising source of bugs.

7.This works, but no line feeds (the alert message in adobe captivate different from the typical console. That's another issue.)
var uVarTest1 = "Hello";
var uVarTest2 = "World!";
var uVCRLF = String.fromCharCode(13) + String.fromCharCode(10);
alert(uVarTest1 + uVCRLF + uVarTest2);

I apologize in advance for my poor English.

Thanks.

Views

163

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

LATEST
Sorry. There were some mistakes in the description.

×)//n -> /n

1.This javascript is not working.
var uVarTest1 = "Hello";
var uVarTest2 = "World!";
alert(uVarTest1 + "\n" + uVarTest2);

2.This works.
var uVarTest1 = "Hello";
var uVarTest2 = "World!";
alert(uVarTest1 + " " + uVarTest2);

I wondered if, perhaps, I shouldn't write control code directly in the alert parameters, so I did the following.

3.This doesn't work.
var uVarTest1 = "Hello\nWorld!";
alert(uVarTest1);

4.This works.
var uVarTest1 = "Hello World!";
alert(uVarTest1);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources