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

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

New Here ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

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>

Views

4.3K

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

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.

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
New Here ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

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.

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

Hi Sean

For the future, if you believe a post is in the wrong forum, please don't create a new thread in a different forum. Instead, please post to the first thread asking a moderator to move the thread to the correct venue.

For what it's worth, this is outlined in the Before you post topic that you diligently read before posting.

Cheers... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

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 ,
Sep 24, 2009 Sep 24, 2009

Copy link to clipboard

Copied

Hmmm,

Very strange, since it does get the document title... You can try using

var sHREF = window.parent.frames[1].frames[1].document.location.href;

A quick glance shows that it works in Robo7, I'll check it out for Robo8.

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
LEGEND ,
Sep 26, 2009 Sep 26, 2009

Copy link to clipboard

Copied

Hi,

It seems I'm a bit behind on the JavaScript , sorry about that... The document.location.href com object doesn't work anymore in XHTML, instead you have to use document.URL (match the case!).

Add the following statement in the onclick field:

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)+' on url: '+escape(window.parent.frames[1].frames[1].document.URL));

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
New Here ,
Sep 28, 2009 Sep 28, 2009

Copy link to clipboard

Copied

the .URL didn't work, but .location does. This is my final code, which seems to be working:

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

Thanks for all your help.

Sean

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 ,
Sep 28, 2009 Sep 28, 2009

Copy link to clipboard

Copied

Strange, probably another IE-bug As long as it works now...

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
LEGEND ,
Sep 28, 2009 Sep 28, 2009

Copy link to clipboard

Copied

For the good order..

The document.location.href com object doesn't work anymore in XHTML, instead you have to use document.URL (match the case!).

This is not true, my bad The document.location is a javascript object and document.URL is the HTML DOM object. You would use document.location to redirect someone to a page and you use document.URL to retreive the URL of the current document.

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
Community Expert ,
Oct 03, 2009 Oct 03, 2009

Copy link to clipboard

Copied

For anyone else wishing to add a toolbar button, instructions can now be accessed via Snippet 38 on my site. I have shown Sean's final code and put in some instructions about what you can amend.


See www.grainge.org for RoboHelp and Authoring tips

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

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
New Here ,
Oct 07, 2009 Oct 07, 2009

Copy link to clipboard

Copied

The code does work, but our company uses Lotus Notes and there seems to be an issue with bringing over long URL names to Lotus Notes. So unfortunately we aren't using it at this time.

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
May 12, 2010 May 12, 2010

Copy link to clipboard

Copied

RoboHelp 8.0.802 (TCS2)

Peter, I followed the instructions in Snippet 38 on your website but i get the following error:

I copied direct from the webpage and checked the spacing which seems to be ok. Changed only the

email address

JS-error.png

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
Community Expert ,
May 12, 2010 May 12, 2010

Copy link to clipboard

Copied

Try it in a new project. If you cannot get it working there, see the contact page on my site and send it to me.


See www.grainge.org for RoboHelp and Authoring tips

@petergrainge

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

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
May 24, 2010 May 24, 2010

Copy link to clipboard

Copied

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.

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
Community Expert ,
May 24, 2010 May 24, 2010

Copy link to clipboard

Copied

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

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

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
May 26, 2010 May 26, 2010

Copy link to clipboard

Copied

For a number of reasons we have decided to take a different approach.

I was trying to include a button in the toolbar for launching the email program to send feedback and comments home in a prepopulated mail subject and body.

I think instead, we can add this as a link in the master page using a modification of Peter's snippet 38 "Email this topic". This rsolves all the problems i was having (i am a novice tweaker not a scripter or coder) and we are able to get our first skin ready in the new Help in time for the forthcoming release candidate.

However, my colleague also wants to add another link using this snippet as origianlly intended, but the body includes a link to the topic file, which in our case is stored locally. We are using webhelp in local product installations rather than via a file server. Obviously the link doesn't help anyone operaitng on another machine.

How can the Javascript be modified to actually send the topic file itself?

TIA

Rob

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 ,
May 31, 2010 May 31, 2010

Copy link to clipboard

Copied

LATEST

Hi,

You can get the html of a topic, but I doubt if that is what you want. See http://bytes.com/topic/javascript/answers/92610-innerhtml-another-frame for a how-to.

It's probably much easier to send yourself the title of the topic.

Greet,

Willam

This e-mail is personal. For our full disclaimer, please visit www.centric.eu/disclaimer.

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 ,
May 24, 2010 May 24, 2010

Copy link to clipboard

Copied

Hi there

In addition to my colleague's excellent advice, this likely is only an issue you will see when testing from your local PC. The issue most likely will totally disappear once you place the content on a server and your users run it from there.

Cheers... Rick

Helpful and Handy Links

RoboHelp Wish Form/Bug Reporting Form

Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

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
Participant ,
May 25, 2010 May 25, 2010

Copy link to clipboard

Copied

I think Rick is correct on this one, when I was doing a similar thing, I was getting errors locally.

It prompted me to add a try/catch code to the JS just incase it ever comes up, I noticed it crashing when a user was attempting to email from a topic that was displaying a PDF within it, though you can amend the error message to whatever.

my JS code from the skin area.

var myFeedback = function()
{
try {
window.location=('mailto:youremail@host.com?Subject=User Guide Feedback&body=This email is to be used for feedback and comments relating to content only. Please leave this page reference: ' + window.parent.frames[1].frames[1].document.title +' ' + escape(window.parent.frames[1].frames[1].document.location))
}
catch(err)
       {
txt="Sorry, but feedback can not be sent via a PDF page.\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
       }
}

Hope it helps.

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