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

Using hyperlinks to non pdf files in a popup menu

New Here ,
Jun 13, 2017 Jun 13, 2017

I am not educated at all in javascript so I need the expertise of someone here to help me please!!!

I came across this page on the old Adobe Forum pages - https://acrobatusers.com/tutorials/popup-menus-part-i

This sort of popup menu is exactly what I need.  But I need it to work so that when someone clicks on the choice it either opens a Word document or a webpage.  The Word doc would ideally be an attachment to the PDF.  But if that isn't possible then it could be located in the same folder as the PDF. 

The code for the popup menu only works on PDF's saved in the same folder.  How do I make it work for Word doc's and URL's?

The above link says:

This menu is designed to open PDF documents within a common folder. Note that you’ll want your host document and supporting documents all copied to the same folder. To create a popup menu that opens other documents, add a Button field and then add a Run JavaScript action in the Actions tab. When you click the Add button in the Actions tab, enter the following Acrobat JavaScript code:

var cChoice = app.popUpMenu( ["Human Resources", "eeoAnalysis.pdf", "employeeData.pdf"], ["Customer Forms", "customerID.pdf", "orderForm.pdf", "purchaseOrder.pdf", "corporateOrder.pdf"], ["Employee Forms", "employeeApplication.pdf", "performanceEvaluation.pdf", ] ); app.openDoc((cChoice), this); 

Each line within the brackets is a different root menu item. The text appearing within the first quotations marks is a menu title and the remaining text within each set of quotes defines the filenames I want to open when accessing the submenu command. The last line of code instructs Acrobat to open the file selected from a selected menu command.

TOPICS
Acrobat SDK and JavaScript , Windows
1.4K
Translate
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

Community Expert , Jun 13, 2017 Jun 13, 2017

- Launch an attached Word file:

this.exportDataObject({cName: "My Document.doc", nLaunch: 2});

- Launch a URL:

app.launchURL("http://www.google.com");

Translate
Community Expert ,
Jun 13, 2017 Jun 13, 2017

Launching an external file that isn't a PDF: Not possible.

Launching a website: Possible, using the launchURL method of the app object.

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

If the Word document is an attachment, it can be launched.

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

Yes, that's true... I should have mentioned that attachments can be opened, just not independent files.

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

Okay.  If the Word doc is an attachment - how would I code that into the code I inserted in my original post?

Same goes for opening a URL?  Let's use google.com as the example URL.

I need it to work in this drop down menu please???

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

There are examples of how to export and launch an attachment here...

Acrobat DC SDK Documentation

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

- Launch an attached Word file:

this.exportDataObject({cName: "My Document.doc", nLaunch: 2});

- Launch a URL:

app.launchURL("http://www.google.com");

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

try67 I really appreciate your help. 

And I am going to ask for more.

This is the code for the popup menu.  Could you please insert those bits of code in the right places for me in the code below for the popup menu?

Please make the "eeoAnalysis.pdf" say google.com and open the web page and make the "employeeData.pdf" piece say mydocument.com and open the document.

Just ignore the rest and leave it as is.  If I can get those two links to work - then I can do the rest.

var cChoice = app.popUpMenu( ["Human Resources", "eeoAnalysis.pdf", "employeeData.pdf"], ["Customer Forms", "customerID.pdf", "orderForm.pdf", "purchaseOrder.pdf", "corporateOrder.pdf"], ["Employee Forms", "employeeApplication.pdf", "performanceEvaluation.pdf", ] ); app.openDoc((cChoice), this); 
Translate
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 ,
Jun 13, 2017 Jun 13, 2017

That's not so easily done... There needs to be a way of identifying what type of action to perform by each selection. It can be based on the actual value itself but if that's not possible you would need to either hard-code it or switch to using popUpMenuEx and use a unique return value that identifies both the type of action to perform as well as the action "parameter" (file name/attachment file name/URL/etc.)

If you're interested I can write for you the full code that will do that for a small fee. You can contact me privately (try6767 at gmail.com) to discuss it further.

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

It could actually be done with one call. First you'd check if the selected item has the same name as an existing attachment and if so, launch it, if not, go to the URL.

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

How would you differentiate between local files and attached files?

On Wed, Jun 14, 2017 at 1:04 AM, Joel_Geraci <forums_noreply@adobe.com>

Translate
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 ,
Jun 13, 2017 Jun 13, 2017

Quoting the original question... "The Word doc would ideally be an attachment to the PDF. "

Translate
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 ,
Jun 14, 2017 Jun 14, 2017

I was my understanding that they wanted to have links of all three kinds, not just to attachments and URLs, but also to local files.

Translate
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 ,
Jun 14, 2017 Jun 14, 2017

Hi again,

In answer to what types of links I need.  Attachments and URL's.

I am trying to create a PDF document that has this flowchart in it.  What I want to happen is that when a user clicks on a box in the flowchart they get a pop up menu that gives them options that relate to that box.

For example, the menu would link to a word doc template, directions on how to use the template, specific details about that task, a web page that lists current vendors, another flowchart document that outlines the subtasks for the tasks, etc.

The word docs would be attached to the PDF as it seems that that is the easiest way to launch a word doc and it is also the easiest way to send them one file that has all the files they'll need attached.  If there is another method...please let me know.

The flowcharts and instructions would either be separate PDF's (probably in a pkg) or all in one PDF.  I know how to create destinations and bookmarks.  I would need to use those in this menu.

If this is something you think you can help me with, I will email you.

Translate
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 ,
Jun 14, 2017 Jun 14, 2017

In that case you can use the method described above: Search the attachments for the selected value. If found, launch it.

If not, treat it as a URL.

You can also analyze the returned value and if it starts with "http" launch it as a URL immediately.

Translate
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 ,
Jun 14, 2017 Jun 14, 2017
LATEST

Okay thank you for your information.  I may be emailing you in the future for help with this code for a fee.  At this point we aren't sure if we'll use the popup menu option or not.

Much appreciated!!

Translate
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