[CS2/CS3 JS] Change case of selected character style

Dave Saunder's great script http://indesignsecrets.com/downloads/scripts/ChangeCaseOfSelectedStyle.jsx works wonders if you're dealing with paragraph styles.
I wanted to make it work with character styles. Naively, being a scripting rookie, I just replaced 'paragraph' with 'character' throughout the code.
I then nearly fell off my chair, because it worked. Thanks, Dave!

// You need to have a textFrame selected
var myFrame = app.selection[0];
var myParaCount = myFrame.paragraphs.length;
// There must exist a paragraphStyle name L-B
var myApplyStyle = app.activeDocument.paragraphStyles.item("L-B")
for (h=0; h < myParaCount; h++){
var myChar = myFrame.paragraphs.item(h).characters.firstItem();
// check if first char is "l" and if its applied charstyle name is CharStyleWin
if (myChar.contents == "l" && myChar.appliedCharacterStyle.name == "CharStyleWin"){
myFrame.paragraphs.item(h).appliedParagraphStyle = myApplyStyle;
/* Edited at 11.21 */

Similar Messages

  • Case bug in the Character Style Options?

    Hi, is there a bug with the CASE in the Character Style Options?
    When i set the "Case" to Small Caps and apply the Character Style to a text, it does not work.
    Please advise. Thanks!

    You cannot change uppercase to lowercase. The reverse is done with All Capitals, and what you are using is not "lowercase" but "small capitals". Only lowercase characters get transformed to Small Capitals, uppercase don't change.
    Dave Saunders wrote a script to find and change case per paragraph style -- it should be googable.

  • How can I change a local format (bol, italics) to character style

    Hi, I'm new in scripting. I need to change local formats to character styles in some documents, but I can't find the proper ID Object Model to do it in Java. Can somebody help me?

    Thanks for the help! It worked! But I have two problems now:
    1. The documents use Helvetica fonts (light, lightitalic, semibold, etc.) on headings, and the script doesn't recognize nor replace them as character styles. I guess I should replace those fonts with a compatible one (Times New Roman, perhaps). Is there any script that may do that?
    2. Some paragraph styles use bold by default, but the script generates a character style in that cases too. The perfectpreptex you send me attend to fix this problem, but the styles document crashes!!

  • Create XML Element Tag BasedOn Found Character Style

    Hi,
    Good Day!
    Basically I want to search only for character styles that contains "ntb-", that is why it is hard coded in my searchString variable.
    Although I was able to create XML tag based on selected character style, but it will always add/insert at the end of the parent XML element.
    Can anyone could help me how insert/add that element at the insertion point where the text is found?
    Thanks,
    --elmer
    var myDoc = app.documents[0];
    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
    var charStyles = myDoc.allCharacterStyles;
    var foundStyles = Array();
    var searchString = String();
        searchString = 'ntb-';
    var tempName = String();
    var tempName1 = String();
    for(var i = 1; charStyles.length > i; i++){
       tempName = charStyles[i].name;
       tempName1 = tempName.toLowerCase();
       if(tempName1.indexOf (searchString.toLowerCase()) != -1){
           foundStyles.push (tempName);
    var myDialog = app.dialogs.add({name: "Convert Footnote Character Styles to XML Tags",canCancel:true});
    with (myDialog) {
        with (dialogColumns.add().borderPanels.add()) {
            with (dialogColumns.add()) {
                staticTexts.add({staticLabel: "Character style to search : "});        }
            with (dialogColumns.add()) {
                selCharStyle = dropdowns.add({stringList: foundStyles, selectedIndex: 0, minWidth: 175});
    var dialogShown = myDialog.show();
    while (dialogShown) {
        if (selCharStyle.selectedIndex == 0) {
            alert("Must have at least a character style to search!");
            dialogShown = myDialog.show();
            continue;
        } else {
            insertXMLTags(selCharStyle.stringList[selCharStyle.selectedIndex], selCharStyle.selectedIndex, "0");
            break;
    myDialog.destroy();
    alert("Finished!");
    exit();
    function insertXMLTags(cStyle, cStyleIndex, ip) {
        var myFinds = searchStyle(cStyle, cStyleIndex);
        for (i=myFinds.length - 1; i>=0; i--) {
            var myIP = myFinds[i].texts.item(0).insertionPoints.item(0);
            var myParentXML = myIP.associatedXMLElements[0];
            var myChiidXML = myParentXML.xmlElements.add ( cStyle );
            myChiidXML.contents =  myFinds[i].contents;
            //set the selection
            app.selection = myFinds[i].texts.item(0);
            //remove the selected text
            myFinds[i].texts.item(0).remove();
            Utility Functions         
    function searchStyle(cStyle, cStyleIndex){
        var myFinds;
        // if script version is for Indesign CS2
        if (app.scriptPreferences.version < 5){                                 
            app.findPreferences = NothingEnum.nothing;
            app.changePreferences = NothingEnum.nothing;
            myFinds = myDoc.search(undefined, undefined, undefined, undefined,
            {appliedParagraphStyle: pStyle, appliedCharacterStyle: cStyle});
        // else, for CS3 and CS4
        }else{                                 
            //Clear any existing find/change settings
            app.findTextPreferences = NothingEnum.nothing;
            app.changeTextPreferences = NothingEnum.nothing;
            // set character or paragraph style to search
            if (cStyleIndex != 0){ 
                app.findTextPreferences.appliedCharacterStyle = cStyle;
            //Set the find options.
            app.findChangeTextOptions.caseSensitive = false;
            app.findChangeTextOptions.includeFootnotes = true;
            app.findChangeTextOptions.includeHiddenLayers = false;
            app.findChangeTextOptions.includeLockedLayersForFind = false;
            app.findChangeTextOptions.includeLockedStoriesForFind = false;
            app.findChangeTextOptions.includeMasterPages = false;
            app.findChangeTextOptions.wholeWord = false;                             
            myFinds = myDoc.findText();
        return myFinds;

    Here is a way you can find any field.
    Download the current template.
    Open it in word and go to the line that you are interested in.
    The blanket PO# will be a field. Right click on it and go to properties. You will see the xml element there.
    Hope this answers your question,
    Sandeep Gandhi

  • CS6 - Cannot Edit Some Character Styles

    Hi, using Creative Cloud, have latest updates.  Noticed some character styles will not allow editing, and some will.  These are styles originally created by using the "Create new style" icon at the bottom of the panel.
    For the ones that won't, neither double-clicking just to the left of the style name (double-clicking on the name itself allows renaming), nor selecting "Character Style Options..." in the panel preferences drop-down works.  
    Anyone else had this problem?  Thanks!
    Ingrid

    Further to the above.... which is now solved .....
    In case any other unfortunate non techie should experience it.......
    When you upgrade, some of your prefernces follow you.... this being one of them.
    The thing to do is to remove the exisiting and replace everything in the right hand  column.
    The fact that the browse button above indicates where you really want to edit, the names below are the edit locations it goes to.

  • Need script to place line break based on character style

    I'm a designer and know very little about scripting or XML, but here goes. I have some XML files I'm formatting for print, and they don't have paragraph returns where they need to be. The returns always need to be before a specific XML tag (that I can change to a specific character style to make it easier to find...). But I don't see a way to do this using the usual InDesign Find/Replace tools, so I assume scripting is going to be the answer. Anyone know how to accomplish this?
    Here's an example of the content I'm working with. The breaks need to happen BEFORE each <City> element. I'm using InDesign CS6 on a Mac.
    <?xml version="1.0" encoding="UTF-8"?>
    <Regions><Region>
    BIG BEND COUNTRY<City>
    <City_Name>ALPINE                       
    </City_Name><Event_Name>
    Big Bend Ranch Rodeo                                                                                </Event_Name>
    <Date>August 8-9                                                                                                                                                                                                                                                         
    </Date><Venue_Name>
    Sul Ross State University S.A.L.E. Arena</Venue_Name>
    <Website1>www.bigbendranchrodeo.com                                            
    </Website1><Phone1>
    4323642696</Phone1>
    <Phone2></Phone2>
    </City><City>
    <City_Name>ALPINE                       
    </City_Name><Event_Name>
    Big Bend Balloon Bash                                                                               </Event_Name>
    <Date>August 30-September 1                                                                                                                                                                                                                                                     
    </Date><Venue_Name>
    Alpine-Casparis Municipal Airport</Venue_Name>
    <Website1>bigbendballoonbash.com                                        
    </Website1><Phone1>
    4328377486</Phone1>
    <Phone2></Phone2>
    </City><City>
    <City_Name>EL PASO                      
    </City_Name><Event_Name>
    Alfresco! Fridays                                                                                   </Event_Name>
    <Date>August 1, 8, 15, 22, 29                                                                                                                                                           
    </Date><Venue_Name>
    Convention Center Plaza</Venue_Name>
    <Website1>www.alfrescofridays.com                                              
    </Website1><Phone1>
    915/534-0600</Phone1>
    <Phone2/></City>
    Thanks in advance!

    karol wrote:
    You can use [ code ] tags when pasting code https://bbs.archlinux.org/help.php#bbcode
    For it to really auto-update the mirrorlist it has to be put in a cronjob :-)
    If I run it twice, will the original mirrorlist (moved to mirrorlist.bak after the first run) be irrevocably lost?
    Just nitpicking: you don't have to use 'g' for global changes in the sed substitutions as there is only one occurrence per line.
    Thanks Karol - I made the adjustments above to address both comments. The 'g' for sed I think is OK to leave in :-)
    Last edited by Archieman (2011-05-31 04:00:55)

  • CS3 Character Style Changes Color On Save

    Hi All-
    I have a CS3 file where I imported character styles (using the character styles palette -> load character styles) from another file. I apply that style to a type layer, it looks fine (i.e. is applied correctly), then I save the file, and close. Upon opening the file that char. style's color is changed from white to a spot color. Any idea why?
    System: AI CS3 on Windows XP 32bit
    Thanks in advance.
    Tom

    Hi,
    I had a similar problem, which was caused by type having "overrides"
    when applying Character Styles.
    This is indicated by an asterisk appearing in the Character style name in the palette) when you select the type.
    This has something to do with applying a new style to type which already
    has some appearance attributes.
    Found that the solution was to clear overrides when applying a character style to selected type, by Alt-clicking on the new character style.
    Then, hopefully, the character style of the type is saved properly, and displays correctly the next time you open the drawing.
    Bye...
    Andrew

  • [AS, CS2 / CS3] Get Fill Color When Nothing is Selected (defaults? preferences?)

    Hi,
    where can I find the active color, which is active (border and fill color), when nothing is selected.
    E.g. I can get the active styles, when nothing is selected with:
    applied character style of text defaults
    and
    applied paragraph style of text defaults.
    Where nac I find the equivalent for fill and border color?
    Thanks
    Tobias

    Thanks, that was for CS3. Where can I get that in CS2?
    I searched the dictionary of document and application, but got no glue ...
    Thanks
    Tobias

  • JS:CS3 Newbie needs help! find/change character styles

    I'm new to scripting and JavaScript is giving me a headache, but I'll keep trying. What I'm trying to do is automate a few things so that the production time of our school newspaper is reduced while insuring accuracy.
    I've played around a little with the text find change sample and the changing or adding paragraph styles in the InDesignCS3_ScriptingGuide_JS.pdf and I barely understand what I'm doing.
    When us page designers receive text to place in the document, our editors mark the text with tags like: < b >text< / b >, where the word "text" is to be bolded. (there wouldn't any spaces between < and b and > etc. I just did that so It'll show up here). We have basic character styles and paragraph styles set up, and we just started working with nested styles.
    Is there a way we can search for the < b > tag and bold everything after it up until the < / b > tag? Sort of the way it does for html (the way it would do for this message if I took out the spaces). It'll be great if it could remove the tags as well, but if not, I know I could create a find/change script to do the removal afterwards.
    I appreciate any input.
    Thanks!

    You've not found yourself the easiest of tasks! You need GREP find/replace, not text. Do you have any experience with GREP? It's worth investigating, it's a powerful feature. The script below handles bold. For clarity, it doesn't do any error checking: it assumes that there's a document with text in it and that the document contains a character style called 'bold'.
    // talk to Indesign, nobody else
    #target indesign
    // reset the Find/Change dialog
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // find everything between <b> and  (including these codes)
    app.findGrepPreferences.findWhat = '<b>.+?</b>';
    // add 'bold' style
    app.changeGrepPreferences.appliedCharacterStyle = 'bold';
    // make the changes
    app.activeDocument.changeGrep();
    // now delete the <b> and </b> codes
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = '</?b>';
    app.changeGrep();
    You can adapt it easily to handle other codes, and at a later stage you could generalise it so that you needn't repeat whole bunches of code.
    Good luck with your first forays. Again, it's not the easiest of tasks, but it's worth getting to grips with.
    Peter

  • [CS2/CS3 JS] Finding the first character of each paragraph

    Hi,
    Can anybody help with my script below:
    for (h=0; myParaCount>h; h++){
    myChars = myStory.paragraphs.item(h).contents;
    if (myChars.characters.item(0) == "l" && myChars.characters.item(0).appliedCharacterStyle == CharStyleWin){
    myStory.paragraphs.item(h).appliedParagraphStyle = "L-B";
    This script is supposed to test if the first character is an "l" with my character style "Wingdings" applied to it. I could not test whether the character style is "Wingdings" or not. What could be wrong with my script. Thanks.

    // You need to have a textFrame selected
    var myFrame = app.selection[0];
    var myParaCount = myFrame.paragraphs.length;
    // There must exist a paragraphStyle name L-B
    var myApplyStyle = app.activeDocument.paragraphStyles.item("L-B")
    for (h=0; h < myParaCount; h++){
    var myChar = myFrame.paragraphs.item(h).characters.firstItem();
    // check if first char is "l" and if its applied charstyle name is CharStyleWin
    if (myChar.contents == "l" && myChar.appliedCharacterStyle.name == "CharStyleWin"){
    myFrame.paragraphs.item(h).appliedParagraphStyle = myApplyStyle;
    /* Edited at 11.21 */

  • Updating Dave Saunders find style/change case script

    How can I update a Dave Saunders script from CS1 and CS2 to CS5?
    he wrote a brilliant script which searches for a paragraph style and changes the case to upper or lower.
    However, it was for CS1 and CS2.   I can 't get it to run on CS5.
    it trips up on
      app.findPreferences = null;
    object does not support 'findPreferences'
    here is the script.  thanks for your help!
    //DESCRIPTION: Converts text in designated parastyle to designated case
    if ((app.documents.length != 0) && (app.selection.length != 0)) {
    myDoc = app.activeDocument;
    myStyles = myDoc.paragraphStyles;
    myStringList = myStyles.everyItem().name;
    myCaseList = ["Uppercase","Lowercase", "Title case", "Sentence case"];
    myCases = [ChangecaseMode.uppercase, ChangecaseMode.lowercase, ChangecaseMode.titlecase, ChangecaseMode.sentencecase];
    var myDialog = app.dialogs.add({name:"Case Changer"})
    with(myDialog){
      with(dialogColumns.add()){
       with (dialogRows.add()) {
        with (dialogColumns.add()) {
         staticTexts.add({staticLabel:"Paragraph Style:"});
        with (dialogColumns.add()) {
         myStyle = dropdowns.add({stringList:myStringList,selectedIndex:0,minWidth:133});
       with (dialogRows.add()) {
        with (dialogColumns.add()) {
         staticTexts.add({staticLabel:"Change Case to:"});
        with (dialogColumns.add()) {
         myCase = dropdowns.add({stringList:myCaseList,selectedIndex:0,minWidth:133});
    var myResult = myDialog.show();
    if (myResult != true){
      // user clicked Cancel
      myDialog.destroy();
      errorExit();
      theStyle = myStyle.selectedIndex;
      theCase = myCase.selectedIndex;
      myDialog.destroy();
      app.findPreferences = null;
      app.changePreferences = null;
      myFinds = myDoc.search('',false,false,undefined,{appliedParagraphStyle:myStyles[theStyle]});
      myLim = myFinds.length;
      for (var j=0; myLim > j; j++) {
       myFinds[j].texts[0].changecase(myCases[theCase]);
    } else {
    errorExit();
    // +++++++ Functions Start Here +++++++++++++++++++++++
    function errorExit(message) {
    if (arguments.length > 0) {
      if (app.version != 3) { beep() } // CS2 includes beep() function.
      alert(message);
    exit(); // CS exits with a beep; CS2 exits silently.

    I've adapted seddybell's new script so that it works with paragraph styles instead of character styles. Hope that's useful to someone.
    //DESCRIPTION: Update of Dave Saunder's ChangeCaseOfSelectedStyle script for CS5 and later
    //jblondie: Fork of seddybell's update so that you can select by Paragraph Style instead of Character Style.
    if ((app.documents.length != 0) && (app.selection.length != 0)) {
    myDoc = app.activeDocument;
    myStyles = myDoc.paragraphStyles; //jblondie: replaced character with paragraph
    myStringList = myStyles.everyItem().name;
    myCaseList = ["UPPERCASE","lowercase", "Title Case", "Sentence case"]; //jblondie: Changed myCaseList so it's consistent with InDesign's built in Change Case tool
    myCases = [ChangecaseMode.uppercase, ChangecaseMode.lowercase, ChangecaseMode.titlecase, ChangecaseMode.sentencecase];
    var myDialog = app.dialogs.add({name:"Case Changer"})
    with(myDialog){
      with(dialogColumns.add()){
       with (dialogRows.add()) {
        with (dialogColumns.add()) {
         staticTexts.add({staticLabel:"Paragraph Style:"}); //jblondie: replaced Character with Paragraph
        with (dialogColumns.add()) {
         myStyle = dropdowns.add({stringList:myStringList,selectedIndex:0,minWidth:133}) ;
       with (dialogRows.add()) {
        with (dialogColumns.add()) {
         staticTexts.add({staticLabel:"Change Case to:"});
        with (dialogColumns.add()) {
         myCase = dropdowns.add({stringList:myCaseList,selectedIndex:0,minWidth:133});
    var myResult = myDialog.show();
    if (myResult != true){
      // user clicked Cancel
      myDialog.destroy();
      errorExit();
      theStyle = myStyle.selectedIndex;
      theCase = myCase.selectedIndex;
      myDialog.destroy();
      app.findTextPreferences = NothingEnum.NOTHING;
      app.changeTextPreferences = NothingEnum.NOTHING;
      app.findTextPreferences.appliedParagraphStyle = myStyles [theStyle]; var myFinds = myDoc.findText(); //jblondie: replaced Character with Paragraph
      myLim = myFinds.length;
      for (var j=0; myLim > j; j++) {
       myFinds[j].texts[0].changecase(myCases[theCase]);
    } else {
    errorExit();
    // +++++++ Functions Start Here +++++++++++++++++++++++
    function errorExit(message) {
    if (arguments.length > 0) {
      if (app.version != 3) { beep() }
      alert(message);
    exit();

  • Manage multiple versions(ID CS,CS2,CS3,CS4) of INDD files Indesign proxy for PC

    Dear scripters,
    I have multiple version of ID installed in my system. I have ID CS,CS2,CS3 and CS4. While I am opening (double click) the ID CS file, automatically the file opening in CS4. For solving this problem I have searched in the forums I found there is a program called INDESIGN PROXY for MAC OSX. It manages the problems well.
    Now I am in the process of developing the application same like that for windows using VB. Here is my observation about Indesign proxy.
    1. While user double clicks the Indesign file the argument is not passing to the Indesign.exe, but the argument passes to the Indesign proxy. Something like this
    "C:\Program Files\Adobe\Adobe InDesign CS4\InDesign.exe" "%1"
    to this
    "C:\Program Files\IDproxy\proxy.exe" "%1"
    2. The proxy exe lists all the version of IDs in a dialog box. If user selects CS2, the proxy exe passes the command argument something like this
    "C:\Program Files\Adobe\Adobe InDesign CS2\InDesign.exe" "%1"
    3. Now the file will open in correct version.
    I am comfort with VB forums and coding but I am struck getting the file path while user double click's the file. I short need to get the file path of "%1" argument.
    I think I am detailed.
    Kindly advice me how can I proceed more?
    Thanks
    regards
    a r u l
    vpublish.net

    I don't think it's a mistake.
    "InDesign CS4 (3.0)"
    means: this is the OM for InDesign 3.0 (i.e., InDesign CS) that is contained in InDesign CS4.
    Wait -- do you mean there might be a difference between "the OM for InDesign 4.0 (i.e., InDesign CS2) that is contained in InDesign CS4" and, say, "OM for InDesign 4.0 (i.e., InDesign CS2) that is contained in InDesign CS5" ?
    Why on earth would anyone need that? I imagine it's not because even with versioning the 'older' scripts may not behave the same -- there must be dozens of mails about versioning not working ... I mean, if Adobe knows what causes older scripts to stop working (because, if I understand you correctly, they retroactively change it in the documentation for older versions), wouldn't it be yet easier to not cause those changes?

  • [CS3 JS] Correcting a Character Style Anomaly

    It used to be that you could define a character style to merely colour the text and give it an underline (e.g. for Hyperlinks) or just superscript the text (for Reference citations). When such styles, which do not call for a particular font or font size, are placed into InDesign CS, the styled text would take on the font and font size of the underlying paragraph style. However, after placing a Word .doc with these styles into a CS2 template, the font and font size becomes Times New Roman and 10 pt. The solution was to save an .rtf file and re-import the text. Now, in CS3 this work-around doesnt quite work: the font is okay, but the font size reverts to that default size of 10 pt.
    So, I would like a script that finds all occurrences of two specific character styles (Hyperlink and bibref) and then corrects the font size of the found text to that of the underlying paragraph style. These styles can appear anywhere within a document, including in tables. I have trawled through this forum and found enough to be able to search for the character styles, but I cannot fathom how to apply the font size of the underlying paragraph style. Any help will be greatly appreciated.
    By the way, re-applying the character styles doesnt work because the character styles dont define the font size; also clearing the overrides on the paragraph style while the text is selected isnt a viable solution, because other local formatting (i.e. italic) would be lost.

    Hi Peter
    Thank you very much for your quick response. I tried your script and it did as you intended by clearing the Font, Font Style and Point Size in the character style, but unfortunately it did not correct the problem of the style becoming some default style and size (Times New Roman 10 pt) when placed into ID.
    In fact, I had already set up the 'bibref' and 'Hyperlink' character styles with these fields blanked out. Also, I made Adobe aware of this bug when CS2 came out and they warned me that CS3 wouldn't fix the problem; but I didn't realize that CS3 would be worse than CS2 so that using an rtf file wouldn't fix things.
    So, I am left with my initial query: is it possible to write a script to search for the character styles in question and apply the font size of the underlying paragraph style?
    Thanks a lot for any help you can give.

  • CS2/CS3/CS4: Cannot get file path in Unicode of the current document on Windows

    Hi All,
    In my automation plugin I need to have full absolute path of the opened document with any possible non-English letters. Using SDK examples Listener and Getter that come with Photoshop SDK the full absolute path which I obtain is in the default ANSI code page (CP_ACP) and I can convert it to Unicode using MultiByteToWideChar() API. However this works well when I have corresponding to document name language set in the "Control Panel -> Regional and Language Options -> Advanced -> Select a language to match the language version of the non-Unicode programs you want to use." For example if name of the document has Russian letters and chosen language in "Regional and Language Options" is also Russian the described conversion works well. If I change "Regional and Language Options" to English for example, full path returned by Photoshop SDK API (AliasToFullPath in PIUFile.cpp) for the document with Russian letters will contain "????????.psd" symbols.
    So I need to have an ability to get absolute file path in Unicode. Is it possible in Photoshop CS2/CS3/CS4 for Windows? I have searched forum and SDK but could not find info on it.
    Is it possible to have native HANDLE of the opened file to get file info using Windows API?
    Please advice.
    Below given slightly modified code from Photoshop CS3 which I use to get absolute file pat of the opened document.
    Thanks and regards,
    Sergey
    std::string outFilePath;
    int32 theID = 0;
    SPErr error = kSPNoError;
    error = PIUGetInfo(classDocument, keyDocumentID, &theID, NULL);
    if (error == kSPNoError)
    Handle theFileHandle = NULL;
    error = PIUGetInfoByID(theID, classDocument, keyFileReference, &theFileHandle, NULL);
    if (error == kSPNoError)
    int32 length = sPSHandle->GetSize(theFileHandle);
    Boolean oldLock = FALSE;
    Ptr pointer = NULL;
    sPSHandle->SetLock(theFileHandle, true, &pointer, &oldLock);
    if (pointer != NULL)
    outFilePath = (char*)pointer;
    sPSHandle->SetLock(theFileHandle, oldLock, &pointer, &oldLock);

    Hi All,
    Does anybody know, whether it is possible to get Unicode file path of the current document in Photoshop via Photoshop SDK API or without them?
    Thanks,
    Serhiy

  • Question for scripting gurus: GREP search, change case make Smallcaps

    I have no knowledge of scripting at all, but this question keeps coming up during training sessions: is it possible to (java)script this:
    - Do a GREP search \u\u+
    - Change case to lowercase
    - Apply SmallCaps (or: apply character style)
    this would allow to search for acronyms and change them to smallcaps (or, even better: apply a character style with small caps and tracking)
    I know it is easy for OpenType smallcaps (do a GREP search, change to OT smallcaps) but this doesn't really change case. And some fonts used aren't OT.
    Anyone?
    Would be VERY apreciated!!

    But Harbs is a seasoned scripter who knows he'll get flamed if one of his scripts "just does not work" ;)
    Well, now that you mention it, the script is not really foolproof. It's a quick and dirty script which I threw together very quickly. It's missing any error checking, some of the variables global, and it's not in a private namespace. These are all things which could cause it to "just not work" ;-)
    Here's a more foolproof construct... (and it'll work on the current story if selected, or the whole document if there's no story selected) It will create a new character style if one does not exist and work on character styles within style groups as well. I wrapped the whole script in an anonymous function to give it a unique namespace as well.
    (function()
    if(app.documents.length==0){return}
    var doc=app.documents[0];
    // Change the following to your style name!
    var character_style_name = 'Small Caps';
    try{var range = app.selection[0].parentStory}
    catch (err){var range = doc}
    //comment out next line if you do not want styles.
    var charStyle = GetCharacterStyle(character_style_name,doc);
    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat="\\u\\u+";
    var finds=range.findGrep();
    for (var i=0;i<finds.length;i++){
    finds[i].changecase(ChangecaseMode.lowercase);
    //comment out next line if you do not want styles.
    finds[i].applyCharacterStyle (charStyle)
    //uncomment next line if you do not want styles.
    //finds[i].capitalization=Capitalization.smallCaps;
    function GetCharacterStyle(styleName,doc){
    var charStyles=doc.allCharacterStyles;
    for(var i=0;i<charStyles.length;i++){
      if(charStyles[i].name==styleName){
       return charStyles[i];
    return doc.characterStyles.add({name:styleName,capitalization:Capitalization.smallCaps});

Maybe you are looking for

  • Turning off Firewall Kills Internet

    I am using my Mac Mini Server as a DHCP server, Firewall, and NAT device.  I use a WiMax USB dongle as my internet connection.  The dongle uses a connection software that constantly fights with my firewall.  The firewall will cause it to disconnect a

  • Cluster deploying E-Business using GI

    Hi, Does anyone have any instruction/documentation/references on how to cluster deploy E-Business Suite as an application using Oracle Grid Infrastructure ? My understanding is that Grid Infrastructure / Clusterware can be used to cluster deploy any

  • Cant find premiere elements download.

    where can I download premiere elements to re-install?

  • Etrecheck

    My daughter just ran the Etrecheck program on her iMac. She says its running very slow.  This is the report.  Looks like she can use more storage - other than that, is there anything that looks out of whack?  Any programs she can run for a quick fix?

  • Mask and limit testing

    Hello,  When i am trying to use the Mask and Limit testing I am getting " Unable to View Properties"  could you please tell me what will be issue on this. Thanks KJD Attachments: Mask and limit testing.png ‏56 KB Mask and limit testing.png ‏56 KB