Simple InDesign script - Illustrator help

I have this script by Peter Kahrel that reverese the order of letters in InDesign.
I need an Illustrator version of it. Can anybody help?
//ReverseText.jsx
//An InDesign Javascript that reverses the order of any selected text.
//If no text is selected with the Type tool, nothing happens.
//Written by Peter Kahrel for InDesignSecrets.com
#target indesign
if ( "TextWordLineParagraph".search ( app.selection[0].constructor.name ) < 0 )
    exit();
s = app.selection[0].contents;
s = s.split("").reverse().join("");
app.selection[0].contents = s;
Mainly using this for Arabic text in CS 3 and 4 for clients that don't have new versions - and will never buy it apparently.
Works great in InDesign. I've been putting the text in ID and then copying it into Illustrator. But it would be nice to skip that step if possible.
Thanks in advance.

here you go, this version works with current selection (text range), and with single or multiple text frames selected.
//ReverseText.jsx
//An InDesign Javascript that reverses the order of any selected text.
//If no text is selected with the Type tool, nothing happens.
//Written by Peter Kahrel for InDesignSecrets.com
// Ported to Illustrator by CarlosCanto // 12/06/12
// Usage:select a range of text in a text frame, or a text frame or multiple text frames before running
#target Illustrator
function reverseString(s) {
    return s.split("").reverse().join("");
var idoc = app.activeDocument;
var sel = idoc.selection;
if (sel.typename == "TextRange") {
    sel.contents = reverseString (sel.contents);
else if (sel.length>0) {
          for (i=0; i<sel.length; i++) {
                    if(sel[i].typename == "TextFrame") {
                              var itext = sel[i];
                              itext.contents = reverseString (itext.contents);

Similar Messages

  • Need help in Indesign scripting - Javascript

    Hi
    I have few questions during the indesign scripting.
    Please help me to answer those
    1. Targetting two engines.
    How to target Illustrator engine when the javascripts is running in indesign engine.
    2. Creating text in textframe
    How to create a text in textframe and uniquely identifying it for further updation of content of text.
    3. Creating form fields in Indesign
    How to create form fields in indesign through javascript so that after exporting to PDF it can be modified.
    4. Access method
    How to access methods defined in start up script from the our own cript folder.
    Thanks
    Karthik B

    1. I have No Idea what you mean. Do you want an InDesign script "target" illustrator? Try Brigdetalk.
    2. Described in the Javascript Tools guide.
    3. No amount of scripting will make #3 possible. [*] If you "desperately" need this, write a plugin for it.
    4. I'm not sure, but as far as I know nothing special is needed for that. At least, not if your own script shares the same engine. If it doesn't, then there is no way because that's how it is supposed to work, and no amount of scripting can work around that.
    [*] Apart from writing a complete PDF engine in Javascript, that is. Based on your other questions, it's a fair bet that's not going to happen any time soon.

  • Copy Illustrator contents to Indesign (Scripting) - Urgent

    Hi,
    I need to copy the contents of illustrator to indesign using scripting. Can any of you please help me to copy the contents from illustrator to indesign.
    Thnaks for help in advance

    ... Erm. What was the difference, then?
    BridgeTalk is a way to comunicate between Adobe applications -- for example, you can use it to trigger an InDesign script from Bridge to process selected indd-files (thumbnails) in Bridge. And vice versa, you can run a Bridge script from InDesign -- e.g. to get some metadata that you can't get directly from InDesign.
    Kasyan

  • Indesign from Illustrator Script

    I'd like to automatically open InDesign/InDesign script from an Illustrator script.
    There would be some arrays with data that will be passed on to the InDesign script for processing.
    I thought that involved #target indesign but that does not seem like what I need to do.
    I may just export the values to a txt from Illustrator if there are a lot of bugs in this process and then run the other script manually from InDesign.
    Javascript
    CS6

    Then it seems like I'd like to go the export txt route.
    That doesn't seem to be an option through scripting though you can manually do it??
    myCSVFileName = "illustratorValues.csv";
    myCSVFilePath = "~/desktop/"+ myCSVFileName;
    myCSVFile = new File(myCSVFilePath);
    myCSVFormat = ExportFormat.textType;
    myDoc= app.activeDoc;
    myDoc.exportFile(myCSVFile, myCSVFormat);
    ExportType.JPEG
    ExportType.PHOTOSHOP
    ExportType.SVG
    ExportType.PNG8
    ExportType.PNG24
    ExportType.GIF
    ExportType.FLASH
    ExportType.AUTOCAD
    ExportType.TIFF
    txt isn't an option like in indesign?

  • Illustrator Help and InDesign Help won't open

    Hi,
    I am having issues with the Help option within all of the CS5 programs such as Illustrator and InDesign.  In past versions I could open up the help and it would bring up the electronic manual right inside the program.  Now it just launches an application and I get an error message saying "Adobe AIR...The installation of this application is damaged.  Try reinstalling or contacting the publisher for assistance."  Same thing in IDD.  What does AIR have to do with Illustrator Help?
    Thanks

    It's the little intermediary app that manages the help. Since as of CS5 help can also be stored locally (again), this tool would allow you to download pages for offline viewing. There's a standalone icon for this in your CS5 program group. try to launch it standalone. If that doesn't help, reinstall Adobe AIR and download the patch for this help client from the support pages. There was an issue at some point, but it should have long been fixed with an automatic update., Apparently that hasn't happened on your system...
    Mylenium

  • Help with simple Automator script

    I have a simple Automator script for updating a specified folder with files from another folder. It consists of only two actions:
    1. Get Folder Contents (from the folder I drop on the Automator executable).
    2. Copy Finder Items.
    I left the option "replace existing files" unchecked because there's no point in replacing a bunch of files that already exist (we're talking about 4000-5000 files in the source folder).  I assumed that meant to ignore any existing files but, on the contrary, I found out that the script is copying duplicates of all the existing files -- making my target folder about 9000 files strong!
    How do I get a command into the middle of this script to restrict the Copy Finder Items command to files that do not already exist in the target folder? (It would be even nicer if it could check for files that are older than the files being copied and actually replace (only) those as well.)
    Any ideas?

    If you need the Terminal window to stay open, then you're looking at scripting Terminal. You can do this with Automator's run applescript action, or you can just use Script Editor (in Applications > AppleScript). Either way you will need to save the workflow/script as an application and drag it to your Login Items (in System Preferences > Accounts).
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "Terminal"
    activate
    set commands to "cd /Users/lenny/ventrilo/ 
    /Users/lenny/ventrilo/ventrilo_srv"
    do script commands in front window
    end tell</pre>
    PowerMac G5 (June 2004) 2x1.8GHz 1.25GB, PowerBook G4 (12-inch DVI) 1x1GHz 768MB   Mac OS X (10.4.3)  

  • Simple bash scripting help needed..

    I want to learn som simple bash scripting in order to automate various tasks.. Im totally noob, so bear with me
    First of all I would like to set configs without using nano.. is there a simple command for this? For example if i want change my hostname in /etc/rc.conf.. how can i print the current vallue and how can i change it`?
    i was thinking something like this to get the current value:
    # cat /etc/rc.conf | grep HOSTNAME=
    which returns HOSTNAME="myhostname"
    how can i change this value with one or more commands whitout touching the rest of the file?

    abesto wrote:
    A slightly naive solution:
    CHOICE="lisa"
    NAMES="homer marge lisa bart maggie"
    if [ "`echo \" $NAMES \" | grep \" $CHOICE \"`" ]; then
    echo "this is how you do it"
    fi
    The extra spaces inside the escaped quotes are to ensure that only a whole word is "matched".
    You can also replace the elif's with a loop through a list of "the other variables". Then you'd use the loop variable instead of $CHOICE above.
    grep can check on word-bounderies with \< and \>, or with the -w switch. The -q switch suppresses any messages and exits with exit-code 0 when the first match is found:
    if echo "${NAMES}" | grep -qw "${CHOICE}"; then
    Nice and readable, should work, but i haven't tested it
    EDIT:
    Procyon wrote:CHOICE="lisa"
    NAMES="homer marge lisa bart maggie"
    if [[ $NAMES =~ $CHOICE ]]; then echo match; fi
    This one also matches elisa, ie. no check on word bounderies. You should be carefull with that
    Last edited by klixon (2009-04-23 09:40:22)

  • Weird OT font behaviour in InDesign and Illustrator

    Hi font experts.
    I've been directed here by someone at the InDesign forum, who thought you might be able to help.
    Can anyone explain what's happening here?
    I've loaded an OT version of Zapf Dingbats into Suitcase Fusion on my Mac Pro and it seems just fine. Font Doctor says its OK. Suitcase Fusion says its OK. The font characters display correctly in Fusion.
    I can use both the TT and OT versions of the font in Mail and Word. Both versions print OK, too.
    But when I apply the OT font in Adobe InDesign or Illustrator, all I get to see is boxes with a cross through them and that "missing font" pinkish hue.
    No other OT fonts pose this problem. And deleting the TrueType font of Zapf Dingbats makes no difference so it's not a duplicates problem.
    As a result of the above I've temporarily ditched Fusion today to try out FontExplorer (which I like). Comparing the two fonts in there, I can see that there are lots of "missing" characters in the OT version if I select "Show missing characters", but none in the TT version. Not sure if that's relevant.
    Also, each character in the OT version has a lot more information, including Character Code, Unicode, Glyph ID, HTML and Keystroke, whereas the TT version simply has the Glyph ID. Don't know if that's relevant either. Incidentally, the keystroke doesn't work in InDesign or Illustrator.
    Thanks for any suggestions or solutions to this annoying issue. It seems very weird but maybe there's a simple explanation. Cheers.

    Dang! It was so obvious. The OT version has the symbols in the correct place in the glyph palette. The letters and numbers that I used to type to get the bullets and scissors are empty characters in OT. Thanks to Carl over at Extensis for enlightening me. Boy was I being dim.

  • Simple button script not working

    I am using AS2 and need help figuring out why this simple button script is not working:
    stop();
    buttonWS1.onRelease = function(){
                        gotoAndStop("Stage1and2_Boss",4);
    buttonWS2.onRelease = function(){
                        nextFrame();
    //end
    My buttons are the square letter-puzzles below. They are images that I converted to "symbols" (specifically, buttons). I put their names as above (buttonWS1, buttonWS2, etc.) in the "instance names" boxes.
    I have no idea what is going on. Please help!

    Hi -
    1. Yes, buttonWS2 is the instance name
    2. The only code attached to it is the code I pasted above.
    3. onRelease does not execute because my trace statement does not appear in the output
    Here is the modified code for buttonWS2:
    buttonWS2.onRelease = function(){
                        trace("clicked!");
                        nextFrame();
    Question: It shouldn't matter if I have commented-out code within that set of codes should it?:
    buttonWS2.onRelease = function(){
              //if (puzzleschosenarray[0] == 2 || puzzleschosenarray[1] == 2) {
              // cannot be chosen -- make button non-functional
              //else{
                        //puzzleschosenarray[roundnumber-1] = 2;
                        trace("clicked!");
                        nextFrame();

  • Smart Object as traditional link (as in InDesign or Illustrator)

    Is there a way to link a smart object, so that updates are made to the originally placed object ....as opposed to creating a new vector file save in a temporaray folder.  Is there a way to work with smart object like traditional links in InDesign and Illustrator?
    Thanks

    Check out this Links Panel that let’s you create Linked Smart Objects to external files:
    http://www.ps-scripts.com/bb/viewtopic.php?f=27&t=3045&sid=70f368dca9bfd96f3c974ee11b798f9 7

  • Color Separations in InDesign and Illustrator

    I am trying to print spot color separations. In both InDesign and Illustrator the "separations" is gray. I can only print RGB and grayscale.
    My colors are set up as spot. I even tried to print from Acrobat and "separations" is gray there also. Do I need to re-install my drivers or the programs.
    I am trying to print to postscript printers but neither one lets me select separations.
    I am using CS3
    Microsoft Windows XP
    Professional
    Version 2002
    Service Pack 2
    Intel(R) Core (TM)2CPU
    6600 @ 2.40 GHz
    2.93 GB RAM
    Thanks in advance for your help.
    Cindy

    I’m not familiar with those models. Are the PostSCript compatible? If so, then you should get the most recent drivers from the manufacturers’ websites. It’s been ages since I needed to worry about printer drivers in Windows, but maybe you need a PostScript printer utility or printer driver from Adobe, too.

  • How to Run Indesign Script in a file from plugin code in CS4?

    Hi,<br />I have the code to execute the InDesign script stored in external file for InDesign CS3.<br /><br />InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss)); <br />InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID()); <br />     IDFile scriptFile(scriptFilePath); <br />     if (scriptRunner->CanHandleFile(scriptFile)) <br />     { <br />       ScriptData returnValue; <br />       PMString errorString; <br />       ErrorCode error = scriptRunner->RunFile(scriptFile); <br />         ASSERT(error == kSuccess); <br />     } <br /><br />But the RunFile() method is cs4 expects an additional argument of the type RunScriptParams. <br />Someone please show me with a code snippet on how to excute a script file in CS4??

    Dear Ian
      Here I'm used the below coding in CS3, Its working fine....
    //In CS3 Coding
      PMString jsFullPath("c:\\windows\\sample.jsx"); // a path to my java script file
    do
    const
    IDFile outFile(jsFullPath);InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
    ASSERT( scriptManager ) ;
    InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
    ASSERT( scriptRunner ) ;
    if(scriptManager){
    InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
    RunScriptParams params(scriptRunner);
    ErrorCode err = scriptRunner->RunFile(outFile, kTrue, kFalse);
    while(kFalse);
    But the same time I used this coding in CS4, Its not woking
    //In CS4 Coding
    PMString jsFullPath("c:\\windows\\MacID\\BIN\\sample.jsx"); // a path to my java script file
    do
    const
    IDFile outFile(jsFullPath);InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
    ASSERT( scriptManager ) ;
    InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
    ASSERT( scriptRunner ) ;
    if
    (scriptManager){
    InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
    RunScriptParams params(scriptRunner);
    ErrorCode err = scriptRunner->RunFile(outFile, params);
    while(kFalse);
    I changed the "RunFile" arguments also
    RunScriptParams params(scriptRunner);
    ErrorCode err = scriptRunner->RunFile(outFile, params);
    But Still I'm facing the problem in InDesign CS4.  That's mean  "Adobe InDesign CS4" shout down for serious error happend.
    Please kindly help me, for solving this problem.
    Thanks & Regards
    T.R.Harihara Sudhan
    Message was edited by: Adobe-InDesign CS4

  • InDesign Scripting Guide/Apple Script

    The command
    set myTop to top of margin preferences of myPage
    described in the InDesign Scripting Guide doesn't work with Indesign CS2. Does anyone can help?
    Thanks

    Hi Morenga 65,
    Try:
    tell margin preferences of myPage
    set myTop to top
    end tell
    But, as Dave says, do come to the Scripting Forum--there's lots of good stuff there!
    Thanks,
    Ole

  • It´s possible to call to Adobe Professional 8 with Indesign scripting (.jsx) [JS/CS3] ?

    Hello, I would like to know if it´s possible to communicate with Adobe Professional through a Indesign script (.jsx). I need to convert the pdf file that I export from Indesign to specific standard type that is only available in Adobe Professional.
    I want to save the Indesign generated file with Adobe Professional and obtain the pdf that I particularly need.
    I would like to know if there is a way to do this.
    Thank u,
    Peter

    That's nothing!
    An engineer and I contacted Adobe technical support by phone to ensure the PC I was having custom built was configured to its optimum. They advised XP64 as the best operating environment. After that discussion we had to completely revise procurement, etc to get the bits and compatible XP64 compatible software, putting the build project back a few weeks as well, Imagine how I laughed when I found out on one of these forums that XP64 is the worst choice and totally unsupported by CS4!
    I have written to Shantanu Narayen, Adobe CEO and didn't even get an acknowledgement I raised this last week on the Adobe stand at BVE and was told they'd get someone to contact me asap but guess what, niet...! To be fair there has been one Adobe executive that recognises the problem and the damage poor customer support is causing the company; he has been as helpful as he can. Unfortunately, it seems the overall Adobe culture at the top is "get the money and run". If your problem goes beyond what's already on their web pages, tough luck!
    Regards,
    Graham

  • Call Photoshop script from Indesign script CS4 JS

    Hi, I open Photoshop linked file from InDesign in Photoshop and I need same InDesign script to run Photoshop script on the file. How I can call the Photoshop script from InDesign script.
    Thank you very much for your help.
    Yulia

    Thank you, Kasyan.
    800 lines of script is little be intimidating.
    What we are trying to achieve is to open jpgs in Photoshop and resave them as tiffs and replace same jpg with corresponding tiff in Indesign as it was placed before.
    Is there a way to call Photoshop from Indesign through appleScript.
    I have most of the script done for Indesign and I have Photoshop shript ready that saves jpgs as tiffs done. I am only missing the part where I can call this existing Ph. script from Indisign.
    We prefer not to use BridgeTalk if possible, because we have a lot of programs open and running in the same time, and would like to avoid to open one more program (BridgeTalk).
    Thank you very much for your great help.
    Yulia

Maybe you are looking for