[JS - CS3]  Not able to add 'Superscript' style to a character within a string

Hello fellow experts...
I'm stuck with trying to change the style of a character from Normal to Superscript!
b Situation:
I have a string - 'myCourseTitle' - that has both CharacterStyles & ParagraphStyles applyed and could include the following character/Word:
> '®' (Character)
'OperateIT' (Word)
b Requirements:
I am wanting to add the style 'Superscript' to both the '®' characters and 'IT' from the words 'OperateIT', while keeping their initial CharacterStyles & ParagraphStyles!
b My Starting Block:
if (myCourseTitleField.editContents == ""){
var myCourseTitle = "-no title has been defined-";
}else{
var myCourseTitle = myCourseTitleField.editContents;
// The contents should now be checked for '®' characters and 'OperateIT'
// And set to Superscript if found!
if (myCourseTitle.indexOf("®") != 0){
alert("Registered Trade Mark '®' found in Course Title at position:"+myCourseTitle.indexOf("®")+"\rThis will be set to 'Superscript' formatting", "WARNING '®' within Course Title",)
I have tried many scripts, including the attached sample 'FindChangeByList.jsx' script - but to no avail!
Can anyone help me - point me in the right direction to start looking?
Thanks in advance
Lee

Hi Lee,
In the example, you're trying to apply InDesign formatting to a JavaScript string (from an InDesign dialog box text field). That won't work, because the JavaScript string doesn't know anything about InDesign text objects.
I'm assuming, however, that what you want is to change the formatting of the text on your page. To do that, you can use the findText method on the text, story, or document. Here's an example (the relevant part is the "mySnippet" function--the rest is just setting up an example):
main();
function main(){
mySetup();
mySnippet();
function mySnippet(){
//Clear find text preferences.
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = "®";
app.changeTextPreferences.appliedCharacterStyle = app.documents.item(0).characterStyles.item("superscript");
app.documents.item(0).changeText();
//Reset find/change text preferences.
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
//Reset find/change GREP preferences.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//There's probably a way to do this in a single pass, but I'm short on time...
app.findGrepPreferences.findWhat = "\\l(?<=)IT";
app.changeGrepPreferences.appliedCharacterStyle = app.documents.item(0).characterStyles.item("superscript");
app.documents.item(0).changeGrep();
app.findGrepPreferences.findWhat = "\\l";
app.findGrepPreferences.appliedCharacterStyle = app.documents.item(0).characterStyles.item("superscript");
app.changeGrepPreferences.appliedCharacterStyle = app.documents.item(0).characterStyles.item("[None]");
app.changeGrepPreferences.position = Position.normal;
app.documents.item(0).changeGrep();
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
//mySetup simply takes care of setting up the example document.
function mySetup(){
var myDocument = app.documents.add();
    var myPage = app.activeWindow.activePage;
//Create a text frame on page 1.
var myTextFrame = myPage.textFrames.add();
//Set the bounds of the text frame.
myTextFrame.geometricBounds = myGetBounds(myDocument, myPage);
//Fill the text frame with placeholder text.
myTextFrame.contents = TextFrameContents.placeholderText;
myTextFrame.insertionPoints.item(0).contents = "OperateIT®\r";
myTextFrame.paragraphs.item(-1).insertionPoints.item(0).contents  = "OperateIT®\r";
var myHeadingStyle = myDocument.paragraphStyles.add({name:"heading"});
var mySuperscriptStyle = myDocument.characterStyles.add({name:"superscript", position:Position.superscript});
function myGetBounds(myDocument, myPage){
var myPageWidth = myDocument.documentPreferences.pageWidth;
var myPageHeight = myDocument.documentPreferences.pageHeight
if(myPage.side == PageSideOptions.leftHand){
  var myX2 = myPage.marginPreferences.left;
  var myX1 = myPage.marginPreferences.right;
else{
  var myX1 = myPage.marginPreferences.left;
  var myX2 = myPage.marginPreferences.right;
var myY1 = myPage.marginPreferences.top;
var myX2 = myPageWidth - myX2;
var myY2 = myPageHeight - myPage.marginPreferences.bottom;
return [myY1, myX1, myY2, myX2];
Thanks,
Ole

Similar Messages

  • SAP HANA Attribute View- Not able to add objects

    Hi All,
    I've created one attribute view in Modeler Perspective.
    Trying to add tables on data foundation using "Add Objects". But when table name is entered in pop-up window, it hangs (not-responding). And error log got created as below.
    I'm not able to add the tables.
    "SAP DBTech JDBC: Object is closed: com.sap.db.jdbc.ConnectionSapDBFinalize@8e003d[ID 225800]."
    com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Object is closed: com.sap.db.jdbc.ConnectionSapDBFinalize@8e003d[ID 225800].
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:334)
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateSQLException(SQLExceptionSapDB.java:136)
    at com.sap.db.jdbc.ConnectionSapDB.assertOpen(ConnectionSapDB.java:224)
    at com.sap.db.jdbc.ConnectionSapDB.getTransactionIsolation(ConnectionSapDB.java:1263)
    at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:1122)
    at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:888)
    at com.sap.db.jdbc.FetchInfo.executeFetch(FetchInfo.java:162)
    at com.sap.db.jdbc.FetchInfo.executeFetchNext(FetchInfo.java:157)
    at com.sap.db.jdbc.ResultSetSapDB.fetchNextChunk(ResultSetSapDB.java:2418)
    at com.sap.db.jdbc.ResultSetSapDB.next(ResultSetSapDB.java:419)
    at com.sap.db.jdbc.trace.ResultSet.next(ResultSet.java:269)
    at com.sap.ndb.studio.sql.model.tables.impl.CatalogImpl.getCatalogObjects(CatalogImpl.java:338)
    at com.sap.ndb.studio.sql.model.tables.impl.CatalogImpl.getCatalogObjects(CatalogImpl.java:414)
    at com.sap.ndb.studio.bi.search.provider.CatalogObjectSearchProvider.doSearchInternal(CatalogObjectSearchProvider.java:172)
    at com.sap.ndb.studio.bi.search.provider.CatalogObjectSearchProvider.doSearch(CatalogObjectSearchProvider.java:95)
    also,
    "Could not fetch catalog objects"
    com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Object is closed: com.sap.db.jdbc.ConnectionSapDBFinalize@64b085[ID 225787].
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:334)
    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateSQLException(SQLExceptionSapDB.java:136)
    at com.sap.db.jdbc.ConnectionSapDB.assertOpen(ConnectionSapDB.java:224)
    at com.sap.db.jdbc.ConnectionSapDB.prepareStatement(ConnectionSapDB.java:1964)
    at com.sap.db.jdbc.trace.Connection.prepareStatement(Connection.java:362)
    at com.sap.ndb.studio.jdbc.JDBCConnection.prepareStatement(JDBCConnection.java:479)
    at com.sap.ndb.studio.catalog.internal.JdbcExtended.getTablesCaseInSensitive(JdbcExtended.java:277)
    at com.sap.ndb.studio.catalog.CatalogUIPlugin.internalGetTableNames(CatalogUIPlugin.java:669)
    at com.sap.ndb.studio.catalog.CatalogUIPlugin.getTableNamesNoProgressService(CatalogUIPlugin.java:1156)
    at com.sap.ndb.studio.sql.dialogs.FindTableDialog.fillContentProvider(FindTableDialog.java:504)
    at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.filterContent(FilteredItemsSelectionDialog.java:2182)
    at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.internalRun(FilteredItemsSelectionDialog.java:2124)
    at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.doRun(FilteredItemsSelectionDialog.java:2096)
    at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.run(FilteredItemsSelectionDialog.java:2083)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
    Thanks,
    Sujit

    Hi Sujit,
    The log seems that connection is closed. Is it true? Did your system restarted?
    What happens if you close the studio, open it and try again?
    Are you using same revision Studio than the database?
    Regards, Fernando Da Rós

  • I can't synch my iPhone with iTunes because the device does not show up in a device window when I plug it in...it's missing in action and thus I'm not able to add any content from the iTunes to my iPhone, e.g. podcasts

    I can't synch my iPhone with iTunes because the device does not show up in a device window when I plug it in...it's missing in action and thus I'm not able to add any content from the iTunes to my iPhone, e.g. podcasts.   All the instructions on synching start with "find your device in the device window".  But what if you have no device window?

    Missing "message" from above: The iPad "DGMTR" is synced with another iTunes library on DGMTR's MacBook Pro. Do you want to erase this iPad and sync with this iTunes library? An iPad can be synched with only one iTunes library at a time. Erasing and syncing replaces the contents of this iTunes library.
    I thought the libraries were the same.

  • Not able to add new log file to the 11g database.

    Hi DBA's
    I am not able to add the log file i am getting error while adding the database.
    SQL> alter database add logfile group 3 ('/oracle/DEV/db/apps_st/data/log03a.dbf','/oracle/DEV/db/apps_st/data/log03a.dbf') size 50m reuse;
    alter database add logfile group 3 ('/oracle/DEV/db/apps_st/data/log03a.dbf','/oracle/DEV/db/apps_st/data/log03a.dbf') size 50m reuse
    ERROR at line 1:
    ORA-01505: error in adding log files
    ORA-01577: cannot add log file '/oracle/DEV/db/apps_st/data/log03a.dbf' - file
    already part of database
    SQL> select a.group#, member, a.status from v$log a, v$logfile b where a.group# = b.group# order by 1;
    GROUP# MEMBER STATUS
    1 /oracle/DEV/db/apps_st/data/log01a.dbf ACTIVE
    1 /oracle/DEV/db/apps_st/data/log01b.dbf ACTIVE
    2 /oracle/DEV/db/apps_st/data/log02a.dbf CURRENT
    2 /oracle/DEV/db/apps_st/data/log02b.dbf CURRENT
    Kindly help me to add the new log file to my database.
    Thanks,
    SG

    Hi Sawwan,
    V$LOGMEMBER was written in the document,
    I query the log members as bellow
    1)select a.group#, member, a.status from v$log a, v$logfile b where a.group# = b.group# order by 1;
    GROUP# MEMBER STATUS
    1 /oracle/DEV/db/apps_st/data/log01a.dbf INACTIVE
    1 /oracle/DEV/db/apps_st/data/log01b.dbf INACTIVE
    2 /oracle/DEV/db/apps_st/data/log02a.dbf CURRENT
    2 /oracle/DEV/db/apps_st/data/log02b.dbf CURRENT
    2)SQL> select group#,member,status from v$logfile;
    GROUP# MEMBER STATUS
    2 /oracle/DEV/db/apps_st/data/log02a.dbf
    2 /oracle/DEV/db/apps_st/data/log02b.dbf
    1 /oracle/DEV/db/apps_st/data/log01a.dbf
    1 /oracle/DEV/db/apps_st/data/log01b.dbf
    But i am littile bit confused that there is no group or datafile called " Group 3 and log03a.dbf" as per the above query, how can i drop tease group and datafile.
    and i crossverified in the data top the files are exist or not but those are not existing. but still i am getting the same error that i can't create that already exist.
    can issue the bellow queris to drop those group which i dont think so it will exist?
    SQL>alter database drop logfile group 3;
    Thanks in advance.
    Regards,
    SG

  • HI. I have itunes 10.6.1.7. When I goto movies i am not able to add and when I click on add file to library and select the file and add its not getting added. When i goto Library it says  that movies I add are in library.Which I cant add

    HI. I have itunes 10.6.1.7. When I goto movies i am not able to add and when I click on add file to library and select the file and add its not getting added. When i goto Library it says "feature films and home movies you add to itunes appear in movies in your iTunes library. To play a movie, just double click it". And below are two options for Downloading movies from store and rent movies. Please help.

    I get the exactly the same problem with win 7, i rang apple support who suggested i try another machine/or create another account on my machine???? why should i, stupid ipad 3rd gen is now sitting here un syncable, apple support ....tut tut very poor support, its a shame im out of the 7 day period otherwise this ipad would be going straight back, older versions of itunes worked fine, some one must know a fix for this??

  • HT1351 I have a apple ipod touch but recently I restored all the settings, as well as the applications. But now I am not able to add songs to it. There is blank screen that shows the symbol like to connect to itunes first. I'm not able to use that... Plea

    I have a apple ipod touch but recently I restored all the settings, as well as the applications. But now I am not able to add songs to it. There is blank screen that shows the symbol like to connect to itunes first. I'm not able to use that... Please help

    The iPod's firmware is corrupt. You'll need to restore it again in iTunes. If necessary, place the iPod in recovery mode for iTunes to recognize the device. Use the instructions in this Apple support document to walk you through the process of placing the iPod Touch into recovery mode.
    iOS: Unable to update or restore
    B-rock

  • HT202213 I recently bought a new computer and installed itunes, i transferred my music of my old computer but i am now not able to add songs to my ipod touch off my new computer?

    I recently bought a new computer and installed itunes, i transferred my music of my old computer but i am now not able to add songs to my ipod touch off my new computer?

    Drag the folder into the library in the open iTunes program window.
    (113784)

  • I have a Iphone 4, upgraded to ios 5 with itunes 10.5  Since doing upgarde to both Itunes and Iphone I am not able to add individual songs from my itunes library to my Iphone.  I get a grey listing of the song and the sync symbo but it is not moving.

    I have a Iphone 4, upgraded to ios 5 with itunes 10.5  Since doing upgarde to both Itunes and Iphone I am not able to add individual songs from my itunes library to my Iphone.  I get a grey listing of the song and the sync symbo but it is not moving. Nothing appears on my phone screen.  So not able to add music to my phone and its driving me nuts.....

    iOS 7 requires iTunes 11.1.

  • Not able to add free item in PO

    dear all
    i am not able to add free items in already created import PO. when i add item and click on free item check box, system says "No delivery costs allowed without invoice receipt" and if i click on invoice receipt that item is no longer free item as the free item check box gets untick.
    pl help me to solve this.
    thanks & regards'
    manoj gupta

    Hi
    If there is no delivery cost condition like Freight at item level exists then
    Please check any delivery cost conditions given as Header condition.If it is given as Header condition and this cost will be distributed among the line items.When you adding the line item, the cost also distributed.For free items you can't assign any costs.
    Regards
    Ramakrishna

  • I am not able to add videos to itunes. So I am not able to sync them with my IPhone4s. I ve tried: dragging to itunes, minimize file name of mp4, adding by file/folder still not adding. WHY? Please help.

    I am not able to add videos to itunes. So I am not able to sync them with my IPhone4s.
    I ve tried:
    dragging to itunes,
    minimize file name of mp4,
    adding by file/folder, but still not adding.
    WHY? Please help.

    This is very serious. Your computer got infected with ransom malware, Cryptowall.
    Go here for further info.
    CryptoWall 2.0 Anything Good about Buying you Keys? - General Security
    CryptoWall and DECRYPT_INSTRUCTION Ransomware Information Guide and FAQ

  • Not able to add outgoing payment for vendor

    Hi to all Experts,
    I am facing problem i.e I am not able to add outgoing payment for Vendor. I have tried to multipul time using different users also. I have booked purchase first and then tried to make payment to the vendor.Docdate is 14th Jul 08, and docdue date is 18th Aug. 08.
    I have made two entries for outgoing payment using G/L A/c. option before trying to do this entry successfully.
    Can any body plz help me to resolve this issue.
    Warm Regards,
    Chintesh Soni

    Hello Chintesh,
    The scenario seems to be similar to the one described in Note 1027043.
    Here is the text from the Note:
    "You are trying to add the an Outgoing Payment for an A/P Invoice or A/P Credit Memo using Checks as Payment Means. However, after pressing the 'Add' button, the payment is not added and the system does not send an error message."
    This issue occurs when the Vendor Ref. No. field in the A/P invoice or the A/P credit memo has more than 39 characters.
    It is an application error that is fixed in PL26, 2005B (Note 1073858). Kindly upgrade to the latest patch. If not possible at the moment, you can use the workaround provided in the Note.
    I hope this helps.
    Regards,
    Lorna Real

  • Not able to add Select Supported Document Types

    Hi
    I am new to Oracle B2B.
    Going through the steps given in the tutorial http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10229/b2b_tps.htm#BABGAJDE
    Completed till 5.3 - Task 2 (Add a User in the Oracle B2B Interface)
    And the Next thing,
    I am not able to Add Select Supported Document Types.When I click on the "Add supported document type for the selected user", i can see "CUSTOM", "EDI_EDIFACT" etc... but in that screen my "Add" Button was disabled.
    Please let me know how to proceed with this.
    Thanks,
    Deepthi.
    Edited by: 796969 on 27/09/2010 14:11

    Hi Deepthi,
    You can download the samples from below location. Samples also has document for step by step configuraion:
    B2B Samples are part of SOA samples:
    http://www.oracle.com/technology/sample_code/products/soa/index.html
    Developer Notes / Step by Step configuration guide:
    http://www.oracle.com/technology/products/soa/b2b/index.html
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU001_EDI.pdf
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU002_HL7.pdf
    http://www.oracle.com/technology/products/soa/b2b/collateral/B2B_TU003_ebxml.pdf
    http://blogs.oracle.com/oracleb2bgurus/2010/04/oracle_b2b_started_kit.html
    Please let us know which usecase you are trying for more details.
    Rgds,
    Nitesh Jain
    [email protected]

  • Not able to add a friend

    Please help me in adding a friend on Skype. I have tried a lot but not able to add. I have tried to add with phone no. N Skype id both but then also failed to add. Kindly solve the problem ASAP..

    https://support.skype.com/en/faq/FA12289 Hi, I am sorry to hear you are having trouble adding your friends to your account. This FAQ on our support site should be able to help you. I hope you and your friends are all chatting soon!

  • Not able to add my debit card in iTunes i need to purchase a new app immediately

    not able to add my debit card in iTunes i need to purchase a new app immediately

    Have you followed the steps inChange or remove your payment information from your iTunes Store account (Apple ID) to change your payment method?

  • Not able to add video podcast to ipod

    i am having a couple of issues with my 5th gen ipod......first one is my computer is not recognizing my ipod and two i'm now not able to add videos from another computer that does recognize my ipod. can anyone give me some help.

    No, the version has effect on syncing music
    Have you succesfuly synced from this iTunes libary/computer before?
    Do the songs play in iTunes?
    Do you have the right boxes checked to sync?
    iTunes: Syncing media content to iOS devices and iPod

Maybe you are looking for

  • Problem with Matrix/Checkbox/Datasource

    Hi, i have a problem with a Matrix. There are 3 Columns on this Matrix, one of those is a Checkbox. I fill the Columns with data, the Checkboxes where just added (no Checkbox is selected), the user has to select the value (Checkbox)he want's to by ha

  • How to handle the popup windows in e-tester.

    Hi, We are currently using the e-Tester by using record/playback on Facebook. During recording as part of functionality we have encountered some confirmation popups (Which are not ordinary windows popups). Actions on those popups (confirm/cancel) are

  • Video camera with viewfinder

    Hi, we are looking for a video camera that still has a viewfinder besides the flip open lcd screen.  We sometimes need to record video at night where the light coming from the screen would be too bright and compromising.  We are looking for something

  • Is there a way to make my iweb page a merchant account?

    i have just published a page to my iweb account with pictures of my jewelry that i am trying to sell. i would like for people to have the option of purchasing from me without too much difficulty. can i link something like paypal to my published page?

  • Action: Remove original file after it has been closed

    Hello. Is there any way to make Photoshop delete (or move to Recycle Bin, doesn't matter) a file in an Action? Basically at the moment I manually open a picture, then I activate my Action which does a bunch of automated things, saves a .png copy, clo