Highlighted

Get a list of all variables used in a project in a console

Engaged ,
May 16, 2018

Copy link to clipboard

Copied

Hi there,

hopefully this has a short answer.

How can I open the developer tools with F12 and in the console get a list of all the custom variables that I have used in the project?

Thank you in advance

B

Adobe Community Professional
Correct answer by TLCMediaDesign | Adobe Community Professional

This will show all of the custom variables and their values. If it does not have a value, it will be blank.

var myVars = cp.ReportingVariables.split(",");

     myVars.forEach(function(vars) {

      console.log(vars+" = "+window[vars]);

     });

Views

243

Likes

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

Get a list of all variables used in a project in a console

Engaged ,
May 16, 2018

Copy link to clipboard

Copied

Hi there,

hopefully this has a short answer.

How can I open the developer tools with F12 and in the console get a list of all the custom variables that I have used in the project?

Thank you in advance

B

Adobe Community Professional
Correct answer by TLCMediaDesign | Adobe Community Professional

This will show all of the custom variables and their values. If it does not have a value, it will be blank.

var myVars = cp.ReportingVariables.split(",");

     myVars.forEach(function(vars) {

      console.log(vars+" = "+window[vars]);

     });

Views

244

Likes

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
Adobe Community Professional ,
May 17, 2018

Copy link to clipboard

Copied

Hi,

Please confirm that your are using a Windows OS and F12 relates to Internet Explorer.

You will see the list of variables in your Captivate interface.

I would expect the server to process the values/variables before it arrives at the browser (server side).

Likes

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
Reply
Loading...
Engaged ,
May 17, 2018

Copy link to clipboard

Copied

Thanks for your reply Eric

Yes, I use Windows and IE.

My goal is to be able to get a list of all variables in the console of the browser, not in Captivate

Likes

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
Reply
Loading...
Adobe Community Professional ,
May 17, 2018

Copy link to clipboard

Copied

Do you just want to see the variables or their values also?

Likes

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
Reply
Loading...
Engaged ,
May 17, 2018

Copy link to clipboard

Copied

Thanks David

I know how to get the values once I get the names, so I would like to get a list of the (custom) variables in a project.

Likes

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
Reply
Loading...
Adobe Community Professional ,
May 17, 2018

Copy link to clipboard

Copied

This will show all of the custom variables and their values. If it does not have a value, it will be blank.

var myVars = cp.ReportingVariables.split(",");

     myVars.forEach(function(vars) {

      console.log(vars+" = "+window[vars]);

     });

Likes

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
Reply
Loading...
Engaged ,
May 17, 2018

Copy link to clipboard

Copied

That is fantastic

Thank you once again! I am trying to understand the code., Would you please confirm it is correct? I have put comments after each line. At least about the bits that I understand.

var myVars = cp.ReportingVariables.split(",");      //here you are creating a variable myVar that would take the values of cp.Reporting variables and will split them after the symbol ",". I see the string that is returned by console.log(cp.ReportingVariables). myVar is actually an array

myVars.forEach(function(vars) {        //here you execute the method forEach for the myVar array which will execute the function once for each element of the array. Would you please explain more about the function(vars) bit? Are you declaring vars as a variable inside the function?

console.log(vars+" = "+window[vars]);     //the function would execute console.log and will add the "=" between the variables and the actual value of the variable. Would you please explain with a few words what is the difference between vars and [vars] - one is the name of the variable and the other the value?

});

I am trying to make sense of the code too...

Thanks

B

Likes

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
Reply
Loading...
Resources
Captivate User Guide
New Group