JS to add url hyperlink to a rectangle shape?

Hi there,
Any JS script to add a url hyperlink to a shape object ?
Thanks a million....

Hi,
here's a script that might help you. I made it and tested it only for InDesign CS5.5.
How to use it: select any object in InDesign then run the script. At first, the script will try to see in the clipboard has valid URL (well, a text startiong with http…) and if so, the clipboard will be take as a good URL for the new created button. If no valid URL in the clipboard, the script will ask for the URL to be entered manually. If the ibject is a text frame, the script will try to take the text from inside the frame as a URL – if not valid, then the dialog pops up.
// -------------------------------------------- BEGIN SCRIPT ----------------------------------------------
if (app.selection.length==1) {
//get the selected object (only one object)
var xOBJECT = app.selection[0];
var xPAGE = xOBJECT.parentPage;
var xBOUNDS = xOBJECT.geometricBounds;
//create the button
var xBUTT = xPAGE.buttons.add({geometricBounds:xBOUNDS});
//add selected object to the normal state
xBUTT.states.item(0).addItemsToState(xOBJECT);
//create the gotoURL behavior
var xGOTOURL = xBUTT.gotoURLBehaviors.add({behaviorEvent:BehaviorEvents.mouseUp});
//get the clipboard
var xTEMP = app.documents[0].textFrames.add(); xTEMP.insertionPoints[-1].select(); app.paste(); var xCLIP = xTEMP.parentStory.contents; xTEMP.remove();
//check the clipboard or text frame's text; if it does not starts with "http" then it's not good and a dialog asking a good URL will popup
if (xOBJECT.constructor.name!="Rectangle")
    var xURL = xOBJECT.parentStory.contents;
} else {
    var xURL = xCLIP;
if (xURL.substring(0, 6)!="http://") {
// do the dialog here
var xDIAG = app.dialogs.add();
with (xDIAG.dialogColumns.add().dialogRows.add()){staticTexts.add({staticLabel:"Enter URL:"}); var xURLTEXT = textEditboxes.add({editContents:xCLIP, minWidth:160});}
var xRESULT = xDIAG.show({name:"Button creation"});
if (xRESULT == true){xURL = xURLTEXT.editContents; xDIAG.destroy();} else { xURL="http://"; xDIAG.destroy();}   
// set the URL to the behavior
xGOTOURL.url=xURL;
// -------------------------------------------- END SCRIPT ----------------------------------------------
Have fun!

Similar Messages

  • Hi I would like to know, how do I add a Hyperlink on Flash, that opens a PDF in adobe reader and not the web browser.

    Hi I would like to know, how do I add a Hyperlink on Flash, that opens a PDF in adobe reader and not the web browser.

    Yoh, what is FSCCommanr ? sorry man I am an absolute beginner in Flash. I tried the code:
    /* Click to Go to Web Page
    Clicking on the specified symbol instance loads the URL in a new browser window.
    Instructions:
    1. Replace http://www.adobe.com with the desired URL address.
       Keep the quotation marks ("").
    instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
    function fl_ClickToGoToWebPage(event:MouseEvent):void {
      navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
    this is the same code I used before and it opens a pdf file in a web browser, and it doesn't open an AutoCAD file.

  • Linking to a page with a URL hyperlink

    Is it possible to create a hyperlink that links to another page in the same document using the "Link To: URL" option in the New Hyperlink window?
    Normally I'd just use the "Link to: Page" option but I want to upload a bunch of documents to Issuu and the only interactive object that seems to survive the conversion process is a URL hyperlink. I've also tried creating a button with a "Go To Destination" action attached but it isn't recognised by Issuu either.
    I can add buttons in Issuu after I've uploaded the documents but I was hoping there would be a way to do it in InDesign that works for both normal PDFs and uploaded Issuu files.
    I hope this makes sense. Let me know if it needs clarification.
    InDesign version: CS6 - 8.0.1
    OS: Win 7 SP1

    Issuu is an online digital publishing platform. Here's an example (not mine!). You upload PDF files to the Issuu website and they are converted to a proprietary format for viewing.
    The problem I'm having is that these converted files support URL hyperlinks but not any other kind of interactivity. I was hoping I would be able to use URL hyperlinks to other pages within the document if this was even possible.
    I'm trying to get some assistance from the Issuu help staff but I'm not really getting anywhere. Hence the post!

  • How do I add a hyperlink to an image in my Mail signature

    In outlook I can simply add a URL to an image in a signature like in the image I've attached. When I try to add a link to an Image in Mail it changes the image to a blue underlined link. How do I add a hyperlink to an image in my Mail signature?

    Hello,
    http://allforces.com/2006/04/14/css-signatures/
    http://timmargh.net/archive/2006/05/custom_css_signatures_in_mailapp.php

  • Is there any way to add a hyperlink to text in Messages.app?

    Is there any way to add a hyperlink to text in Messages.app? 
    I frequently share links via Messages and would like to have clickable text with a hyperlink beneath vs an ugly URL.

    Hi,
    In iChat and early versions of Messages this used to be CMD + K keys together
    This no longer works.
    It seems CMD + K is free as a Modifier keystroke.
    I would have  added it as an item in System Preferences > Keyboard > Shortcuts.
    The issue with that is the fact that there is also no longer an Menu item for it.  (so it does not work).
    You can add a URL and then Right Click and there is an Edit option but this only allows you to change the URL and not add a URL to existing unsent text.
    Right Clicking unlinked Text does not allow you to Edit it either (well there are some format option but not Hyperlinks)
    I can't find away around this.
    I know in the past the AIM service suffered from malicious code sent in Hyperlinks  so this might be the reason.
    9:56 pm      Monday; January 5, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How to add a hyperlink to my Frame?

    Hi everyone:
    I want to add a hyperlink to my swing application .When user click it whick will open a IE and go to mywebsite.But it is so difficult ,my code don't work property.
        je.setPreferredSize(new Dimension(180, 22));
        je.setEditable(false);
        je.setPage("http://localhost:3030/lyomail/html/link.htm");
        final JTextField jf=new JTextField("http://java.sun.com");
        jf.setEditable(false);
        jp.setBackground(Color.orange);
        jp.setDoubleBuffered(false);
        jp.setEditable(false);
        jp.setPage("http://localhost:3030/lyomail/html/mailpic.htm");
        JLabel MyLink = new JLabel("http://www.hotmail.com");
        MyLink.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            //Do whatever you want to do here
            URL u = null;
            try {
              u = new URL("http://www.hotmail.com");
            catch (MalformedURLException ex1) {
            try {
              URLConnection ur = (URLConnection) u.openConnection();
            catch (IOException ex) {
        jp.addHyperlinkListener(new HyperlinkListener(){
          public void  hyperlinkUpdate(final HyperlinkEvent ed){
            if (ed.getEventType()==HyperlinkEvent.EventType.ACTIVATED){
              SwingUtilities.invokeLater(new Runnable(){
                public void run(){
                  try{
                    Document doc=je.getDocument();
                    URL u=ed.getURL();
                    je.setPage(u);
                    jf.setText(u.toString());
                  }catch(Exception e){
                    System.out.println(e.toString());
        });The Runtime.getRuntime().exec can do this well.But how to get user's Explore 's path? Where he install IE?
    THks!

    Hi
    I change my code to :
    try{
                        Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://localhost:3030/lyomail");
                      }catch(IOException ed){
                         System.out.println("E:"+ed.toString());
                }But it can't work now. It report error when I run it
    java.net.ConnectException: Connection refused: connect

  • Unable to add a hyperlink to an ID

    I'm unable to add a hyperlink to an ID on the page. Inserting in an ID into the hyperlink menu prepends the "http:///" to it. At the very least, it would be helpful to be able to link to "#top" as most browsers handle that by default these days. But, more importantly, it makes it difficult to link to a particular ID that isn't generated by Muse. URLs that start with '#' shouldn't get the protocol added at the beginning.
    If you have a workaround for it, I'd love to hear it.

    That's likely what I'll be using for now, but it will make my process a bit more complicated. This is for a custom widget, and I was hoping to be able to instruct customers "If you want X to happen, just make a hyperlink to #id and whenever the user clicks on that it will." For now, I guess I'll have to go with another widget part in the library.
    Thanks

  • Add a hyperlink to animated button created in Edge.

    Hello,
    Is there any way to insert an animated button I created in Edge into Muse and add a hyperlink to it. The roll over and roll out work perfectly when inserted into my web page, I just can't attach any actions to it. Thanks.

    I'm attempting to do exactly this, and when I preview the Muse site in the browser, I get a page not found reply.
    As a test I've rigged up buttons in Muse that go to the exact same page, and they work perfectly.
    When I click the link, this is added to the end of the url.
    assets/design-page-animated-menu/logo-design.html, when the folders for assets, and design-page-animated-menu don't exist.
    This url seems to be generated somewhere in the export/preview process, but is not the url I directed the Edge Animate link to. It is simply directed to logo-design.html which as far as I can tell should work, as both pages are in the same folder—when exported—with no subfolders involved.
    Where is this longer url being generated, and is there anyway around it?
    Edit.
    Upon researching this further, I see that even though the muse pages are all in the same folder, the page that Edge is creating—that is being displayed on the Muse page via an iframe—is in it's own folder, and is therefore unable to see the pages I was linking to.
    I see that as mentioned above, it's just better to use absolute urls, and that they just won't work in testing.

  • Modifying multiple url hyperlinks.

    Hi all.
    I've been working with InDesign CS3 to convert a catalogue into iPDF format for web distribution. This involves me going through the document page by page hyperlinking each program in the catalogue to the corresponding url. Recently I've been informed that all these hyperlinks need to be amended by addition of a few characters to the end of every url. This wouldn't be a problem, but there is a couple thousand hyperlinks that would need to be updated.
    This brings me to my question: Is there an easy way to modify/amend multiple hyperlinks within an InDesign document or alternatively a way I could do this same task using Adobe Acrobat Professional 7.10?
    Thanks in advance.

    My url hyperlinks currently look something like this:
    Eg.
    http://www.websitename.com.au/Product.aspx?id=PRODUCTG
    http://www.websitename.com.au/Product.aspx?id=PRODUCTQ
    and what I need to to is add another short code to the end of each hyperlink:
    Eg.
    http://www.websitename.com.au/Product.aspx?id=PRODUCTG  + '-22058'
    http://www.websitename.com.au/Product.aspx?id=PRODUCTQ  + '-22058'
    so they look like:
    Eg.
    http://www.websitename.com.au/Product.aspx?id=PRODUCTG-22058
    http://www.websitename.com.au/Product.aspx?id=PRODUCTQ-22058

  • Possible to add a hyperlink on a T/F question slide?

    Greetings,
    I'm delivering a Captivate 5.0 course in Adobe Connect Pro which is recording completion on the last slide through a True/False question slide (a one-question "Quiz").
    However, I want to add a hyperlink to the Correct Caption that appears after the user submits the answer. (I'd also like the Captivate course to close upon clicking the hyperlink, but I'll settle for just the hyperlink actually going somewhere.)
    I see that the hotspot, button, & slidelet tools are disabled on this question slide.
    I've looked for widgets or some way to run javascript, but I haven't found anything.
    What am I missing? How can I add a hyperlink to a question slide?
    Thanks in advance,
    Cheryl

    Hi Cheryl
    Normally adding a Hyperlink is simple. You insert a Click Box and link it to the URL. But as you likely have discovered, you cannot insert a Click Box on a Question slide.
    So what options do you have?
    Well, you could visit Lilybiri's blog and learn how to build your own Question slide using basic tools and Advanced actions in Captivate. At that point the slide is just like any other and you may then insert the Click Box object and link to the URL.
    Or you could create a single slide Captivate project that is sized really small and contains nothing but a Click Box that carries out the action of linking to the URL. Then publish that as a SWF. You would then be able to insert the SWF into the Question slide. I'm not sure how well that will actually work in action, but I've done it before without issue. Like anything, your own mileage will probably vary.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • How to make a url hyperlink in interaction center alert

    Hello,
    We would like to have a hyperlink to a url in the alert in the interaction center of CRM 7.0.
    We have tried to make the hyperlink in the alert text, by writing this html code <a href="http://www.google.com">GLOOGLE</a>
    but we think the alert editor does not accept that code.
    Does anyone know how to insert a url hyperlink in an alert ??
    Thank you very much in advance.
    Luis Angel Fiel

    Hello Luis,
    In order to insert a hyperlink into an alert, you actually need to use the Navigation Object Type/Action field and choose an existing navigation object type/action (launch transaction) that has been mapped to your desired URL. This is the same technique that you would use if you want to call the URL from anywhere else, like the NavBar. You can't simply add a URL directly to the alert.
    Best regards,
    John

  • How do you add a hyperlink on the latest Keynote?

    I want to know how to add a hyperlink in the latest Keynote.  I am running Yosemite.  I have a Macbook Pro 13 inch.  Thank You.

    right click an object on the slide
    choose;   Add Link
    in the Link To, dropdown menu;    select Webpage
    in the Link text, entry box;   type the URL in the form:   www.mypage.com

  • I have Yahoo mail. I want to add a hyperlink to emails. Your File tool in top bar has Send Link, but nothing happens. Yahoo says to use Format, but not there.

    As in someone's previous question, I used to be able to add a hyperlink from a website. On Yahoo help, they say to click the hyperlink button on the formatting toolbar. There is no formatting toolbar. On your top toolbar, under File, there is a Send Link. When I click on this, nothing happens. On the top toolbar, under Edit, the Copy, Cut and Paste are grayed out. Please let me know how I can add a hyperlink to my email. I tried to add one from an Amazon page, but did not see anything on the page to make it possible. Thanks in advance.
    Dorothy

    First thing...you made a mistake
    import javax.swing.JScrollPane;
    import javax.swing.JScrollBar;
    import javax.swing.*;When you import javax.swing.*; You automatically
    import JScrollPane & JScrollBar class, there's no
    need for you to re import again...
    That is not always a mistake. There are cases where it makes sense to do both (i.e., to import both '*' and a specific class name from that package at the same time). I believe the common example is:
    import java.awt.*;
    import java.util.*;
    import java.util.List;Now you can use "List" as a short name for "java.util.List", but must use "java.awt.List" in full for "java.awt.List" objects. If you just did:
    import java.awt.*;
    import java.util.*;Then you couldn't use List as a short name for anything--because it is ambiguous. You'd have to use both "java.awt.List" and "java.util.List" spelled out in full.
    Or, if you did:
    import java.awt.*;
    import java.util.*;
    import java.awt.List; // NOTE CHANGEThen "List" is short for "java.awt.List", and you must use "java.util.List" in full for "java.awt.List" objects.

  • How to add url in iCal

    Hello,
    I am doing programming cocoa application.I add task in iCal.But i want to add url in task from code.I try task.url= @"gjgjh" but it is not done.
    Thank you...

    You're probably better off posting your question on Apple's developers list.

  • How do I add a hyperlink in Preview 8.0 (Yosemite)?

    How do I add a hyperlink in Preview 8.0 (Yosemite)?

    Can't I just click on the link and have it go top the site? 
    The presentation must be in play for the link to be active.
    I get the window shown here.
    Your link doesnt work as it is an address for a file on your computer. Use the camera button in the menu bar of a reply to a post to show images.

Maybe you are looking for

  • To color a specific row in a Table UI element

    Hello Experts, We have a requirement to highlight (with distinguish color) a specific row of a table UI based on column data. Suppose we have a table with 5 column and 10 row, now if the data on 5th column greater than some XYZ value then we need to

  • SAP NetWeaver Mobile 7.1 at TechEd 2007

    The next generation platform for enterprise mobility is here, below link would help you through the session details. Don't miss to visit the demo pods at these locations, to see the SAP NetWeaver Mobile 7.1 live in action. /people/community.user/blog

  • Writing to the file

    Hi guys, Sometimes, I will need to write to a file the following entries: writeToFile (String, String, int, String) What is the best way to add the above line to the end of the existing file? I need to have single space between values: e.g. test test

  • PSE 9...exceed installation limit...

    I have owned PSE9 for over a year and it is installed on two computers only.  It has never been installed on any other computer other than the two at present.  Out of the blue and a year after the initial installations it now tells me I have exceeded

  • Pages are blank in next seesion

    I paste and edit text. I save and quit In Design. I open In Design. The relevant pages are blank. Where do I start troubleshooting?