Find and Replace text and change font help needed.

I am completely new to Scripting and I'm sure this is quite simple but I do not know where to start.
I have a FM template that is populated with "raw" text from a database.
Within the text are several characters (+, @, *, $, # and %).
I need to replace these characters with symbols from a different font e.g.:
Each instance of:
"+" to be replaced with Wingdings 2 font - Lowercase t
"@" to be replaced with Wingdings 2 font - Lowercase u
"*"  to be replaced with Wingdings font - Uppercase E   etc.
I would like to automate the process and believe a script would enable me to do this.
I have tried looking on the forum, but can not find anything suitable to help me (or I'm looking in the wrong place).
Any help would be greatly appreciated.
Cheers
Kev

not really
important is the Illustrator Text Object-model, which is not very easy to understand.
And the Core JS String and regExp Objekts.
Have a look at this:
http://www.ogebab.de/home/skripte/text/replace
The dialog is poor (because of compatibility) and it works simply on TextFrames.contents, i don't know if this is good i all cases.
But i use it not very often so i don't want to rewrite it.
Maybe it is a starting-point for you.
But maybe it is more then you need.
try this:
//select a text
var text = app.activeDocument.selection[0];
var string = text.contents;
string = string.replace(/ /g,"  ");
text.contents= string;
/ /g is a regular expression
.replace() is a method of the String Object
both explained at
https://developer.mozilla.org/en/JavaScript/Reference

Similar Messages

  • Folder action to find and replace text and change line feeds

    I want to use a folder action to find and replace text and change Mac carriage returns to DOS line feeds inside text files.
    The text to be replaced is: "/Users/wim/Music/iTunes/iTunes Music/Music" (without the quotes)
    This text has to be removed (i.e. replaced by an empty string)
    The text occurs many times within each file.
    The files are playlists exported from iTunes in the M3U format (which are text files). They contain Mac carriage returns. These need to be changed to DOS line feeds.
    I have found the following two perl commands to achieve this:
    To find and replace text: perl -pi -w -e 's/THIS/THAT/g;' *.txt
    To change carriage returns to line feeds: perl -i -pe 's/\015/\015\012/g' mac-file
    I know that it's possible to make a folder action with Automator that executes a shell script.
    What I want to do is drop the exported playlists in M3U format in a folder so that the folder action will remove the right text and change the carriage returns.
    My questions are:
    Is it possible to make a folder action that executes command line commands instead of shell scripts?
    What is the correct syntax for the two commands when used in a folder action shell script? Especially, how do I escape the slashes (/) in the string to be removed?
    Thanks for your help

    Ok, I've include an applescript to run a shell command. The applesript command quoted form makes a string that will end up as a single string on the bash command line.  Depending on what you want to do, you may need multiple string on the bash command lines.  I've included some information on folder actions.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set desktopPath to (path to desktop) as string
        log "desktopPath = " & desktopPath
        set unixDesktopPath to POSIX path of desktopPath
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    How to set up a folder action.
    1) right click on folder. click on Enable folder actions
    2) Place script in
    /Library/Scripts/Folder Actions Scripts
    3) right click on folder. click on attach folder action
    pick your script.
    Create a new folder on the desktop & try.
    You can put multiple folder actions on a folder. There are other ways of doing this.
    Here is my test script:
    on adding folder items to this_folder after receiving dropped_items
        repeat with dropped_item_ref in dropped_items
           display dialog "dropped files is " & dropped_item_ref & " on folder " & this_folder
        end repeat
    end adding folder items to
    How to  make the text into an AppleScript program.
    Start the AppleScript Editor
    /Applications/AppleScript/Script Editor.app
    In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor
    Copy the script text to the Applescript editor.
    Note: The ¬ is typed as option+return.  ption+return is the Applescript line continuation characters.
    You may need to retype these characters.
    Save the text to a file as an script and do not check any of the boxes below.

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • Find and Replace text string in HTML

    Opps... I hope this forum is not just for Outlook. My Html files reside on my hard-drive. I am looking for VBA code to open specified file names ####File.html and then find and replace text strings within the html for example "####Name" replaced
    with "YYYYY"
    I drive the "####File.html" names and the find and replace text strings from an Excel sheet. I am an artist and this Sub would give me time to paint instead of find and replace text. Thank you!
    [email protected]

    Hello Phil,
    The current forum is for developers and Outlook related programming questions. That's why I'd suggest hiring anybody for developing the code for you. You may find freelancers, for example. Try googling for any freelance-related web sites and asking such
    questions there.
    If you decide to develop an Outlook macro on your own, the
    Getting Started with VBA in Outlook 2010 article is a good place to start from.

  • How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or

    The situation:
    I want to use basetext font, but some of the glyphs are missing in it, and are highlighted with pink boxes. common font [stix, etc.] have much more glyphs than basetext font. I can apply common font [stix, etc.]manually for each of the missing glyphs or insert two character and use kerning set it up, but it is tedious.
    Question:
    How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or insert two character and use kerning set it up?
    Any one know how to do this?
    Thanks in Advance,
    ~Jack

    Try Peter kehrl's script
    http://www.kahrel.plus.com/indesign/missing_glyphs.jsx

  • Find and replace m2 and m3 to subscripts

    Now I change m2 and m3 to what on the clipboard.  But that doesn't work when I have m2 and m3 in different colors and different fonts tru the lay-outs. 
    How can I find and replace m2 and m3 to m subscript 2 and m subscript 3?
    Only m2  not 2 alone.
    Many thanks

    Your "Only m2 not 2 alone" seems to contradict what you wrote earlier, but I guess that what you want is to style 2 and 3 only when they are preceded by m. If that's the case, do this in the grep tab of the Find/Change dialog:
    Find what: (?<=m)[23]
    Change to: <leave empty>
    Change format: select subscript.
    (?<=. . .) is a so-called lookbehind, [. . .] a character class. (?<=m) means 'preceded by' and [23] stands for '2 or 3'.
    Peter

  • A previous and unrelated text always appears when I need to send a new text. This prevents forwarding texts also, which I need to do all the time for my business. How can I fix? Please help!

    A previous and unrelated text always appears when I need to send a new text. This prevens forwarding texts also, which I need to do all the time for my businss. How can I fix? Please help?

    Hi,
    This sounds like it is about Window positions.
    iChat has Default places for Incoming Invites.
    Video is always top Center of your Screen
    Audio and Text chats are Upper right with the Audio slightly lower than Text Chats.
    Secondary invites are sort of Stacked like when you open multiple files from the same App.
    Your outgoing Windows are "Remembered" as to where the last one was when you used it.
    This can be an issue if you use your Mac with a second display and turn Off Mirroring.
    You windows can get "left" on the other screen.
    Go to System Preferences > Displays and turn On Mirroring and the windows should come back to one Screen/display.
    If this does not help go to your Home Folder/Library/Preferences and delete (Drag to Trash) com.apple.ichat.plist and restart iChat.
    Unfortunately you will need to reset any iChat Preferences you have changed from defaults.
    10:42 PM      Tuesday; April 26, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.7)
    , Mac OS X (10.6.7),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • In Pages, how to search and replace text involving invisible characters?

    In Pages documents, how to search and replace text involving invisible characters, colors and font sizes—a task which is so easy in Mircosoft Word?

    I read that an older version of Pages allowed users to enter special characters in the search/replace fields, but this did not work for me.
    Here: http://www.macworld.com/article/1156533/pagesspecialcharacters.html
    I still am looking for a way to do this.

  • I am having bugs with the ios 5, after it got the update it is unable to make outgoing calls. in-place the incoming and outgoing texts are working please help me asap...!

    i am having bugs with the ios 5, after it got the update it is unable to make outgoing calls. in-place the incoming and outgoing texts are working please help me asap...!

    Sometimes and this is network dependant if they suspect the phone to be lost or stolen as in this case with change of Sim card and provider then the origonal network can and some will block the phone untill you have rang them and proven it's not the case or if you have bough this 2nd hand then the origonal seller may have stopped paying the contract bill and thus the phone is blocked

  • TS3406 I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    YOu will need to contact your cell phone provider to resolve those issue, those are carrier features.

  • Copy and paste text and graphics between Flash and Illustrator

    When copying text in Illustrator and pasting them to Flash, some text would become drawing objects and some remain text. A drawing object is not editable. If I import the AI file, then text remains text but the placement of graphics can be a little bit off sometimes.
    It's just not possible to copy-and-paste text and graphics from Flash to Illustrator.
    Is it just me? If not, when will Adobe have better integration between the 2?
    Thanks,

    Even though you can change your InDesign preferences for Clipboard Handling to allow formatted information to be pasted into InDesign from other programs, unfortunately Illustrator still won't allow you paste in text with formatting. This is due to how Illustrator and InDesign handle text differently. Even if you copy the text from Illustrator and paste it into a program like Word, which has a lot of different ways to handle formatted text, Illustrator just treats text differently than other Adobe applications.

  • Purchased Acrobat XI Pro - was able to edit text and add text and now does not allow me to do anything -

    was able to edit text and add text and now does not allow me to do anything - Except purchase the software again.Can't find an answer to this anywhere.

    Use Adobe Acrobat, not Adobe Reader.

  • When I use Preview,Photo Mechanic and Pages, all JPEG or RAW images appear corrupted. I thought my hard drive was failing and replaced it and migrated everything over but the problem still exists. Any idea what is going on?

    When I use Preview,Photo Mechanic and Pages, all JPEG or RAW images appear corrupted.
    I thought my hard drive was failing and replaced it and migrated everything over but the problem still exists.
    It felt as if maybe a virus was at work but I ran Sophos and found nothing.
    I store images on my Drobo Raid system but when I work from my Macbook Pro I have no issues, just on the tower.
    Any idea what is going on?

    First of all, why did you say yes to Nero Back up before researching what it does with files already on the HDD? When I install Nero, the Back Up is the first thing I disable, it is a nagging pain, there are much better backup programs available. There are several file recovery programs out there to recover deleted files, that is, if that is what happened. Also, if you haven't overwritten the files, so you should be able to find them.

  • HT5631 how do I verify my apple id? I can't sign in to it in mail and I can't make a new one because it just will not process I'm trying to set up iCloud between iPad and iPhone and having ALOT of difficulty pleAse help need it done by later on today!!!!!

    how do I verify my apple id? I can't sign in to it in mail and I can't make a new one because it just will not process I'm trying to set up iCloud between iPad and iPhone and having ALOT of difficulty pleAse help need it done by later on today!!!!!

    In order to use your Apple ID to create an iCloud account, the primary email address associated with the ID must first be verified.  To do this, Apple will send a verification email to your account and you must respond to the email by clicking the Verify Now link.  Make sure you are check the spam/junk folder as well as the inbox.  If it isn't there, go to https://appleid.apple.com, click Manage your Apple ID, sign in, click on Name, ID and Email addresses on the left, then to the right click Resend under your Primary Email Address to resend the verification email.

  • HT4993 Why iPhone 4S keeps sending double and triple texts, and random words I never typed. Any ideas?

    Why iPhone 4S keeps sending double and triple texts, and random words I never typed. Any ideas?

    Jailbroken?
    is this happening to SMS and iMessages?

Maybe you are looking for

  • Why are my mp3's and m4a files no longer recognized?

    All of a sudden, 95% of the 10,000 music tracks in my iTunes Library has become unplayable. It concerns mp3 and m4a files with music that I purchased and ripped over the years. Wifi syncing to my iPhone 4s made it worse: now the Music app on my iPhon

  • Consignment process-WBS ELEMENT

    in consignment process,while doing consignment fill up,system has thrown the error"missing data WBS ELEMENT" what this wbs element,how can i get it?

  • File adapter polling and getting the file name

    I have a requirement where I have to poll a file and dump the data into the DB. But while polling a file for a particular file name, I also need to get the name of the file to do some operations on the file. The file name should be passed from the ad

  • How to attach document from webdynpro TO workflow

    Dear friend, For one requirement i want to attach documents(.doc or .pdf) from webdynpro form. I want to display it with user decision step along with description. I am confused that which container element would contain it? and how can i display it

  • 975X and a PCI Controller Card

    I am trying to install another SATA controller card to I can flash my firmware on my 360. But for what ever reason this board (975X) isn't allowing me to ever boot to the PCI card. Any ideas on what settings I need to pick to do it? Thanks!