Applescript 2 scripts to one (grep+add hyperlink)

Hi.
I try to combine two scripts. First one greps 7 digits numbers in indesign
and another makes hyperlink that is same numbers as that selection(grep)'
Does anyone have  idea how to do that. thanks -Jan
This  greps 7 digits numbers in indesign with this script
tell application "Adobe InDesign CS5.5"
  activate
          set find grep preferences to nothing
          set change grep preferences to nothing
          set find what of find grep preferences to "\\d{7}"
          tell active document
                    set myFoundItems to find grep
          end tell
end tell
and this one makes hyperlink:
tell application "Adobe InDesign CS5.5"
          tell document 1
                    set mySelection to selection
                    set LinkID to contents of mySelection as string
                    set LinkIDURL to LinkID as string
                    try
                              set URL_L to make hyperlink URL destination with properties {name:LinkID, destination URL:LinkIDURL}
                    on error
                              set URL_L to hyperlink URL destination LinkID
                    end try
                    set URL_La to make hyperlink text source with properties {source text: (item 1 of mySelection), hidden:false}
                    set myHyperlink to make new hyperlink with properties {destination:URL_L, source:URL_La, visible:false}
          end tell
end tell
end

YES! I got it with help of Indesign scripting quide.
Here is the applescript. Feel free to use if you need. This only works if no hyperlinks are not assignet to those 7 digits you are grepping with this script
tell application "Adobe InDesign CS5.5"
  activate
  -- resetoi grep opitonit ettei edelliset haut vaikuta
          set find grep preferences to nothing
          set change grep preferences to nothing
  --Asettaa haku parametrit
          set include hidden layers of find change grep options to false
          set include locked layers for find of find change grep options to true
  -- 7 numero perakkain hakuaehto
          set find what of find grep preferences to "\\d{7}"
          tell active document
  -- etsii jokaisen sivulla oleva mallikoodin nimen
                    set myFoundItems to find grep
  -- ottaa ylos jokaisen mallikoodin numerosarjan
                    repeat with i from 1 to (count myFoundItems)
                              set FileName to contents of item i of myFoundItems
                              if not (exists hyperlink URL destination FileName) then
                                        set TheH to make hyperlink URL destination with properties {name:FileName, destination URL:FileName}
                              else
                                        set TheH to hyperlink URL destination FileName
                              end if
  -- lisaa hyperlinkin
                              set TheHSName to FileName
                              set TheHS to make hyperlink text source with properties {name:TheHSName, source text: (item i of myFoundItems), hidden:false}
  make new hyperlink with properties {destination:TheH, source:TheHS, visible:false}
                    end repeat
          end tell
end tell

Similar Messages

  • Applescript/shells script for capture one

    Hey,
    Wanting a script that will take the last item copied to the clipboard (which will be a folder name), search for it in finder, in "this mac", and then open the folder in Capture One.  It would be great if it were ready to run, so I could launch it each time with a keystroke.  Any one willing to help me on this.  Thanks so much!!
    I know a little applescript, but this one is kind of out of my league, I think, at least.

    Hi,
    You can use this script in an Automator Service (you can assign a keystroke combination to this service).
    If the script find one folder whose name equal the contents of the clipboard, "Capture One" will open this folder.
    if the script finds multiple folders whose name equal the contents of the clipboard, it will do nothing, because I don't know what you want in this case.
    To create a service, you start by selecting New from Automator's File menu.
    You should select the Service option, which is accompanied by a gear icon, clic "Choose" button.
    In your new service, you will see a bar at the top of the Automator flow pane. It has combo boxes that allow you to set filters that establish the conditions in which your service should be made accessible. You want to make a service that receives selected "No Input" and will operate in any application or select an application.
    Add the "Run Shell Script" action
    Copy/paste this script in the action:
    folder=$(mdfind "kMDItemFSName = \"$(pbpaste -Prefer txt)\" && kMDItemContentType = \"public.folder\"")
    if [ -z $folder ];then exit 0;fi ## no match
    tot=$(wc -l <<< "$folder")
    if [ $tot -eq 1 ]; then open -b 'com.phaseone.captureone7' "$folder"; fi
    Replace the bundle identifier in this script --> 'com.phaseone.captureone7'
    To know the bundle identifier of your "Capture One" application, run this AppleScript, copy the result to change the  bundle identifier in the shell script
    tell application "Finder" to get id of (application "Capture One")
    Save the service, quit Automator
    The final step is to assign a keystroke combination to the newly created service.
    Open the System Preferences application and navigate to the Keyboard preference pane, and select the Shortcuts tab.
    From the list on the left of the preference pane, select the Services category.
    A list of the installed services will be displayed to the right.
    Scroll to the last category titled General, and locate the service you just created.
    Double-click to the far right of the service name to activate the keystroke input field and then type the key combination you wish to assign to the service.
    Close the System Preferences application.

  • Add hyperlink by script

    Hi,
    Is it possible to add hyperlinks by javascript, so that they can be assigned later in the document? Let me explain my thoughts:
    This screen shot shows a list of different docs (001 to 005) and the URL for the first document. I would like to make a hyperlink to all of them more automatically. Because the file is saved as 54K0504001.indd, I think it can be done.
    What I should need:
    1. a pop up with a question:"how many hyperlinks to make"
    2. depending on the answer, creating the new hyperlinks in the panel with the full URL (if the answer is 2, I should get 2 hyperlinks, http://www.dekamer.be/FLWB/PDF/54/0504/54K0504001.pdf and http://www.dekamer.be/FLWB/PDF/54/0504/54K0504002.pdf

    We make parliamentary documents in Indesign (2014.2) and publish them in pdf format (www.dekamer.be). In this case (0504) we have a serie of 5 seperate docs. Each doc has refferences to the previous ones on his first page (so doc 005 has refferences to doc 004, 003 ,002 and 001), but no hyperlink (URL) are made. The "lorem ipsum" is the dummy text for "report, amendement ..." but is of no importance, just the 001, ... are.
    What I was thinking about, is having the hyperlinks (URL) "ready for use" in the hyperlinks panel, so that when we publish the document we can speed up the whole operation of creating new urls. When the exact URL is already in the panel, we just select the number 001 and assign it to the corresponding url (maybe named 001 too) in the panel and so on untill the last 00x.
    The destination is always pdf.  All hyperlinks start with http://www.dekamer.be/FLWB/PDF/54/ .  Per doc the number stays the same (0504), only the last part 001 changes....
    I add a screen shot of the first page from another doc.
    What the script (a java, no VB) should do is give me the possiblity to "prepare" the URLs so that they are ready in the dropdown menu of the hyperlink panel. The only thing is, we don't know in advance how many URLs we need. I thought a pop up would be the most easy way to solve that problem ("how many URLS have to be made? I the 0504 case I need 5 URLS named from 1 to 5). In the case below 23. I hope this explains it a bit better.

  • Add hyperlinks to pdf with script

    Hello,
    We have some pdf's in which we would like to add hyperlinks to a bunch of specific words. We would like to do this with a script.
    Just, I have no clue on how to do this with Adobe Acrobat. For the Word documents I can use VBA...
    Could somebody help me?
    Thanks!

    To develop with Acrobat you will need the Acrobat SDK. Forum here: Acrobat SDK

  • How does one add hyperlinks to images in Mail signatures?

    Greetings esteemed Mac boffins,
    How do I add hyperlinks to images that I have added to signatures in Mac Mail?
    There seems to be no option for it.
    Regards,
    Ryan

    It's just not working for me.  I can't figure it out.
    As you can see in the screenshot, I have the icon selection and when I go to the "add link" menu item, it's greyed out.
    I have provided 2 screenshots for reference.

  • Add hyperlink recompose document

    Hi,
    I receive documents from a third party company that uses specific hyphenation plug-in of their own.
    I have a script that adds hyperlinks using :
         - linkDestination = myDocument.hyperlinkURLDestinations.add
         - linkSource = myDocument.hyperlinkTextSources.add
         - then myDocument.hyperlinks.add(linkSource, linkDestination, {name : hyperLinkName});
    It causes the recomposition of the text with different hyphenation as I do not (and shall not) have the specific hyphenation plug-in.
    Is there a way to create hyperlinks without the document being recomposed (in fact no text or style has changed, there is no need to recompose) ?
    Regards,
    Lionel
    PS : I use indesign CS5.5

    Yeah, much to my dismay I saw this happen on otherwise complete documents: adding a simple XML or hyperlink markup -- which should have been fully transparent to the actual text -- suddenly made the text re-compose.
    A possible solution for Lionel is to create rectangles on top of the text, and assign the hyperlinks to these instead. These rectangles could be created on a layer of their own, so they can easily be removed if the text gets edited.
    A small drawback is that you can measure bottom, left, and right of text -- but not the top! However, you can sort of fake it: make the rectangle one leading amount high and move it down by about a 1/3th of its height (eyeballing result).

  • How to add hyperlinks in Import Manager

    Dear MDM-gurus!
    I really tried hard to find the solution, but couldn't find it here or in OSS.
    We already have a repository with more than 50.000 items.
    What I'd like to do is to add hyperlinks to PDF-files in the internet to each item.
    For this we got an excel-file from the supplier with the supplier part number in one column, the PDF-link in another column and the .
    In Data Manager I was able to add links manually or also with importing entries of the excel-file. Importing from excel takes a LOT of time. I don' t know why:
    -  Fields to import: Hyperlinks
    -  Key fields: Supplier part number.
    --> Action: Update all single matches.
    How can I import hyperlinks in Import Manager, make the mapping and then update the records faster? E.g. I could not find the field "URL <Hyperlink> [Qual]" in Import Manager
    Thanks for your help and best regards,
    Henning

    Resolved!
    I accidently oversaw the URL fields in Import Manager in table catalog items.

  • I want to create an applescript/automator tool to launch the "Add to library" command in iTunes with a specific path. Need process under the hood

    I want to create an applescript/automator tool to launch the "Add to library" command in iTunes with a specific path. I need to know what process is run under the hood to create such a script.
    To put you in context, I have an NFS mount point with all my music and with the "add to library" command, I can add more music to the folder and update iTunes without dragging the individual folders or the whole mount point and avoid having the songs show up as doubles.
    Anyone know what OS/Unix process is being called for such a command?

    I want to create an applescript/automator tool to launch the "Add to library" command in iTunes with a specific path. I need to know what process is run under the hood to create such a script.
    To put you in context, I have an NFS mount point with all my music and with the "add to library" command, I can add more music to the folder and update iTunes without dragging the individual folders or the whole mount point and avoid having the songs show up as doubles.
    Anyone know what OS/Unix process is being called for such a command?

  • Can you add Hyperlinks in Adobe LiveCycle Designer

    Hi,
    Does anyone know if you are able to add hyperlinks to the form which would allow me to jump to another separate pdf file?
    Thanks in advance,
    Trev C.

    Hi,
    Paul has some solutions for this.
    The following tread has two solutions:
    (1) set up invisible objects (like textfields) throughout the form and then script setFocus to those fields.
    (2) If using LC 8.1 you can add hyperlinks.
    http://forums.adobe.com/message/1915856#1915856
    There are some good posts to the forum; try searching specifically the LC Designer ES forum for "hyperlink".
    Sorry, just reread your question. In relation to opening other PDF files from within a form, you are going to come up against a security error. This will require you to have a JavaScript (.js file) in the JavaScript folder within the Acrobat programme folder. This .js file will also have to be deployed to all users' computers.
    The last post in this thread has a solution: http://forums.adobe.com/message/1359932#1359932
    I am not sure if this would suit your requirements, but another solution is to create a Portfolio with the required PDF files inside the portfolio. Then it is easy to create a link between the files using the "Link Tool".
    Good luck,
    Niall

  • Add Hyperlink in Mail as Word or Phrase Instead of Long Link Address

    I've been trying to figure out how to insert a hyperlink in an email message as a short word or phrase instead of having to Add it as the actual address. I've been using the Add Hyperlink command for some time. But it seems like it only remains a live link if you paste it as the actual html address -- which sometimes takes more than one line of text!
    Is there any way to paste link, add it, but have it show up as a short phrase? (You know, like "Sweatshirt" instead of http://www.eddiebauer.com/mensclothing/sweatshirts/45&65&39495843 etc. etc. etc.
    Thanks!

    Thanks a lot! I've been trying to do it backwards from that -- pasting the link into the Add Hyperlink Dialogue Box, and then trying to change the it there or after it's pasted.
    This will relieve my frustration! Thanks again.

  • Mail Keyboard Shortcut for Add Hyperlink...

    I added Control Option H as a new shortcut for Add Hyperlink in the Mail pull down menu
    It showed up in the Keyboard Shortcuts list and also shows correctly in the pull down menu after I quit and re-opened Mail; however when I try the shortcut, nothing happens.
    Could it be that I have to take into account pulling down the Edit menu first, to get to the Add Hyperlink command?
    And it only works after I create a New Message.
    How do I do all this?
    Thanks....David

    I'm not sure why this keyboard shortcut isn't recognized. In the meantime, you might try a different one.
    +These examples worked for me:+
    Option + Control + Up Arrow (⌥⌃↑)
    Using a function key, F1, F2, F3, etc.
    Using a function key with a modifier, e.g., Option + F2 (⌥F2).
    Good luck!

  • Add hyperlink to Notes app?

    Does the Mountain Lion notes app allow you to add hyperlinks like you could back in Snow Leopard 10.6.8/when notes was part of the mail app?  Thanks for any insight!

    colby2 wrote:
    The only way I can do this & retain my own text for the hyperlink is to create the link in TextEdit:
    That's what I've been doing, and it's really frustrating (not to mention a waste of time) that I have to use multiple editors to achieve these mundane tasks. I use Notes because it syncs across my IOS devices and I love the sidebar, but in what reality do you remove features and call it an "upgrade"? With the Mac Experience based on simplicity and ease of use, it's really sad that I still need MS Word, BBEdit, EverNote & Pages just to format some words.
    Eventually, they'll merge Notes & TextEdit into one, and market it as a some revolutionary magical super-app. And because it probably won't work on older devices, you'll have to take a trip to the Apple Store and buy some new hardware. A few years back, it seemed technology was advancing at breakneck speeds but now it's evolving so slooooooooow, I feel like I'm living in the stone age. I had such high hopes for the future...
    But this is more likely

  • Can you add hyperlinks to the images created in the slideshow on the command menu?

    can you add hyperlinks to the images in the slideshow created
    from the command menu? thanks

    On 30 Aug 2008 in macromedia.fireworks, mediastream13 wrote:
    > can you add hyperlinks to the images in the slideshow
    created from
    > the command menu?
    Unfortunately, those slideshows aren't all that flexible. I
    don't think
    that Adobe supplies the source for the Flash slideshows. But
    if you use
    the spry slideshow, you should be able to edit the HTML in
    Dreamweaver to
    add links.
    Have a look at one of Project Seven's graphics presentation
    products -
    Lightshow Magic, Slide Show Magic or Image Gallery Magic.
    They're $95
    each, and extremely flexible in what you can do with them.
    http://projectseven.com/
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • Applescript LabelGraphics script error

    When running the provided LabelGraphics applescript I get an error on the line:
    my LabelGraphics of me to {myLabelType, myLabelStyleName, myLabelLayerName, myLabelHeight, myLabelOffset}
    The error is:
    Error number: -2470
    Error string: A to:{myLabelType, myLabelStyleName, myLabelLayerName,myLabelHeight, myLabelOffset}
    can't go after this LabelGraphics of me.
    Does anyone know the proper syntax to get this to work? Thanks!

    I added the lines of script as requested so the script in full now reads as:
    set vpn_ip to do shell script "ifconfig tun0 | grep inet | awk '{print $2}'" # get current ip of vpn interface
    display dialog vpn_id
    set vpn_port to do shell script "curl -d \"user=USERNAME&pass=PASSWORD&client_id=$(cat ~/.pia_client_id)&local_ip=" & vpn_ip & "\"https://www.privateinternetaccess.com/vpninfo/port_forward_assignment 2> /dev/null|grep -oE \"[0-9]+\""
    display dialog vpn_port
    do shell script "defaults delete org.m0k.transmission BindPort" # delete previous port value
    do shell script "defaults write org.m0k.transmission BindPort " & vpn_port & ""
    do shell script "defaults delete org.m0k.transmission BindAddressIPv4" #delete previously written ipv4binding value
    do shell script "defaults write org.m0k.transmission BindAddressIPv4 " & vpn_ip & "" #write current vpn ip into transmission.plist
    (Censored my username and password).
    I run the script and get this error:
    error "The variable vpn_id is not defined." number -2753 from "vpn_id"
    With the first new additional code highlighted "vpn_id".
    display dialog vpn_id
    I created the .pia_client_id file but running a line of code in Terminal (which was detailed in the oringal thread where I found the script). The code I ran in Terminal was:
    head -n 100 /dev/urandom | md5 > ~/.pia_client_id
    Thanks so much for your assistance so far, I really appreciate it.

  • Add hyperlink greyed out

    Couldn't add a hyperlink to text box (greyed out) so I moved it to regular text and the add hyperlink is still greyed out.
    Finally I closed iBA and reopened it. No change.
    I've seen similar posts about links to graphics, and tried selecting the entire text box, but link option stays greyed out.
    Thanks

    My own experiments suggest that the central feature affecting the ability to add a bookmark is the outline of the text box that surrounds the text you are trying to make into a bookmark. If it is a ‘dotted text box’ then you will be successful; if it is continuous, you will not.
    These ‘dotted text boxes’ appear in any of the ‘add pages’ which already has a text box in it (eg 2 column or 3 column etc). What happens depends on whether you are selecting from the ‘section’ or ‘pages’ folder. Considering the ‘pages’ first.
    When added, these pages may appear blank because they don’t contain text until it flows on from the previous page (it will usually link its text boxes with the previous page).
    Any text that you add inside the dotted text box, or any that flows over from earlier ones, or any that is there by default can be selected and made into a bookmark: in other words the + in the bookmark inspector will not be grayed out.
    However, if you do anything that breaks the link with the previous ‘dotted text box’ (eg by selecting the frame and dragging the blue link end away from the box), then the text box becomes a ‘continuous line’ box and you can no longer create bookmarks within it. In fact any existing ones now connect to the the previously linked ‘dotted’ text boxes.
    It is also worth noting that all the text that was created in the now ‘continuous line’ text box may disappear—but if you insert a new ‘text box’ page, the text will appear again (as though it was homeless up to that point because it didn't have a linked text box to display in).
    If, say, you have three linked text pages, even if you delete the middle one the links will re-establish themselves between the first and last page and all bookmarks will be maintained.
    Now, if you add a page from the ‘section’ folder, (eg copyright, forward, etc) you may well find that there are 2 text boxes. Select each one in turn. If it has a continuous line you can’t add a bookmark to text inside it. If it is has the dotted lines, you can.
    Select the dotted line text box (by clicking on a handle) and you will find that a ‘blue link line’ does not enter it on the left (unlike ‘2 column’ pages etc) or leave it on the right. This makes things easier because it avoids the problems associated with the pages from the ‘page section’. You can create bookmarks for any words that you type into this text box.
    I hope I have got it right! It is all very confusing and still means that the bookmark feature is not as great as it could be: let’s hope that Apple puts things right with the next update.

Maybe you are looking for

  • SELECT-OPTION IN SCREEN (SCREEN-PAINTER)

    I want to put a select option in a screen type screen painter Using this the user could enter a ranger of personal numbers. Can any one give me a clue on how to do that ?

  • IPOD NANO FLASHING ON AND OFF

    My Ipod nano is flashing on and off when charging and does not respond when not charging. has anybody experienced this before? Is it fixable?

  • Apache service doesnt start after clone

    Hi we have a cloned environment and after clone finished successfully (as mentioned in logs ) , Apache service doesn't start at all while all other services are started successfully andwhen i issued adapcctl.cmd it resulted error status 2 . i think t

  • Changing 'on my mac' calendar for invitations

    I've read of many different problems regarding calendars and invitations, but not this one:  when I receive a standard .ics invitation by email and I double-click it, the event goes goes into iCal, but under a calendar that I've never created, called

  • Bug in 7.5.x firmware (SPA30X/SPA50X), lagged localization

    Starting on idle display, the user can show line statuses using UP or DOWN arrow. For example, Line Key 2 (defined as private, extension 1, Short Name 9876) show text Line 2 9876 READY most of the time. Unfortunatelly, if no Short Name specified (e.g