Highlighted

Mailto in JavaScript Adobe Captivate 9

New Here ,
Mar 03, 2016

Copy link to clipboard

Copied

Hello, I am working with Adobe Captivate 9 on Windows 7. Well, I have created a push button, if I push the button Outlook will open automatically with a receiving address and subject heading which I selected before, like this:  "mail@address.com?subject=Feedback". This is working well.

Now I want to create a variable inside my subject heading like mail@address.com?Feedback + variable

I think I need to develop a JavaScript to do this. Can anybody help me. I have no idea from JavaScript.

Thank You!

Views

1.8K

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

Mailto in JavaScript Adobe Captivate 9

New Here ,
Mar 03, 2016

Copy link to clipboard

Copied

Hello, I am working with Adobe Captivate 9 on Windows 7. Well, I have created a push button, if I push the button Outlook will open automatically with a receiving address and subject heading which I selected before, like this:  "mail@address.com?subject=Feedback". This is working well.

Now I want to create a variable inside my subject heading like mail@address.com?Feedback + variable

I think I need to develop a JavaScript to do this. Can anybody help me. I have no idea from JavaScript.

Thank You!

Views

1.8K

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
Advisor ,
Mar 31, 2016

Copy link to clipboard

Copied

Have you tried building the URL with an advanced action that combines the mailto with the variable, then opens the result?

It seems this might be a way to accomplish the complexity without JavaScript.

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 ,
Mar 31, 2016

Copy link to clipboard

Copied

This is an interesting idea, but I'm not seeing any way that it could currently be done in Captivate's Advanced Actions without using a special widget or some kind of JavaScript code.

In a Standard or Conditional Action there is no option to insert a variable as the target mailto or URL address.  So even if you were able to assemble all the bits of the mailto address using a number of different variables, the end result would still need to be a variable that you had to insert in the Open URL or File target field.  Currently you can only paste a value or manually type it.

Have you found a way to do this with variables? 

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...
Advisor ,
Apr 07, 2016

Copy link to clipboard

Copied

RodWard‌,

You were right, I haven't been able to build this directly in Captivate, so far!

Here is the JavaScript I came up with:

var v_Subject = document.Captivate.cpGetValue('m_VarHandle.TEB_Subject');

var v_Body = document.Captivate.cpGetValue('m_VarHandle.TEB_Body');

var URL_self = "mailto:me@home.com?Subject=" + v_Subject + "&Body=" + v_Body;

var win = window.open(URL_self, "_self");

I created two Text Entry Boxes, and assigned them to variables called: TEB_Subject, and TEB_Body.

You can see the email is 'hard coded' into this JavaScript as me@home.com, this could be replaced by a third Text Entry Box if someone wanted to create an email 'form' directly in Cp.

This JavaScript was added to a smartShape on the stage, set to be used on a button, when the button is clicked, the current values of the TEB's are used as part of the 'mailTo' which causes a window to open with the generated url, that is passed to the users mail application.

Note that this functionality is dependent on the user's OS, browser, and mail application configuration.

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...
Advisor ,
Apr 07, 2016

Copy link to clipboard

Copied

I was able to build the URL in an Advanced Action, but (as mentioned above) there still needs to be some JavaScript to launch the URL in a new window and generate the Mail message.

Here are the details of the Advanced Action:

Milto in JavaScript via AA 2016-04-07_15-02-08.png

The variable 'v_URL_Build' is called repeatedly and added to each time, this is a technique called concatenation. The first line has the hard-coded email for the recipient, and a Text Entry Box called TEB_Body,

The second line sets the value of v_URL_Build to itself plus the static text "&Body=".

The third line sets the value of v_URL_Build to itself plus the value of TEB_Body.

The last line is a JavaScript action:

var js_URL_Build = document.Captivate.cpGetValue('m_VarHandle.v_URL_Build');

var win = window.open(js_URL_Build, "_self");


This line creates a variable JS_URL_Build and copies the value from the captivate file into it.

The last line opens a URL in the same window as the Captivate file, if it is handled correctly by the users computer OS, web browser, and mail application it should open a mail message:


MailTo window 2016-04-07_15-15-12.png

Note that this was tested with Cp8, Windows 7, Google Chrome, and MS Outlook.

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...
RamilS LATEST
New Here ,
Sep 08, 2020

Copy link to clipboard

Copied

Hi Sir, 

 

Good Day.

 

I would like to know what is wrong with my coding. I have tried to copy the same format that you presented, but when I click the button during preview, nothing happens.

 

RamilS_0-1599594019443.png

 

 

 

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