Skip to main content
Known Participant
September 24, 2009
Question

RoboHelp 8 HTML - Toolbar Button: Email with Link to Topic

  • September 24, 2009
  • 1 reply
  • 4749 views

Realized this would be better on this forum than the WebHelp forum:

Within a skin, I'd like to create a custom email button on my toolbar that would allow a user to email a direct link to a specific file in my RoboHelp project (a Share this Topic feature).

I thought it might be something like this:

window.location=('mailto:ENTERNAME@DOMAIN.COM?Subject=Useful Step-by-Step&body=This Step-by-Step may be helpful for you: ' + window.location)

but that just calls the toolbar, not the topic; the focus isn't on the correct window.

I have the following code that I could imbed on each topic page, but for consistency, I'd like to have this functionality on the toolbar instead. Has anyone done this or come across this before?

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

var mailSubject = 'Useful Information';

var mailBody = 'This page might help: ' + location.href;

var mailDisplay = 'Click here for a demo.';

document.write(

'<a href="mailto:yourname@yourSite.com'

+ '?subject=' + escape(mailSubject)

+ '&body=' + escape(mailBody)

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

);</script></p>

This topic has been closed for replies.

1 reply

Willam van Weelden
Inspiring
September 24, 2009

Hi,

You indeed need to focus on the correct window using window.parent.frames[1].frames[1].document.title (thanks to Philip Tory for this).

First, create a JavaScript file with the following function:

function email()
{
    var sEmail = prompt("Who do you want to e-mail?","Your e-mail adress");
    var sTitle = window.parent.frames[1].frames[1].document.title ;
    var sSubject = 'Useful Step-by-Step on the page '+sTitle+'.';
    var sHREF = window.parent.frames[1].frames[1].document.location;
    return('mailto:'+sEmail+'?Subject='+sSubject+'&body=This Step-by-Step on the page '+sTitle+' may be helpful for you: '+ escape(sHREF)+'.' );
}

Save the file as a baggage file in the root of the project.

Second, create a new button and in the action tab, add window.location=email() to the field onClick.

Third, choose External JavaScript file and select the baggage JavaScript file.

Output and you're all done.

Greet,

Willam

PS.: I added a prompt for the e-mail adress since I find that more user friendly. If you don't want it, replace the prompt with a 'hard coded'  address.

scmcgurrAuthor
Known Participant
September 24, 2009

Willam,

Thanks for your help. I'm not able to get that to work. I've got the .js file set up and saved as a baggage file and put the code in the OnClick and point to the .js file, but the button isn't functioning in the published version.

However, if I use the following code as inline JavaScript OnClick, I'm able to generate the email and the title of the Help file:

window.location=('mailto:ENTERNAME@aep.com?Subject=Useful Step-by-Step&body=This Asset Suite Step-by-Step may be helpful for you: ' + escape(window.parent.frames[1].frames[1].document.title))

It isn't providing an actual link to the topic, but it does provide the title of the topic, which is more than I was getting yesterday.

Thanks,

Sean

Message was edited by: Captiv8r - Corrected Willam's name.

Peter Grainge
Community Expert
Community Expert
May 24, 2010

I did manage to get this working but I get javascript errors when I try to edit the new button in the skin editor.

I also notice prompts to allow the javascript in the browser which I don’t want.

There is no immediate response to the first click on the mail button. On the second click the email is launched but I am prompted to allow the action in the web browser.


Sounds like your browser is set to prompt if a script is run. Check the Security settings.


See www.grainge.org for RoboHelp and Authoring tips

@petergrainge

Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.