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.
1 person found this helpful
you can try the following code snippet, it is working fine on local folder, you should try it on web server as well.
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:firstname.lastname@example.org?subject='+escape(mailSubject)+ '&body=' + escape(mailBody)+ '">' + mailDisplay + '</a></p>';
Please try this code snippet and see if you find any error or not.
Adobe Robohelp Team
1 person found this helpful
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();
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?
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.
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.
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?
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.
Adobe RoboHelp Team
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.
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.
Helpful and Handy Links
I might be the problem about the ExtendScript confusion. I dropped ExtendScript as an afterthought in a private conversation.
Sorry about the confusion I caused.