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

Script for Mailto link in footer with page URL

Guest
Dec 14, 2011 Dec 14, 2011

Copy link to clipboard

Copied

[RH9]

I'm trying to place the following script in the footer of a master page. It produces script errors. Can anyone fix it for me please?

I'm inserting both text and graphical versions below incase the text doesn't post correctly --

mailto script.png

<p><script type="text/javascript">

var mailSubject = 'User feedback';

var mailBody    = 'Please leave this page reference in the message: ' + document.title + location.href;

var mailDisplay = 'Click here to send feedback to support.';

document.write(

    '<a href="mailto:xxxx@xxxx.com'

    + '?subject=' + escape(mailSubject)

    + '&body=' + escape(mailBody)

    + '">' + mailDisplay + '</a>'

    );</script></p>

Views

2.5K

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

correct answers 1 Correct answer

Deleted User
Dec 15, 2011 Dec 15, 2011

http://forums.adobe.com/message/3976683#3976683

At the above page I found a script that seems to work well enough although there some things about it I don't understand (hardly surprising, but I'm making progress). For example, it contains a variable called mailDisplay that doesn't appear to do anything.

Votes

Translate

Translate
Guest
Dec 14, 2011 Dec 14, 2011

Copy link to clipboard

Copied

OK, I've found the error in line 3 (no semicolon after "document title") but I still can't get this script to accurately give the URL of the published page so that the recipient of the e-mail can click it and launch the page in the default window (2-pane).

Any help would be appreciated -- I've seen a few scripts for this in websites and blogs but none of them are quite suitable for one reason or another.

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
Engaged ,
Dec 14, 2011 Dec 14, 2011

Copy link to clipboard

Copied

hi,

you can try the following code snippet, it is working fine on local folder, you should try it on web server as well.

<script type="text/javascript">

var mailSubject = 'User feedback';

var currentDocumentAddress = location.href;

if(typeof(gsStartPage)!='undefined' && typeof(gsRelCurPagePath)!='undefined')

{

    //check they are not empty

    if(gsRelCurPagePath.length>0 && gsStartPage.length>0)

    {

        currentDocumentAddress = gsStartPage+"#"+gsRelCurPagePath;

    }

}

var mailBody    = 'Please leave this page reference in the message: ' + document.title + ' '+ currentDocumentAddress;

var mailDisplay = 'Click here to send feedback to support.';

var szMailText = '<p><a href="mailto:xxx@yyy.com?subject='+escape(mailSubject)+ '&body=' + escape(mailBody)+ '">' + mailDisplay + '</a></p>';

document.write(szMailText);

</script>

Please try this code snippet and see if you find any error or not.

Thanks

Praful Jain

Adobe Robohelp Team

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
LEGEND ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

Hi,

Just some extra info as Paful's solution seems right on the spot. To use an URL as text, you need to convertert the URL to text:

var mailBody= 'Please leave this page reference in the message: ' + document.title + location.href.toString();

Greet,

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
Guest
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

If I preview it in the design editor", that code produces the following text in the e-mail body:

Please leave this page reference in the message: New Master Pagefile:///C:/ASK-TFS/Aurecon%20Support%20Knowledgebase/rltCEFC.htm

How would I make it come out as a clickable hyperlink to the page?

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
Engaged ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

when you go for preview, a temporary file is created and hence this dummy name rltCEFC.htm. each time you preview any topic/snippet/master page, it tries to create a unique dummy file.

The script will work fine, on generating the output. Generate the webhelp output, as this is customized for webhelp output only. Try verifing this script on generated output and let me know if it works or not.

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
Guest
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

OK thank you, I will try it. It is a WebHelp Pro project (I shd have metioned that) but I will try it anyway. I’m keen to learn more about scripting. Do I need to place this in the Baggage folder?

What source do you recommend for learning about using javascript and extendscript in RH?

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
Engaged ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

There are many good tutorials available on net for javascript.

Regarding Extendscript and its support in RoboHelp, you can go to the link @ http://www.adobe.com/devnet/robohelp/articles/robohelp-extendscript.html

This link specifical talks about how to get started with Extendscript with Robohelp and it has many resource links in the article.

thanks

Praful Jain

Adobe RoboHelp Team

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
LEGEND ,
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

Hi there

Just a heads up (in case you weren't aware) about the scripting. Although both use the word "script", they are in no way the same thing. So learning about one likely won't help with the other.

JavaScript is used on web pages to accomplish different things as the pages are viewed and interacted with. For example, using JavaScript, you may create mailto links. Or perform calculations. Or store cookies that can later be retrieved.

ExtendScript is a language that Adobe uses that allows you to manipulate your project in different ways. For example, skimming through all the topics in your system and counting words. Or replacing instances of a specific word with a variable.

Personally, although I dabble in JavaScript and can usually make it bend to my whims, I may as well be trying to understand Sanskrit when it comes to ExtendScript. I guess I'm just dumb that way.

Cheers... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7, 8 or 9 within the day!

Adobe Certified RoboHelp HTML Training

SorcerStone Blog

RoboHelp eBooks

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
LEGEND ,
Dec 16, 2011 Dec 16, 2011

Copy link to clipboard

Copied

LATEST

I might be the problem about the ExtendScript confusion. I dropped ExtendScript as an afterthought in a private conversation.

As Rick points out, JavaScript is the scripting language for the web. ExtendScript is a programming language for Adobe applications. ExtendScript is based on JavaScript, but with extra's (and some things that are not supported). When you know JavaScript you'll be able to recognize ExtendScript and use your JavaScript knowledge to get started with ExtendScript. Learn JavaScript for the web, and when you're comfortable with that, you can try to make the jump to ExtendScript.

Sorry about the confusion I caused.

Greet,

Willam

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
Guest
Dec 15, 2011 Dec 15, 2011

Copy link to clipboard

Copied

http://forums.adobe.com/message/3976683#3976683

At the above page I found a script that seems to work well enough although there some things about it I don't understand (hardly surprising, but I'm making progress). For example, it contains a variable called mailDisplay that doesn't appear to do anything.

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
RoboHelp Documentation
Download Adobe RoboHelp