Replace textmarker with number (1, 2, 3 ...)

I wonder if there's a way to work with variables in Indesign.
I've got a indesign file that contains multiple occurences of "##" (as placeholder-text).
I want to replace the first occurence with the number 1, the second with the number 2 and so on...
Is there a way this can be done with scripting in Indesign.
(The way i do this now is by exporting the file to xtag-text and then use a php-script to replace the markers in the tagged file)

Hi,
Try this as a .jsx script to run from ESTK or ID Script Panel:
#target indesign
var
    placeholder = "##",
    mFound, len, start = 1;
    if (app.selection[0] &&  (app.selection[0] instanceof "Text Frame" || app.selection[0].hasOwnProperty ("baseline") ) )
        var mStory = app.selection[0].parentStory;
    else { alert("Select target textFrame or some part of target text\rand try again!"); exit();}
app.findTextPreferences = null;
app.findTextPreferences.findWhat = placeholder;
mFound = mStory.findText();
len = mFound.length;
while (len-->0)
    mFound[len].contents = (len + start).toString();
- placeholder is a string to find; start is a value of first number to replace.
- some part of text or textFrame should be selected.
Jarek

Similar Messages

  • Replace text with number

    Hi
    i have 2 columns from flat file
    0amount       number
    10000          
    "Intangibles"         2000
    20000              
    'sales'         4000
    my output is required like
    incase if i am getting text ( this text is not constant its coming like any thing shownw above example)  i need replace number key figure values in 0amount fileds.
    how can i reach with this in field routine
    data v_text type char
    if source_fields_0amount not equall number
    result 0 number ( kf)
    like what is code i need to use

    Hi,
    One thing's to be clarified :
    If you need sometimes number & sometimes text in a particular target field, then it has to be a char field and you cant do any mathematical operation on that later.
    --Akashdeep

  • How to replace name with number ID

    Example:
    Table1
    T1ID Name1
    1 John Smith
    2 Kathy Smith
    Table2
    T2ID Name2
    100 John Smith
    101 Kathy Smith
    102 John Smith
    103 Kathy Smith
    I want to replace all names in column called Name2 in Table 2, with matching T1ID from Table 1. There are many name repetitions in Table 2.

    If Name2 is VARCHAR and T1id is number then it would be better to add a new column with a consistent data type;
    Sample data;
    create table table1 as (
    select 1 t1id, 'John Smith' name1 from dual union all
    select 2, 'Kathy Smith'from dual);
    Table created
    alter table table1 add constraint table1_pk primary key (t1id);
    Table altered
    create table table2 as (
    select 100 t2id, 'John Smith' name2 from dual union all
    select 101, 'Kathy Smith' from dual union all
    select 102, 'John Smith' from dual union all
    select 103, 'Kathy Smith' from dual);
    Table createdAdd the new column;
    alter table table2
       add name_id references table1(t1id);
    Table alteredUpdate the new column;
    merge into table2 t2
    using (select t1id, name1
           from table1) t1
    on (t2.name2 = t1.name1)
    when matched then
      update
      set t2.name_id = t1.t1id;
    DoneDrop the retired column;
    alter table table2 drop column name2;
    Table altered
    select * from table2;
          T2ID    NAME_ID
           100          1
           101          2
           102          1
           103          2

  • I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this and replace it with my personal iPhone?

    I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this from my ipad and replace it with my personal iPhone?

    Hi Ktchast,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    An Apple ID is a user name you use for everything you do with Apple. Creating an account for an Apple service, such as the iTunes Store or the App Store, creates an Apple ID. Apple ID allows you to access other Apple services. You don't have to create a new account for each service—just use your Apple ID.
    How do I change my Apple ID Name or personal information?
    You can change your Apple ID Name at My Apple ID. Click on Manage your Apple ID and sign in with your Apple ID name and password. Click Edit and enter the new information, then click Save Changes. Changes take effect immediately. You can also use My Apple ID to change your personal information, such as your mailing address or email address. See Changing the name you use for your Apple ID if you'd like more information.
    Cheers,
    - Judy

  • HT4061 How do you change your phone number than is in your iPad and replace it with right one to receive and send messages?

    How do you change your phone number in your iPad messages and replace it with another number. In order to send and receive messages to the correct phone number?

    It's best to use an email address on the iPad.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • When i have a number as genre, itunes replaces it with a word!!?

    with some songs, when I write a number (e.g 12), or a word which contains a number (e.g asd14) in the genre column , itunes'll automatically replace it with the corrispondent kind of music (eg. rock, pop, funk, ...)
    i just would like to have my number as genre, and nothing else.... how can i do that, and why is this happening?
    thank you very much for any help

    Hello Jugheadjr,
    We've an article that can get iTunes to pick up your iPod again.
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/TS1369
    Cheers,
    Allen

  • Replacing character and number e.g #1154;#" with a comma using powershell

    Hi there,
           How can i replace
    I have a string like below  and would like to replace ";#1154;#" with a comma.
    tried using (;#)\d{4}(;#)" but it doesnt work
    Amber Wood;#1154;#John Roberts;#1121;#Peter Ma;#1597;#
    Thanks in Advance
    Output should be : 
    Amber Wood,John Roberts,Peter Ma

    The regex is almost right, but you don't need the normal brackets. If you remove them as per :
    $a = "Amber Wood;#1154;#John Roberts;#1121;#Peter Ma;#1597;#"
    $b = $a -replace ";#\d{4};#",","
    $b
    you'll see that works.

  • Satellite C850 - boot from DVD issue - want to replace Win8 with Win7U

    Got a new C850-1JZ yesterday and am trying to replace pre-installed Win 8 with Windows 7. I did create the recovery media (3 DVDs).
    The laptop is driving me "insane" as it seems to block any attempt to boot anything else other than Win8 on the preinstalled hdd.
    1.) Inserted Win 7 Ultimate DVD and tried to boot, would not boot from disk.
    2.) Loaded advanced boot menu and tried to boot from ODD, would not boot from disk it. (Options are LAN, USB, HDD, and ODD (assuming this is optical disk drive)
    3.) Changed regular bios settings boot priority to boot from ODD first, then HDD, would not boot from disk.
    4.) Learned there is a "security boot protection" mechanism enabled by default in the bios. Turned it off. Machine starts loading from ODD and says "Windows is loading files" then hangs. This is a MS original Win7 Ultimate disk from the Microsoft store, no scratches. Makes no sense. We actually have 2 of them, so I tried the other, same result.
    5.) Thought screw that, let's just put the hard drive from the other computer (T61) in here then and do clean new setup another time. Replaced hdd with other sata hdd that has Win 7 ultimate installed and system configured. When booting from hdd, it says "No OS" found and reboots. When booting from ODD, it starts with windows is loading files again and then freezes.
    What kind of other extra protection/virus blocker/stupid setting am I missing here? This is puzzling me. Thanks.

    *Thanks as***, that solves the problem.*
    After 10 days Toshiba Support in Germany came back with the same answer.
    Basically it seems the UEFI Firmware has some reference to Win 8 or the original OS and key and boat loader that is checks, and you cannot load anything else until you disable it by:
    1) In the BIOS, disable "secure boot" mode
    2) In the BIOS advanced settings, switch from UEFI to CMS mode.
    Then you should be able to install anything as the new OS.
    Also, if you want to write down your product key / serial number , since it is not printed anywhere (e.g. no sticker on the bottom of the laptop) [Belarc Advisor - Free Personal PC Audit|http://belarc.com/free_download.html] is a good tool to retrieve this from the registry and write it down.
    As far as I know it's "glued" to this particular hardware, so not portable, but it might be a good idea to write it down in case you lose the system recovery disk but would want to re-install it with the original serial number.

  • My iMac Seagate 1T hard drive crashed. I replaced it with a Western Digital 1T hard drive. Where can I get the Lion OS?

    My iMac Seagate 1T hard drive crashed. I replaced it with a Western Digital 1T hard drive. Where can I get the Lion OS?
    The iMac comes up with a ? in a folder, even after starting with Option/Command/R keys pressed.
    Please help.

    Call Apple to purchase replacement discs or order a copy of Snow Leopard from Apple's Online Store. Follow these instructions:
    Drive Preparation and Install Snow Leopard
    1. Boot from your Snow Leopard Installer Disc. After the installer loads select your language and click on the Continue button.  When the menu bar appears select Disk Utility from the Utilities menu.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  SMART info will not be reported  on external drives. Otherwise, click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    7. When completed quit DU and return to the installer. Install Snow Leopard. Once you boot from Snow Leopard you should open Software Update and install all the available updates required. After you complete this and restart the computer open the App Store application in the Dock or Applications folder.
    8. Sign into the App Store with your Apple ID and password. Purchase and download Lion.
    9. After Lion's installer downloads, install Lion.

  • Apple Keyboard with number pad the V key will not work

    Apple Keyboard with number pad the V key will not work.  Everyother key works but not the V.  I have a MacBook Pro.  Any suggestions?

    Call AppleCare and get it replace if it's under warranty; otherwise, get a new one. They're only $49 USD.

  • Replace Listbox with Textbox

    Hi ,
    I am facing a problem.Kindly reply me soon if anyone has solution to this problem.I have a form in which previously there was listbox.As the listbox has the "label" and "value" property,such property is not available in textbox.Earlier in my prj the form had listbox So the some value was displayed to user ,but in the backend the value of label was saved.In the Cr which i have got I have to replace the listbox with textbox.Also I have to autopopulate the value in the listbox autopopluated based on primary key value.So if we want to replace it with textbox ,how can we get the solution.I know that the list item can be replaced by 2 textbox ,one for diplaying the value of label and another for the value which would be saved in database.I am able to populate the value of label and the data saved in database.However the problem comes when we query the data to see old record. The data is populated but the value of label is not populated as this record is not saved in database.So without saving the information of label in database.How can we achieve the result as we get in listbox.kinly reply soon.
    thanks

    Not very clear about your problem.
    From where were you populating the list item previously?I think
    its a static list item populated at the design time.
    I am trying to reproduce your scenario.If any mistakes please inform..
    I created a table TT
    sql>desc tt;
    Name Null? Type 
    ID     NUMBER 
    C1     VARCHAR2(10) 
    STATUS     VARCHAR2(1) 
    Here status column can take values 'C','O','N' or Null
    implying 'Open','Closed','Not Available','Unknown' respectively.
    Now in the form, Status field is not displayed.Instead,
    created a 'dummy' field as char(15), which is displayed
    Triggers:
    Post-Query(Block-Level TT):
    :dummy := case :status when 'C' then 'Closed'
                             when 'O' then 'Open'
                  when 'N' then 'Not Available'
                                 else 'Unknown' end;
    Pre-Insert     
    :status := case :dummy when 'Closed' then 'C'
               when 'Open' then 'O'
               when 'Not Available' then 'N'
               else null end;
    You can also Validate th item 'dummy' using when-validate-trigger
    if :dummy is not null and :dummy not in ('Closed','Open','Not Available')  then
         message('Invalid Value');
         raise form_trigger_failure;
    end if;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I bought a iphone 3gs 4 months ago had a problem with display service centre replaced me with the phone when i checked the settings of the phone in cellular usage under call time the lifetime usage was 3 days and 18 hours.what sholud be done ?

    i bought a iphone 3gs 4 months ago had a problem with display service centre replaced me with the phone when i checked the settings of the phone in cellular usage under call time the lifetime usage was 3 days and 18 hours.what sholud be done ?

    How is your iPhone's display different?
    You can check the model number by  going to Settings/General/About. These are the model numbers for the various 3 GS models;
    MB715LL/A (16 GB Black), MB716LL/A (16 GB White), MB717LL/A (32 GB Black), MB718LL/A (32 GB White), MC555LL/A (8GB)

  • How to make customize Replace function with Positions not pattern ?

    Hi
    Due to Repalce with patterns in  flex, i am facing issue.
    I  want to make cutomize replace function with  parameters
    1 Parameter - String to replace
    2 Parameter - Start Posion.
    3 Parameter - Last position
      which return string value.
    For Example
      replaceInWholeString(str:String, sPos:Number, lPos:Number ):String
    values like
    1st paramter - "asked"
    2nd Paramter - 11
    3rd Paramter -  15
    Original String :: I want to reply
    Output string : I want to asked
    Please Reply ,if someone having solution
    Thanks
    Sunil Rana

    You can use any number of the String methods to acomplish this.
    I would proabably go with something like: slice(...) + input + substr(...);

  • Replace spaces with a + sign

    Hi,
    In on of my columns I have a text... I want to replace spaces with a plus (+) sign... something linke this
    select
    text_field,
    Function_replace(text_field, " ", "+") new_field
    from
    table_A

    It's almost that:
    SQL> with table_a as (
      2  select 'abc dd   efg ' text_field from dual)
      3  -- end of sample data
      4  select text_field, replace(text_field, ' ', '+') new_field
      5    from table_a;
    TEXT_FIELD    NEW_FIELD
    abc dd   efg  abc+dd+++efg+
    SQL> edit:
    If you want to replace any number of consecutive spaces for a single + sign, then:
    SQL> with table_a as (
      2  select 'abc dd   efg    h' text_field from dual)
      3  -- end of sample data
      4  select text_field,
      5         regexp_replace(text_field, ' +', '+') new_field
      6    from table_a;
    TEXT_FIELD        NEW_FIELD
    abc dd   efg    h abc+dd+efg+h
    SQL> Edited by: fsitja on Mar 31, 2010 12:27 AM

  • Replace 0 with -

    hello all,
    Can anyone suggest me how can I replace 0 with - in all my columns.
    Thanks,
    Robinn

    Hi Robin,
    This is a bit vague but you could use a formula like:
    Replace ({table.FIELD}, "0", "-");
    If your field is a number then  you will have to change it to a string first like:
    Replace (ToText ({table.FIELD}, 0, "", ""), "0", "-");
    This formula converts the numeric field to a string first, removing the decimals, decimal pointer and thousands separator. 
    Good luck,
    Brian

Maybe you are looking for

  • Date and timestamp issue please help

    In the following creation_date is DATE datatype. creation_time is VARCHAR2 having only MI:SS (16:02). :DATE_LAST_CHECKED is VARCHAR2 having string without time. If that be the case how can I compare these 2 statements with the time. I need to compare

  • Need help ASAP : Exception with EJB 3.0 while session.xml

    Hi, Kindly help on below exception, which i am getting the exception while changing the mine EJB 2.1 to 3.0. Exception raised while loading the session.xml, which is reffering to map file which is used by Toplink. **Mine EJB:** public class CaseSessi

  • BAPI_SALESDOCU_CREATEFROMDATA1  with multiple line items

    Hi Experts, I  trying to create a sales document using BAPI_SALESDOCU_CREATEFROMDATA1, below my code : CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'        EXPORTING             sales_header_in     = header             sales_header_inx    = headerx

  • Crazy installer issues

    At first I thought this was a problem with a particular application's installer, but now I see it is endemic. I am using iMac 27" (Mid-2010) 2.93GHz, 16 GB RAM, OS X 10.9.2 Whenever I try to run an installer-dependent application I get as far as ente

  • History in XI

    Hi all,                  I want to know how we can find the history of an object in IR and ID..is there is any way for this ..i am checking with history option in IR it is showing versions oif the objects..if i click on the old version is this versio