one of the scripts in AppleScript 2 (grep + Add hyperlink)

Hello.

I try to combine the two scripts. First digit numbers a greps 7 in indesign

and another, hyperlink, which is the same numbers as this (grep) selection'

Does anyone have idea how to do this. Thank you - Jan

This greps digit number 7 in indesign with this script

say application "Adobe InDesign CS5.5.

Activate

set grep preferences to find

set grep preferences to change

set {find what to find grep preferences to '\\d{7'}

say an active document

set myFoundItems to find grep

end say

end say

and this one hyperlink:

say application "Adobe InDesign CS5.5.

say document 1

set mySelection to selection

the value LinkID to content of mySelection as string

set LinkIDURL to string LinkID

try

set URL_L to do destination URL of the hyperlink name:LinkID destination URL:LinkIDURL} {properties

on error

set URL_L to the URL of the hyperlink destination LinkID

end try

set URL_La to do text of hyperlink source properties {text source: () (point 1 of mySelection), hidden:fake}

set MonLienHypertexte to do { new hyperlink with properties { }destination:URL_L source:URL_La visible:fake}

end say

end say

end



YES! I got it with the help of Indesign scripting quide.

Here's the applescript. Feel free to use if you need. It doesn't work if none of the hyperlinks are not assignet 7-digit, you're grepping with this script

say application "Adobe InDesign CS5.5.

activate

-grep opitonit ettei edelliset resetoi high vaikuta

the value find grep preferences for Nothing

the value grep preferences to change anything

-Asettaa haku in parametrit

define include hidden layers to find change grep options to false

define include locked layers to find to find change grep options to true

-7 number perakkain hakuaehto

{ the value find what to find grep preferences to '\\d{7'}

say an active document

-etsii jokaisen sivulla oleva mallikoodin nimen

the value myFoundItems to find grep

-ottaa ylos jokaisen mallikoodin numerosarjan

Repeat with I have from 1 to (count myFoundItems)

the value Name of the file of content of point i of myFoundItems

if not (there is the URL of the hyperlink destination FileName) then

the value The of to make the URL of the hyperlink destination with properties {name: FileName, destination URL: file name}

on the other

the value The to the URL of the hyperlink destination FileName

end if

-hyperlinkin of lisaa

the value TheHSName of file name

the value TheHS to do source hyperlink text with properties {name: TheHSName, text source: (point I of myFoundItems), hidden: false}

do new hyperlink with properties {destination: the, source: TheHS, visible: false}

end Repeat

end say

end say

Tags: InDesign

Similar Questions

  • error in one of the scripts of mover of data during the installation of campus solution

    Hello world
    This is my first attempt to install one of the products of peoplesoft
    I install HCM 9.0 on windows 2008 64-bit, oracle 11g
    I am now in task called a 7-16-9: PeopleTools system data update
    I ran pt849tls.dms with success
    but pt850tls.dms failed with the error:

    File: Data error MoverSQL. Stmt #: 0 error Position: 25 back: 904 - ORA-00904: "PT_RETENTIONDAYS": invalid identifier
    Failure of SQL stmt:UPDATE PS_PRCSSYSTEM SET PT_RETENTIONDAYS = RETENTIONDAYS
    Error: Error execute SQL for UPDATE PS_PRCSSYSTEM SET PT_RETENTIONDAYS = RETENTIONDAYS

    Is there a script that I missed?
    I followed the instructions step by step
    Thanks for your help,

    Did you run the sql script generated by the generation of project successfully (it is not rel849un.sql and rel850un.sql either)?

    Nicolas.

    Published by: Gasparotto N on April 12, 2010 11:36

  • If the default tabular form when you add line

    Hi guys,.


    I had a tabular presentation where I need to set a default 1 value in one of the fields that I click on Add a line. I have no idea how to reference the element in a table via JavaScript.

    Despite this, Add a line already button calls a javascript function to add a line, do not think its possible to use javascript here.

    Any suggestions how can I achieve this?

    Thank you very much.

    Can't you just change column attributes > tabular form attributes > type default PL/SQL Expression or a function > as the default * '1' *.

    This should add the value 1 to add when you click line

    You can use JavaScript, but why worry if it's easily achievable

  • AppleScript to automatically copy a video in one of the two folders

    Hi, on my drive hard, I have 2 partitions, one for my 10.10.2 OS and the other for my files. On my player I have 2 folders which I want to copy the video on: 'Movies' and 'Kids Movies. I put a "folder Action" on mounting my USB key to run this applescript I below. It automatically copies the video in my "Movies" folder, then after completing the copy, ask if I want to "Eject" usb drive via a dialog Yes or no.

    My question is, what is the script to add an another dialog box before the copy request is a film 'children '. A "Yes" response, the film would copy into folder 'Film Kids', if you press 'No' it might copy the video in the folder 'movies '. Help with this script would be greatly appreciated.

    My applescript so far:

    property ignoredVolumes: {'10,10 30 1. 5 't', '1. Add 5 t files"} - if necessary

    property videoExtensions: {"avi", "mov", "mpg", "wmv", "mp4" and "mkv"}

    the value moviemacVolume to the alias (POSIX file "files/Volumes/1. ("5T / movies")

                               tell application "System events".

    the value rootVolumes to disk (POSIX file ' / Volumes ' in the text)

    the value allVolumes to name of every element of disc of rootVolumes

    the value numofallVolumes to the County of allVolumes

    Repeat with the present book in allVolumes

    say application 'Finder '.

    if (the present book is not in ignoredVolumes and (this book as text) is not '. ') DS_Store') then

    Try

    if there are alias (POSIX (' / Volumes / "& the present book) as text file ) then game trk to 1

    on error

    game trk to 0

    end try

    If trk = 1 then

    duplicate (elements whose name is in the videoExtensions extension) in alias (POSIX file (' / Volumes / "and the present book) as text) to moviemacVolume

    say application 'Finder '.

    display the dialog box "Would you like to eject the USB drive?" button by default buttons {"Yes", "no"} 1 with the title "Eject?" give up after 60

    If the button returned of the result is 'yes' then ejection of the this book

    end say

    end if

    end if

    end say

    end Repeat

                   end say


    Replace the current command in double with:

    display the dialog box "is a child movie?" buttons default button {'Yes', ' no'} 1

    If the back button on the result is 'Yes' then

    Duplicate (items which extension is in the videoExtensions) in alias (POSIX file (' / Volumes / "& the present book) as text) to alias (POSIX file" / Volumes/files 1.5T/movies/kid's movies / ')

    on the other

    Duplicate (items which extension is in the videoExtensions) in alias (POSIX file (' / Volumes / "& the present book) as text) to moviemacVolume

    end if

    (143506)

  • Point to add to the script or Grep Style?

    Hello

    Is it possible to add a hightlight to a script?  Basically, what I want to do is highlight the text and the tricky part is that the text changes size depending on the size of the file, we are working on that.  I want to highlight automatically the "FOR PROFESSIONAL USE ONLY" the way that we do now is to underscore that in the menu options underscore: say my font size is 8, leading 9.6 (these will always change).

    Weight: = 9.6

    Shift: = - 8*.33

    Color = yellow

    It's the way we do now.  Can it be scripted or Grep style which will automatically do this for certain lines of text only?  And no matter the font size calculate what he needs to do if its 2pt, 10pt 100 PT etc... It will highlight the text specified correctly?

    I hope it's possible...

    Thank you

    The lower one is best.

    I remove a bug and also if not 'what' is provided to the point function culminating and there is no entry in find it which is the find panel of text and text is selected, then this text is highlighted.

    An idea in the script is that a shortcut can be applied to it and it will get its information from the Panel of text search.

    So for now to change the answer to this one

    // Highlight function by Trevor
    // http://creative-scripts.com
    // Custom Scripts for Adobe InDesign, Illustrator and a lot more
    // Beta Version 1
    // https://forums.adobe.com/message/8898663#8898663
    
    function highlight(what, color) {
        var range, s, doc;
        doc = app.properties.activeDocument;
        if (!doc) {
            return 'No Active Document';
        }
        s = app.selection && app.selection[0];
        range = (s && s.properties.underline !== undefined && s.characters.length) ? s : doc;
        app.doScript(f, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Highlight Text');
    
        function f() {
            var finds, find, l, leading, pointSize, currentChangeProps;
            color = color || app.activeDocument.colors.itemByName('Yellow');
            // Store current find change text settings
            currentFindTextWhat = app.findTextPreferences.findWhat;
            currentChangeProps = app.changeTextPreferences.properties;
            what = what || currentFindTextWhat;
            if (what !== '') {
                // if no what is provided then the current entry in the find text panel will be used
                app.findTextPreferences.findWhat = what;
                app.changeTextPreferences.changeTo = '';
                app.changeTextPreferences.underline = true;
                app.changeTextPreferences.underlineColor = color;
                finds = range.findText();
                range.changeText();
                l = finds.length;
                while (l--) {
                    find = finds[l];
                    leading = find.leading;
                    pointSize = find.pointSize;
                    leading = pointSize * find.autoLeading / 100;
                    find.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                    find.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
                }
                app.findTextPreferences.findWhat = currentFindTextWhat;
                app.changeTextPreferences.properties = currentChangeProps;
            } else if (range !== app.activeDocument) {
                leading = range.leading;
                pointSize = range.pointSize;
                leading = pointSize * range.autoLeading / 100;
                range.underline = true;
                range.underlineColor = color;
                range.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                range.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
            }
        }
    }
    
    /***************************************************************************************************************************************
    ** If text is selected then the "highlighting" is only applied within the selected text                                              **
    ** Otherwise the "highlighting" is applied within the whole document                                                                **
    ** One could change this to apply to what ever is selected in the Find text document if one wanted to                                **
    ** To highlight the word(s) in the find text panel just use highlight(); or highlight(undefined, app.activeDocument.swatches[5]);    **
    ** One can use highlight('Foo'); to highlight "foo" and ignore what's in the find text panel                                        **
    ** The formating / styles etc. for the find are taken from the find panel                                                            **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** otherwise yellow will be used                                                                                                    **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** If text is selected and what argument is given and the find what in the find panel is empty then the selected text is highlighted **
    **************************************************************************************************************************************/
    
    highlight();
    
  • Script to change the selected layer to one of the drop-down list in the layers palette colors

    Hello!

    I was wondering if anyone knows of a script that would allow me to change the selected layers (single or multiple selection) in 'Light Blue' or all the colors in the menu drop-down? (see attached screenshot)

    I found the following but it changes all layers and is the RGB color.

    -----

    say application "Adobe Illustrator"

    set current_Layer in current document

    view the dialog box "in the current document there is" & layersCounter & "layers." & "Recolor label layers?"

    Repeat until (layersCounter = 0)

    set color of layer layersCounter in the current document to {Light Blue}

    set layersCounter to layersCounter - 1

    end Repeat

    end say

    -----

    Screen Shot 2015-06-12 at 10.46.46 AM.png

    I don't know how the script so any help is greatly appreciated. Thank you in advance!

    John

    as far as I can tell this is only possible with a few other modifications... Since 'selected' is not a property of "layers" javascript cannot determine if you see a highlighted layer in the layers panel.

    you could do one of 2 ways. Depending on how many layers you want to change the color, you can either make those visible or hidden (for example, if you want to change to 80% of the layers of a specific color, hide others 20%). and then simply add a clause inside the loop if for.

    var doc = app.activeDocument;

    var layers = doc.layers;

    Blue of var = new RGBColor();

    Blue.Red = 79;

    Blue.Green = 128;

    Blue.Blue = 255;

    for (i = 0; i<>

    If (layers [i] .visible == true) {}

    var = aLay layers [i];

    aLay.color = blue;

    }

    }

  • Problem with the path of the current script and applescript

    Work in cs3 here

    Here's what I'm trying to achieve. I wrote a script in javascript, but I need the support of shell for some features. I can only run applescript shell so I'm able to run the shell script quite easily to applescript, as long as I have hard the path of the code in the applescript.

    It stops working when I get the activeScript path and then try and pass it in applescript.

    Here's what works

    < code >

    "myScript = 'do shell script \"/users/my_username/myScript.sh\' &------"------" & point 1 of arguments and return. "

    myParams = ['param1'];

    var result is doScript (myScript, ScriptLanguage.applescriptLanguage, myParams);.

    < code >

    It works fine, however I would like to have the shell script live in the same folder as the scripts Panel, so it is easier for others to install

    So here's what I tried to do

    < code >

    myScript = app.activeScript var;

    var thisPath = myScript.path + "/ myShellScript.sh";

    "' myScript =" do shell script------"" + thisPath + "------" &------"------" & point 1 arguments and return. "

    myParams = ['param1'];

    var result is doScript (myScript, ScriptLanguage.applescriptLanguage, myParams);.

    < code >

    It produced an error that says: Indesign can't find the file.

    So I tried to escape all spaces with a replacement of the chain, as follows:

    < code >

    scriptPath var = "\" "+ thisPath.replace(/%20/g,"%5C%5C%20") +" "-" '; "

    < code >

    It still does not work. I also tried to make an object file

    < code >

    scriptPath var = File (thisPath);

    < code >

    Couple other things I've tried include POSIX path in applescript, removing the additional quotes, enveloping the path in quotes.

    It did not work also. Any help would be greatly appreciated that I do not understand what I am doing wrong.

    UPDATE:

    Just after posting, I have corrected this problem. For anyone who wants to know, that's what I did

    scriptPath var = ""' + thisPath.replace(/%20/g,"\\\") "+ '" '; "

  • Output of the script is different from one system to the other.

    I am running a script from the command line on two different platforms (desktop Windows 7 and Microsoft Server 2008 R2 Enterprise platform) and the output of the script produces is different on each platform.  More precisely; the script is

    For /f "tokens = 2-4 delims = /" %%d in (' date / t) ") do (set mydate = % c-%-% b).
    For /f "tokens = 1-2 delims = /: ' %% in (' time / you) do (set mytime = %% a % b).
    mydate %Echo% > log.txt
    MyTime %Echo% > log.txt

    and the output from the Windows 7 Desktop is:
    2014-07-31
    0249 PM

    While the release of Server 2008 is:
    ECHO is enabled.
    0249 PM

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • TextWrangler, AppleScript, and Grep search

    Hi all

    Not really an AppleScript script engine, I would need to automate (with [ACE], no [JS]) searches grep in TextWragler to clean up the XML files.

    My start is:

    say application 'TextWrangler.

    set result to find 'aaa' , research in options of the window text 1 {:of thesearch modegrep}

    if (found from the result) then

    the value text of (found object of result) to substitution of grep of "xxx".

    end if

    set result to find "bbb" research in { window text 1 options { }:search modegrep}

    if (found from the result) then

    the value text of (found object of result) to substitution of grep of "yyy".

    end if

    set result to find "ccc" , research in options of the window text 1 {:of thesearch modegrep}

    if (found from the result) then

    the value text of (found object of result) to substitution of grep of "zzz".

    end if

     

    end say

    It does not work. I get an error message:

    Capture d’écran 2015-07-04 à 13.21.41.png

    ... When I run the following script:

    Capture d’écran 2015-07-04 à 13.22.08.png

    Thanks in advance!

    Obi - wan, try this.

    Tell application "TextWrangler.

    say text text window 1 1

    replace 'aaa' using the 'xxx' options {search mode: grep, starting at the top: true}

    replace 'bbb' by using the 'yyy' options {search mode: grep, starting at the top: true}

    replace 'ccc' with 'zzz' options {search mode: grep, starting at the top: true}

    tell the end

    tell the end

    Greenrookie

  • What can I do if the script runs faster than the network?

    I wrote a script between applications moving to InDesign, where he begins to AppleScript, to Photoshop, which AppleScript runs a JavaScript script to perform various tasks.

    It works beautifully on my laptop at home where I do my development. Yesterday, using me as a Guinea pig, I tried it in the office.

    On the third round, I was horrified to see the ExtendScript Toolkit pop up with an error message (about as welcome to see an AppleScript script, asking the user to open the Script Editor and fix a script).

    The error message was that app.bringToFront (); was not a valid function.

    This was the case in InDesign, which has a different activation function, and I realized that, even if my AppleScript called Photoshop activate, I was still in InDesign.

    The app.bringToFront JavaScript was so called because I had joined my code in the model of Tranberry.

    So I pressed the button stop on ExtendScript, returned to InDesign and represented the script. This time he worked as usual.

    Occasionally on our network we spend some time beachball - watch as a communication happens in the background. So I guess the time wherever the error was thrown was on one of these downturns in the network.

    The passage of InDesign, Photoshop is not happening pretty fast, but the script has run and has issued an order Photoshop JavaScript while I was still in InDesign.

    In AppleScript this unhappy communication with users can be avoided using blocks '... try error'.

    Is there an equivalent of the error handling in JavaScript that would allow me to avoid being tossed in the ExtendScript Toolkit and give them a friendly message to apologize, explaining what had happened and inviting them to try again?

    JavaScript has try/catch blocks

    try {}

    app.bringToFront ();

    } catch (e) {}

    error handling code

    }

    Or you might be able to use an if statement

    If (app == 'photoshop') {}

    app.bringToFront ();

    } else {}

    app handle not photoshop

    }

  • The script in my web page is on the left side?

    The script on my web page is a letter on top of the other. Menu names and the script on the page. If I open a Google search bar research shows the script one above the other. Is there a setting that I can change? I've updated Järva. This on a Win 7 OS.

    Please post a screenshot of that.

    See this support article.
    How to make a screenshot of my problem?
    It is best to use a type of compressed as PNG or JPG image to save the screenshot and make sure you do not exceed a maximum file size of 1 MB.

    Then use the button Browse... below the text message response area to download the screenshot.

  • TB, slow and not meet with 'The Script is not responding' mailWindow.js CAUSE: McAfee (new)

    I have been using TB and its predecessor Eudora for years without any problem. These last few months I met it is very slow and usually "does not" clicking on something before the end of the thought. At this point I sometimes get an error message "chrome://messenger/content/mailWindow.js:180", saying that the script has stopped working. I click on continue and it resumes.

    After reading the various posts on the topic several times I did 1) re-indexed 2) made a clean installation 3) disabled modules 4) run in safe mode. Nothing seems to improve things. typical symptoms are:
    A. Download emails seems to take normal time, but their display in the Inbox can take a minute or more (used to be instantaneous) by clicking in the intermediate product, the message "not responding".
    B. Sending messages seems normal
    C. selection of a mail in the Inbox, or try to move or delete one takes a minute or more. Click on in the meantime generates the message "not responding".
    D. generally every action with the mouse has this long accompanied "not responding".

    I use Windows Vista, McAfee is installed but disabled does not make a difference.

    https://wiki.Mozilla.org/Thunderbird: test: Antivirus_Related_Performance_Issues #McAfee

    If you're having trouble following the instructions please contact McAfee support.

  • With the help of the CocoDialog in AppleScript progress bar

    Script editor 2.7 (176)

    2.4 AppleScript

    I'm trying to use CocoaDialog with AppleScript to view and update a progress bar. However, I can't know exactly how to invoke a progress in AppleScript bar. I could not even open a window for future progress bar, and still less of the update.

    Please could someone advise me as to what AppleScript code should I put in the simple loop example below to create a progress bar CocoaDialog and running.

    Thank you very much

    Andrew.

    ----------------------------------------------------------

    cocoaDialogFilePath the value "/ Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog".

    the value of myText to form quotes "is a progress bar.

    -Bar settings first progress

    shell script cocoaDialogFilePath & "progressbar - text" & myText & "‑‑percent" & 0 & '‑‑float' & '‑‑stoppable '.

    -Create a loop and update the progress bar

    Repeat with 1 to 5 myCounter

    < What code put here for display and update the bar using the value of the progression CocoaDialog myCounter? >

    delay 1

    end repeat

    ----------------------------------------------------------

    There is an short and progress bar example here macosautomation. Or an example of an AppleScript/CocoaDialog Progress bar here. The native OS X 10.10 or later AppleScript approach to a progress bar displayed in the Script Editor status bar and a progression for applications and compiled scripts dialog box.

  • Script using AppleScript GUI does not

    Before we go too complicated, I'm starting to get a basic copy/paste using keyboard shortcuts to work. In theory, if I can copy a value of cells in another cell using keyboard shortcuts, I can use keyboard shortcuts, I need more complex scripts.

    Can someone more well informed that I look over the below basic code and tell me what I'm doing wrong?

    (I added the script editor to the security settings for accessibility to allow him to control the computer.)

    My code for a simple copy/paste in figures (other programs also not to answer):

    on run

    say application "Numbers".

    activate

    if not (there are document 1) then error number 1000

    say document 1

    tell the worksheet active

    the value the selectedtable to (the first table whose class of selection range is range)

    the value myRows to count the lines in selectedtable

    say selectedtable

    the value the selection range of cell 2 of rank 3

    sendCopy

    the value the selection range of cell 4 of rank 3

    sendPaste

    end say

    end say

    end say

    end say

    end run


    on sendCopy()

    say application 'Numbers' to Activate

    say application "System events".

    say application process "Numbers".

    key sequence « C »

    end say

    e nd dire

    end sendCopy


    on sendPaste()

    say application 'Numbers' to Activate

    say application "System events".

    say application process "Numbers".

    key sequence « V »

    end say

    end say

    end sendPaste

    Thank you

    Jason

    You favorite the AppleScript Language Guideand then use the appropriate syntax:

    key sequence Using 'C' command down


    key sequence 'V' with the command down


    It may or may not be other contributory factors in your script as to why it does not work.

  • Why do I get the message "a script on this page may be busy, or it may have stopped responding." You can stop the script now, or you can continue to s?

    I have 3 windows firefox with several tabs in each, but the main (and sometimes others) gel and prevent navigation showing a box indicating
    "A script on this page may be busy, or it may have stopped responding." You can stop the script now, or you can continue to see if the script ends.

    "Script: chrome://fctoolbar841468a1d7f44bd384e6bb0f13a06c64/content/fctoolbar.js:1.
    To stop the script? I think it's not to do with Google Chrome but FF model internal to web pages. Thus, a deficiency in the FF, inability to cope, but with what? As far as I KNOW, all software is up-to-date. I have restarted FF, restarted the laptop, but has not changed the FF problem. What is the cause?

    This is probably caused by a toolbar that installs on your version of Firefox. Most of the scripts that begin with chrome:// are extensions.
    I think that this is very probably the Nectar Search Toolbar , which raises the question, because it seems to be the only toolbar installed on your computer.

    Try Firefox Safe mode to see if the problem goes away. Firefox Safe mode is a troubleshooting mode that disables certain parameters, disables most Add-ons (extensions and themes).

    If Firefox is open, you can restart Firefox Safe mode in the Help menu:

    • In Firefox 29,0 and above, click on the menu button

      click Help

      then select restart with disabled modules.

    • In previous versions of Firefox, click on the Firefox button in the upper left of the Firefox window and click help (or click on help in the Menu bar, if you do not have a Firefox button) and click on restart with disabled modules.

    If Firefox is not running, you can start Firefox in Mode safe mode as follows:

    • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac: Hold the option key during the startup of Firefox.
    • On Linux: Exit Firefox, go to your Terminal and run firefox-safe-mode
      (you may need to specify the installation path of Firefox for example/usr/lib/firefox)

    When the Firefox Safe Mode window appears, select "start mode safe."

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. Please follow the section Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems to find the cause.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

Maybe you are looking for