Script for application of hyperlinks to text

Hello

I made a people directory document in InDesign using the data merge. Each person has information on access to its URL to social networks (LinkedIn, Twitter).

Is it possible to do a script that search the InDesign document for all channels that looks like this:

LinkedIn profile: http://a-very-long-URL

and transforms them in all the LinkedIn profile , but with the URL applied as a hyperlink?

If it's easier to search/replace operation I could mark the string without delimiters before executing the script, to avoid complex URL detection scripts. Maybe something like this (Markdown style): [LinkedIn profile] (http://a-very-long-url/)

Thank you!

Hello

Quick snippet, try...

var doc = app.activeDocument;
// get URL
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = '(?i)(?<=LinkedIn Profile: )(https?|www)\\S+\\>';
var mURL  = doc.findGrep();
// get Texte
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = 'LinkedIn Profile:';
var mSource  = doc.findGrep();

for (var k = 0; k  
         

Tags: InDesign

Similar Questions

  • Script for automatic placement of several text files?

    An editor I work with is slowed by a change to their workflow. Maybe there's a whole script for help? I looked but can not find, so I post here.

    Old workflow: Designers would be "automatic formatting" a single Word doc with all the preliminary pages (sometimes > 10 sections of diff.) and chapters and endnotes in a model book.

    New workflow: The Word doc is now divided into 30-40 InCopy files, always destined to a single InDesign layout doc (The InCopy files were created from a Word doc marked by a different system, so that they are all new to the InDesign user.)

    Y at - it a script which, according designers load a square slider with 30-40 (in the right order) files, which will allow them to simple-click on page 1, and InDesign will place one after the other files, autoflowing necessary? They still need them to be placed in individual InCopy files (so would not help concatenate Prime). I don't think that there is never a case of 2 stories being on the same page.

    Thank you

    AM

    Hey AnneMarie,

    This script allows you to select a bunch of files and will try to place them, one by one, in your InDesign document. It will be auto-flux them according to the needs (but be careful because standing in excess of problems - because the script does not test for this).

    I tested with a lot of property, but not with InCopy files because I did not. If they are adjustable as Word documents, the script must run end.

    Let us know if everything works correctly for you.

    // BS"D
    // Multi-file auto-place
    // An InDesign Script by Ariel, (c) Id-Extras.com, 2014
    // This script will allow the user to select a bunch of placeable files (Word docs, etc.)
    // It will then attempt to place and auto-flow all the selected files.
    // The script will start from page 1 of the active document
    // and keep adding pages as needed.
    // It will add text frames as needed, within the margins of the page.
    // IMPORTANT: There is no error-checking for perpetual overflow!!!
    // So, if something you're trying to place cannot fit within the margins,
    // The script will continue adding pages to InDesign until it crashes.
    // To quit the script, press ESC.
    var myDoc = app.activeDocument,
     myFiles = File.openDialog("Select files to place...", undefined, true),
     i,
     currentPage = myDoc.pages[0],
     prevFrame,
     myFrame;
    
    for (i = 0; i < myFiles.length; i++){
     myFrame = addFrame(currentPage);
     myFile = myFiles[i];
     try{
      myFrame.place(myFile, false);
     }
     catch(e){
      alert("Unable to place file: "+myFile, "Multi-file auto-place");
      continue;
     }
     while (myFrame.overflows){
      currentPage = addPageAfter(currentPage);
      prevFrame = myFrame;
      myFrame = addFrame(currentPage);
      prevFrame.nextTextFrame = myFrame;
     }
     currentPage = addPageAfter(currentPage);
    }
    function addFrame(aPage){
     var pageMargins = aPage.marginPreferences,
      aFrame = aPage.textFrames.add(),
      areFacing = app.activeDocument.documentPreferences.facingPages,
      myTop = aPage.bounds[0]+pageMargins.top,
      myBottom = aPage.bounds[2]-pageMargins.bottom,
      myLeft = aPage.bounds[1]+pageMargins.left,
      myRight = aPage.bounds[3]-pageMargins.right;
     //When document.documentPreferences.facingPages == true,
     //"left" means inside; "right" means outside.
     if (areFacing && aPage.side == PageSideOptions.LEFT_HAND){
       myLeft = aPage.bounds[1]+pageMargins.right;
       myRight = aPage.bounds[3]-pageMargins.left;
     }
     aFrame.geometricBounds = [myTop, myLeft, myBottom, myRight];
     return aFrame;
    }
    
    function addPageAfter(aPage){
     return myDoc.pages.add(LocationOptions.AFTER, aPage);
    }
    
  • Script for the use of rich text change

    I use the script below to add instructions for the use of Textfields. I would like to do the same thing with textfields in the rich text format, but this script no longer works when I put in the field to accept rich text. Can you tell me how to change the script, so it does not work in a ttext field that allows the user to enter rich text?

    MeetingMinutes. #subform [2]. Attendees::Initialize - (JavaScript, client)

    this.execEvent ("exit");
    This.format.Picture.Value = "null {'}" + this.assist.toolTip.value + ""} "";


    MeetingMinutes. #subform [2]. Attendees::Enter - (JavaScript, client)

    this.fontColor = "0,0,0";
    This.font.posture = "normal";


    MeetingMinutes. #subform [2]. Attendees::exit - (JavaScript, client)

    If (this.isNull)
    {
    this.fontColor = "153,153,153";
    This.font.posture = "italic";
    }


    MeetingMinutes. #subform [2]. Attendees::prePrint - (JavaScript, client)

    This.format.Picture.Value = "";


    MeetingMinutes. #subform [2]. Attendees::postPrint - (JavaScript, client)

    This.format.Picture.Value = "null {'}" + this.assist.toolTip.value + ""} "";

    Thank you

    -Don

    Hi Don,

    Similar to your script above, but try this in the event enter:

    if (this.rawValue === this.assist.toolTip.value) {
              this.rawValue = "";
    }
    

    and then exit on the event:

    if (this.rawValue === null) {
              this.rawValue = this.assist.toolTip.value;
    }
    

    ALTER depending on the initialize event and formatting, etc.

    Niall

  • See load test: ways to script for applications commands?

    Hello

    I'm designing a simple tool for an environment of view and so far its goes pretty well load test.  With the help of command line arguments and some Powershell, I am capable of recursion through a list of users and connect multiple sessions on a display server and open office and a few RDS App sessions.  My question is: is there a built-in way to pass a script in the command line arguments run certain commands on this computer to office or RDS App session?  Nothing crazy, just type in Notepad, open a few programs, save a doc or two--the usual stuff to generate regular workloads.

    I know that VMware and third party companies have tools for this, but they don't specifically meet my needs without extensive configuration and a lot of hooks in our systems.  I'm trying to keep the footprint of this test as small as possible, so a simple Powershell script is how I want to move forward.  I guess that Powershell has a method to do this, but I'm not guru script nor it is a PS forum, so I was hoping there was something that already exists when I call the view connection that I could use.

    Any help is appreciated, thanks in advance!

    I can not completely solve your problem, but it can be a little simpler.

    Q. for the "is there a built-in way to pass a script in the command line arguments run certain commands on this computer to office or RDS App session?

    A. No, but you can use strategies Group (GPO) that can be activated when his connection to run a script.

    BTW, for others who read this blog, "VMware View Planner" is the internal tool that can be used by customers too much for some areas of load test: VMware View Planner | United States

  • A loop through hyperlinks and add * at the end of the hyperlink source text?

    Hello

    I'm sure it's very simple, but my javascript is a little rusty and a little short of time, so I was wondering if someone could point me in the right direction?

    I need a script that loops through all the hyperlinks in a document (no matter what styles are or are not applied). Please check the source text to see if it starts with "www" or "http".

    If the source text starts with "www" or "http" then do nothing. OTHERWISE add an * at the end of the text. In other words if there is text in the document as "Click on this link" (and there had a hyperlink applied) it would be changed to "click on this link." If there is text in the document as "www.google.com" (and there had a hyperlink applied), it would remain unchanged. The hyperlinks themselves remain unchanged.

    So I'm not sure what my If/else statement must be?

    Links = app.activeDocument.hyperlinks;

    for (i = 0; i < links.length; i ++)

    {if

    ???

    }

    Thank you very much in advance for your help!

    Angèle

    How stupid. You are absolutely right. The names of hyperlink above, test script must test the hyperlink source texts. In the small sample, I have tested the script on, names of hyperlink and source texts were the same, that's why I had not spotted the questionable logic of the script. This scripts properly tests:

    hlinks = app.documents[0].hyperlinks.everyItem().getElements();
    re = /^(?:http|www)/;
    for (i = hlinks.length-1; i >= 0; i--) {
      if (hlinks[i].source.hasOwnProperty ('sourceText') && !re.test (hlinks[i].source.sourceText.contents)) {
        hlinks[i].source.sourceText.contents += '*';
      }
    }
    

    This would also explain the unexpected behavior of your / ^ j / test. (/ ^ j / tests whether a string starts with 'j' - no need to the * or the parentheses.)

    Peter

  • Script for the conversion of the hyperlinks to the buttons?

    Hello!

    Does anyone know if West a script for the conversion of the hyperlinks to buttons with the action of going to the URL with the same URL, which has been used with hyperlink?

    Here it is:

    /* Copyright 2012, Kasyan Servetsky
    November 29, 2012
    Written by Kasyan Servetsky
    http://www.kasyan.ho.com.ua
    e-mail: [email protected] */
    //======================================================================================
    var scriptName = "Convert hyperlinks to buttons - 1.0";
    
    Main();
    
    //===================================== FUNCTIONS  ======================================
    function Main() {
        var hyperlink, source, sourceText, destination, page, arr, outlinedText, gb, button, behavior,
        barodeCount = 0,
        hypCount = 0;
        if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);
        var startTime = new Date();
    
        var doc = app.activeDocument;
        var layer = doc.layers.item("Buttons");
        var swatch = doc.swatches.item("RGB Yellow");
        var hyperlinks = doc.hyperlinks;
    
        var progressWin = new Window ("window", scriptName);
        progressBar = progressWin.add ("progressbar", undefined, 0, undefined);
        progressBar.preferredSize.width = 450;
        progressTxt = progressWin.add("statictext", undefined,  "Starting processing hyperlinks");
        progressTxt.preferredSize.width = 400;
        progressTxt.preferredSize.height = 30;
        progressTxt.alignment = "left";
        progressBar.maxvalue = hyperlinks.length;
        progressWin.show();
    
        for (var i = hyperlinks.length-1; i >= 0; i--) {
            hyperlink = hyperlinks[i];
            source = hyperlink.source;
            sourceText = source.sourceText;
            destination = hyperlink.destination;
            page = sourceText.parentTextFrames[0].parentPage;
    
            barodeCount++;
            progressBar.value = barodeCount;
            progressTxt.text = "Processing hyperlink " + hyperlink.name + " (Page - " + page.name + ")";
    
            arr = sourceText.createOutlines(false);
            outlinedText = arr[0];
            gb = outlinedText.geometricBounds;
            outlinedText.remove();
    
            button = page.buttons.add(layer, {geometricBounds: gb, name: hyperlink.name});
            button.fillColor = swatch;
            button.fillTint = 50;
            button.groups[0].transparencySettings.blendingSettings.blendMode = BlendMode.MULTIPLY;
            behavior = button.gotoURLBehaviors.add();
            behavior.url = destination.destinationURL;
    
            hyperlink.remove();
            source.remove();
    
            hypCount++;
        }
    
        var endTime = new Date();
        var duration = GetDuration(startTime, endTime);
        progressWin.close();
    
        alert("Finished. " + hypCount + " hyperlinks were convertted to buttons.\n(time elapsed: " + duration + ")", scriptName);
    
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------------
    function GetDuration(startTime, endTime) {
        var str;
        var duration = (endTime - startTime)/1000;
        duration = Math.round(duration);
        if (duration >= 60) {
            var minutes = Math.floor(duration/60);
            var seconds = duration - (minutes * 60);
            str = minutes + ((minutes != 1) ? " minutes, " :  " minute, ") + seconds + ((seconds != 1) ? " seconds" : " second");
            if (minutes >= 60) {
                var hours = Math.floor(minutes/60);
                minutes = minutes - (hours * 60);
                str = hours + ((hours != 1) ? " hours, " : " hour, ") + minutes + ((minutes != 1) ? " minutes, " :  " minute, ") + seconds + ((seconds != 1) ? " seconds" : " second");
            }
        }
        else {
            str = duration + ((duration != 1) ? " seconds" : " second");
        }
    
        return str;
    }
    //--------------------------------------------------------------------------------------------------------------------------------------------------------
    function ErrorExit(error, icon) {
        alert(error, scriptName, icon);
        exit();
    }
    
  • Java script for counting the text boxes

    I have 10 text boxes. Y at - it somehow I can create a java script for an eleventh text box so whenever you type a number into one of the 10 text boxes it adds the value 1. By example, if you typed a number to 4 number 4 text boxes come in box 11. I googled everywhere and I just can't understand the sense. Any help would be appreciated.

    Of course, it is possible. Let's say the text fields are called "Text1" to "Text10" and the last of them is called "Text11"

    Use this code as the custom Text11 computer code:

    var total = 0;
    for (var i=1; i<=10; i++) {
        if (this.getField("Text"+i).valueAsString!="") total++;
    }
    event.value = total;
    
  • Is it possible to write a script for underlined text export to PDF?

    When I make changes in the financial document, I must emphasize this purpose to show what I edit, these underscore was called "markup". And then print (paper version) and gen (PDF) of the amendment, which means I have to print and gen text underlined (or called markup text) after modification.

    sample PIC:

    back markup.jpg

    If:

    Customer requires a new version of the markup, which means I have to change the last beacon color (color of the underline to the last amendments) in 'back' and then make new 'red' as this markup:

    red markup.jpg

    What I want:

    is it possible to write a script for printing and gen only markup in the document text all open

    and I want two versions

    (1) all text markup gen no matter the color of the underline

    (2) the red color of the markup text gen

    Thank you!

    Hi HarveyLiu,

    Why, you ask? It will export the pages who pointed out the text.

    var doc = app.documents;
    app.findTextPreferences = null;
    app.findTextPreferences.underline = true;
    for(var i=0;i
    

    Kind regards

    Cognet

  • Need help to create a Script for the labelling of Finder of Indesign files

    Try to find a way to have a script run in InDesign CS4, who tagged a RED text file once it's been imported into InDesign.

    Import multiple text files in an InDesign template. Since there are several text files in the same folder, it must somehow 'delineate' that we have imported this file and move to the next import. I created a 'service' with a keyboard shortcut Automator to label the Red file in the finder, but it would be great if we could have this occurs automatically after we imported in InDesign.

    If import us the text wrong by accident and it gets missed in fermentation, it costs us a lot of money with the printer.

    Thanks for all the ideas.

    Jim

    At its heart, it's what you want to do.

    tell application "Adobe InDesign CS4"
         set placeFile to choose file
         tell active document
              tell selection
                   --Assumes you have preselected the picture or textbox to place file in
                   place placeFile
              end tell
         end tell
    end tell
    tell application "Finder"
         set label index of placeFile to 2
    end tell
    

    You can expand on it pretty easily. The script for InDesign dictionary must be in the Library palette in the Applescript editor and the docs for Applescript are all online.

    If you need further assistance, you may wish to ask someone to write a complete script for you to spec for real moneyz.

    Best o ' luck!

    Eric.

  • Scripts for data cleansing Perf

    Hello

    We currently use BB 4.4 with the new features enabled PERF. Someone at - it scripts for cleaning or truncate the Perf Data collected? 4.5 is supposed to have the function programmed in. We run the BB server on unix.

    Perf Data under the $BBHOME / bbvar / perf

    The files are in plain text with lines like this:

    Here is a not so elegant way to truncate your files in perl. You will need to set the time as a unix timestamp.

    #Purge $BBPERF
    @files = "grep - Rl. $BBPERF / *';"

    $file (@files) {} foreach
    chomp ($file);
    Print "$file\n";
    @data ='cat $file | AWK ' {if (\$4 > = $startTime) {print \$0}} ";
    If (!) () open (FILE, "> $file"))) {print "cannot open $file: $!"} \n » ; print LOGFILE "cannot open $file: $! \n » ; next ;}
    foreach $line (@data) {print FILE $line ;}
    Close the FILE;
    }

  • What is the limit of memory for applications Webworks? Our application does not have to charge 50% of the time.

    * This question is memory of the Z10 device only Webworks *.

    We have looked EVERYWHERE and can not find an answer updated this! Also went through all the documentation.

    We have created several games using HTML5 which has great sound and special effects.  Only problem, is that we have heard that some people have had memory problems with applications Webworks.

    The game that we were about to publish has a 12 MB download size, but uses a 32 MB total memory. The script JS itself is only 800ko but are resources which are both loaded into memory to 12 MB, but an another 20 MB are generated on the plan procedural as the user through the levels.

    It worked fine in the Simulator about 3 / 6 times, with the other 3 times drawing a blank screen. We have not tested on a device yet. The game is flowing on the desktop browser 100% of the time.  We assume that failures of loading in the card sim is due to problems of memory?

    What is the total maximum memory allowed use for applications webworks? I heard that it's much lower than native applications.  We have a great game that has been in high demand for awhile now and it is very good for Blackberry players who pay for games - but unfortuntaely I'm not sure if we can publish now.

    There are 10 BlackBerry applications that exceed 1 GB in size and a very high memory usage. based on your numbers I do not plan to be a problem.

    As a general rule, if an application causes the operating system to run out of memory, the operating system will start cleaning things upwards (starting with the offending application) to free up resources. This will result in the application of closing; not a white screen.

    As a general rule, if you see a white screen on startup, it means that there was an error in the JavaScript code when loading.

    Did you by chance has created a debug version and connected Web Inspector to monitor for errors when starting?

    You use frames? BBUI.js, etc. ? If Yes, can you confirm that you expect for the event the window.load event * before * trying to access the document or WebWorks APIs?

  • Adpreclone automatic appsTier script for R12.2

    Hi gurus,

    I need to automate to run preclone for the apps and db on r12.2. for applications must pass the apps and password weblogic. How can I pass those without shell script prompt

    Hello

    There must be a space after the "{}" symbol.

    {echo appspass; echo weblogic_pass ;}} | Perl $ADMIN_SCRIPTS_HOME/adpreclone.pl appsTier

    Kind regards

    Bashar

  • HFM 11.1.2.2 HsvDatasource for application ABC with a process ID of 5424 on server HfmServer could not start!

    Hi all

    We improve our 11.1.1.3 to 11.1.2.2 HFM application using hfm copy utility.

    We also have run utility upgrade schema hfm and then save it with shared services.

    but we can see the error in hfm as system messages

    HsvDatasource for application ABC with a process ID of 5424 on server Hhfserver could not start!

    Server: HIBTV-HYP1T with ID 0 has been removed from the list.

    Unspecified error

    It seems that HsvDatasource hfm application does not start even in the Task Manager

    have idea about it

    Kind regards

    Dattatray Mate

    Hello

    That's how oracle has solved this problem.

    We had rules of /HFM of calc scripts in calculation for this HFM application manager.

    If oracle has asked us to remove references by running as a result of the SQL on the schema from table binaryfiles HFM hfm

    delete ABC_binaryfiles where label like '% CalcRules % ';

    After execution of this statement, we could open our HFM application successfully without any problem!

    Kind regards

    -Matt Dattatray

  • Hyperlinks in text

    For hyperlinks in text settings apply to the whole of the site.

    What happens if I want to use white text on black background and black text on a white background - so I can't adjust the settings to accommodate the.
    Help, please

    first step = open site accessories and add a new style... call something that you like and that you set the colors of the link.

    second step = hylight text and select the drop-down list hyperlink tool... Choose the style that you have made this list.

  • This handy subtitles AE script for Mac works on PC?

    Hello

    Here is also after effects script, I used on the Mac for a while now (credits in header information), it generates subtitles to layer markers using a text file. It's great to burn in your subs and you do not have to enter timecode, just hit * where you want the line to appear/disappear. I hope you find it useful. My hidden agenda for the display is however if javascript there assistants can identify how to run on a pc (I searched for the original script for some time). Thanks in advance

    {

    Subtitle generator by! Rocky

    / / change by Colin Harman ( http://colinharman.com/ ) to work on a Mac

    //

    Save this code as

    'subtitles.jsx '.

    //

    Create a text file with your subtitles.

    Each line of text is the on-screen line.

    To have several lines on the screen at the same time

    just separated by the vertical bar (|) character.

    for example ' character talks 1 | 2 breaks in character.

    //

    Create a new layer of text in your publication, adjust its position.

    Make sure the centered text, so it's very nice

    Add markers (Numpad *) where each subtitle line should be shown/hidden.

    Run the script with the selected text layer, and select the subtitle file.

    Enjoy!

    function makeSubs() {}

    var layer = app.project.activeItem.selectedLayers [0];

    If (layer.property ("sourceText")! = null) {}

    file text var = File.openDialog ("Select a text file to be opened.", "");

    If (text! = null) {}

    var textLines = new Array();

    textFile.open ("r", "TEXT", "?");

    While (! textFile.eof)

    textLines [textLines.length] = textFile.readln ();

    textFile.close ();

    sourceText var = layer.property ("sourceText");

    var markers = layer.property ("marker");

    for (var i = sourceText.numKeys; i > = 1; i--)

    sourceText.removeKey (i);

    var line = 0;

    Subtext subTime, var;

    for (var i = 1; i < = markers.numKeys; i ++) {}

    subTime = markers.keyTime (i);

    sourceText.setValueAtTime (0, "");

    If ((i % 2) == 0) {}

    Subtext = "";

    }

    else {}

    Subtext textLines [line] = replace ("|", "\x0d\x0a");

    line ++;

    }

    sourceText.setValueAtTime (TextDocument (subText)) subTime, new;

    }

    }

    }

    }

    makeSubs();

    }

    I think that Mac have a sequence of different transport control. Try replacing this line:

    Subtext textLines [line] = replace ("|", "\x0d\x0a");

    with the more generic:

    Subtext textLines [line] = replace ("|", "\r");

    Dan

Maybe you are looking for

  • My Ipod nano 6th generation is not be picked up by the new Itunes

    This happened once before, after updating to itunes it no longer recognizes my Ipod nano 6th generation

  • W540: What drivers do I need?

    So I installed Windows Pro 8.1 (64-bit) on my new W540 (clean cloth on a recycled SSD), and I'm downloading drivers. On the Lenovo site, there are three different drivers for the card/SD card reader: Pilot of Alcor for Windows 8.1 chip card reader (6

  • Not loading are automatic updates of Windows.

    I have a windows XP and when the automatic update is going to load, it is said it was unsuccessfu to loading. I tried to get auto updates that I have on my computer many times and went on the web site of microsoft and also tried several times without

  • Iconia, a B1-810 has not been used for some time.

    When it is connected for charging that a lightning icon briefly appears followed by no action apparent. Occasionally, a disconnected a power plug icon is also displayed. When I press the side power button Acer page appears very briefly but will not s

  • 15 - r117ni energystar: USB NOT WORKING 15-r117ni

    I am using a computer laptop 15-r117ni. When I bought it, it had windows 8, so I went down to windows 7 because its impossible to get anything done on windows 8, which means that its irritating and takes the time to navigate to what I want. Now I hav