Convert Text

Since I have been posting to these forms, I have been annoyed by the conversions that are done to my posts. A word surrounded by asterisks gets bolded. When I decide to make a link to a post, I can never remember the exact format. When I posted AppleScript code, I found that it is squish to the left. The AppleScript I have posted here gets around these problems.
usage: What you need to do is copy the text that you wish to post to the clipboard then run this AppleScript then paste the text into your post.
Robert
This AppleScript program is designed to convert HTML links to forum posts, to convert special characters to their HTML symbols, and to preserve formatting.  
1)  When the clipboard contains a link to a forum reply page.
 The AppleScript forums designers  specify a roundabout way for you to reference a particular web post.  Here is that way:
 a) Find the particular post you wish to reference.  
 b) Click on the reply icon.  
 c) Copy  the Web address to the clipboard .  
 d) Run this AppleScript to convert the Web address.  
 e) Paste the converted Web address into your post.
  For example,  this AppleScript will convert this Web address:
    http://discussions.apple.com/post!reply.jspa?messageID=9003196
  into this Web address:
          http://discussions.apple.com/message.jspa?messageID=9003196#9003196
2)  Assume that the clipboard contains text to convert.  
 Many of the special characters are used to indicate formatting in the forums.
 See "Other formating tags are available as shown below" in
 http://discussions.apple.com/help.jspa
 This AppleScript will converted to HTML these special symbols in order to preserve the original characters. Also, this AppleScript preserves indentation used in programs or Terminal output.
 a) Copy  the text to the clipboard .  
 b) Run this AppleScript to convert the text
 c) Paste the converted text into your post.
 For example,  the asterisks will be preserved:
   mac $ ls *oup*
   Youpi Key Editor.plist  Youpi Key.app alias  
 For example,  the indentation will be preserved:
   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
     end repeat
   end adding folder items to
 Author: rccharles
-- Write a message into the event log.
log "  --- Starting on " & ((current date) as string) & " --- "
set theClip to the clipboard
if characters 1 thru 33 of theClip as string = "http://discussions.apple.com/post" then
       http://discussions.apple.com/post!reply.jspa?messageID=9003196
       http://discussions.apple.com/message.jspa?messageID=9003196#9003196
 set theClip to alterString(theClip, "post!reply", "message")
 set {frontPart, postNumber} to textToList(theClip, "=")
 set theClip to theClip & "#" & postNumber
else
 -- must be the first change so as not to cause problems.
 --  and there must not be any HTML numbers on the clipboard.
 set theClip to alterString(theClip, "#", "#")
 set theClip to alterString(theClip, "&", "&")
 set theClip to alterString(theClip, " ", " ")
 set theClip to alterString(theClip, "  ", "  ") --  contains two spaces
 set theClip to alterString(theClip, "!", "!")
 set theClip to alterString(theClip, "[", "[")
 set theClip to alterString(theClip, "]", "]")
 set theClip to alterString(theClip, "<", "&lt;")
 set theClip to alterString(theClip, "*", "&#042;")
 set theClip to alterString(theClip, "+", "&#043;")
 set theClip to alterString(theClip, "_", "&#095;")
 set theClip to alterString(theClip, "--", "&#045;&#045;")
 set theClip to alterString(theClip, tab, "  ")
 set theClip to "<tt>" & theClip & "</tt>"
end if
set the clipboard to theClip
on alterString(thisText, delim, replacement)
 set resultList to {}
 set {tid, my text item delimiters} to {my text item delimiters, delim}
 try
   set resultList to every text item of thisText
   set text item delimiters to replacement
   set resultString to resultList as string
   set my text item delimiters to tid
 on error
   set my text item delimiters to tid
 end try
 return resultString
end alterString
-- textToList was found here:
-- http://macscripter.net/viewtopic.php?id=15423
on textToList(thisText, delim)
 set resultList to {}
 set {tid, my text item delimiters} to {my text item delimiters, delim}
 try
   set resultList to every text item of thisText
   set my text item delimiters to tid
 on error
   set my text item delimiters to tid
 end try
 return resultList
end textToList

The first thing that you need to do is to make the text into an AppleScript program.
start the AppleScript Editor
/Applications/AppleScript/Script Editor.app
copy the text to the Applescript editor.
save the text to a file as an application and do not check any of the boxes below.
!http://farm4.static.flickr.com/3544/3390737677_645a847e28.jpg?v=0!
now, let's build a link to a post.
get the link to a reply.
Goto this Webpage:
http://discussions.apple.com/post!reply.jspa?messageID=9003196
Copy the Web page address from the top of your Web browser page. This is the standard highlight the address then do a command+c
Now you should run my AppleScript program by going back to the Script Editor. Optional, click the words *event log* to see the debug information. Click on the run icon.
!http://farm4.static.flickr.com/3423/3391549168_9ce8b6fcd9.jpg?v=0!
The link has been modified. Paste the link onto your Web page. This is the standard command+v.
For a more typical usage, placed the program on the dock or make an alias on the desktop.
Robert
Name: alter-clipboard
Input: Clipboard
Output: Clipboard
This AppleScript program is designed to convert a forum-reply web address  to a link to a forum post, to convert special characters to their HTML symbols, and to convert programming language code to a  form that does not get mangled.
1)   When you wish to reference another Apple discussion forum post, I found the process convoluted.  The Apple form software does not provide for the display of a form post link.  Instead, you must  construct the link from a reply post.  This AppleScript simplifies the process.
 When the clipboard contains a link to a forum reply page, do the conversion.
 Here is that way:
 a) Find the particular post you wish to reference.  
 b) Click on the reply icon.  
 c) Copy  the Web address to the clipboard  (command+c).  
 d) Run this AppleScript to convert the Web address.  
 e) Paste (command+v) the converted Web address into your post.
  For example, you:  
  • Want to reference a post on how to improve the performance of Tiger.  You find a post by Texas Mac Man with a list of possibilities.  
  • Click on the Reply option and highlight the Web address because you know the address contains a reference to this post.
  • Type command+c to copy the address to the clipboard.  The clipboard now contains:
   http://discussions.apple.com/post&#033;reply.jspa?messageID=9124252
  •  Run this AppleScript to convert the Web address. The clipboard now contains:  
         http://discussions.apple.com/message.jspa?messageID=9124252&#035;9124252
  • Type command+v to paste the address  into your new post.
2)  Assume that the clipboard contains  special symbols or formated programming language code to convert.  
 This AppleScript will converted special symbols used in these forums to a form not used by the forum software in order to preserve the original characters.
 For the symbols, see:
 See "Other formating tags are available as shown below" in
 http://discussions.apple.com/help.jspa&#035;format
 An alternative to using these symbols is document in this post:
 http://discussions.apple.com/thread.jspa?messageID=607563
 Also, this AppleScript preserves indentation used in programs or Terminal output.
 a) Copy  the text to the clipboard .  
 b) Run this AppleScript to convert the text
 c) Paste the converted text into your post.
 For example,  the asterisks will be preserved:
   mac $ ls *oup*
   Youpi Key Editor.plist  Youpi Key.app alias  
 For example,  the indentation will be preserved:
   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
     end repeat
   end adding folder items to
 Author: rccharles
 Copyright 2009 rccharles
 GNU General Public License
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation,  version 3
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   For a copy of the GNU General Public License see <http://www.gnu.org/licenses/>.
-- Write a message into the event log.
log "  --- Starting on " & ((current date) as string) & " --- "
set theClip to the clipboard
if characters 1 thru 33 of theClip as string = "http://discussions.apple.com/post" then
       http://discussions.apple.com/post&#033;reply.jspa?messageID=9003196
  convert to:
       http://discussions.apple.com/message.jspa?messageID=9003196&#035;9003196
 set theClip to alterString(theClip, "post!reply", "message")
 set {frontPart, postNumber} to textToList(theClip, "=")
 set theClip to theClip & "#" & postNumber
else
 -- must be the first change so as not to cause problems.
 --  and there must not be any HTML numbers on the clipboard.
 set theClip to alterString(theClip, "#", "&#035;")
 --  You need to use either the numeric form of the HTML symbol or to
 --  do the translation has seen below.
 set theClip to alterString(theClip, "&amp;", "&amp;amp;")
 set theClip to alterString(theClip, " ", "&amp;nbsp;")
 set theClip to alterString(theClip, "  ", "  ") --  contains two spaces
 set theClip to alterString(theClip, "!", "&#033;")
 set theClip to alterString(theClip, "[", "&#091;")
 set theClip to alterString(theClip, "]", "&#093;")
 set theClip to alterString(theClip, "<", "&#060;")
 set theClip to alterString(theClip, "*", "&#042;")
 set theClip to alterString(theClip, "+", "&#043;")
 set theClip to alterString(theClip, "_", "&#095;")
 set theClip to alterString(theClip, "--", "&#045;&#045;")
 set theClip to alterString(theClip, tab, "  ")
 set theClip to "<tt>" & theClip & "</tt>"
end if
set the clipboard to theClip
on alterString(thisText, delim, replacement)
 set resultList to {}
 set {tid, my text item delimiters} to {my text item delimiters, delim}
 try
   set resultList to every text item of thisText
   set text item delimiters to replacement
   set resultString to resultList as string
   set my text item delimiters to tid
 on error
   set my text item delimiters to tid
 end try
 return resultString
end alterString
-- textToList was found here:
-- http://macscripter.net/viewtopic.php?id=15423
on textToList(thisText, delim)
 set resultList to {}
 set {tid, my text item delimiters} to {my text item delimiters, delim}
 try
   set resultList to every text item of thisText
   set my text item delimiters to tid
 on error
   set my text item delimiters to tid
 end try
 return resultList
end textToList

Similar Messages

  • "Convert Text to Table" Size limit issue?

    Alphabetize a List
    I’ve been using this well known work around for years.
    Select your list and in the Menu bar click Format>Table>Convert Text to Table
    Select one of the column’s cells (1st click selects entire table, 2nd click selects individual cell)
    Open “Table Inspector” (Click Table icon at top of Pages document)
    Make sure “table” button is selected, not “format” button
    Choose Sort Ascending from the Edit Rows & Columns pop-up menu
    Finally, click Format>Table>Convert Table to Text.
    A few days ago I added items & my list was 999 items long, ~22 pages.
    Tonight, I added 4 more items. Still the same # pages but now 1,003 items long.
    Unable to Convert Text to Table! Tried for 45 minutes. I think there is a list length limit, perhaps 999 items?
    I tried closing the document w/o any changes. Re-opening Pages & re-adding my new items to the end of the list as always & once again when I highlight list & Format>Table>Convert Text to Table .....nothing happens! I could highlight part of the list up to 999 items & leave the 4 new items unhighlighted & it works. I pasted the list into a new doc and copied a few items from the middle of the list & added them to the end of my new 999 list to make it 1003 items long (but different items) & did NOT work. I even attempted to add a single new item making the list an even 1000 items long & nope, not working. Even restarted iMac, no luck.
    I can get it to work with 999 or fewer items easily as always but no way when I add even a single new item.
    Anyone else have this problem?  It s/b easy to test out. If you have a list of say, 100 items, just copy & repeatedly paste into a new document multiple times to get over 1,000 & see if you can select all & then convert it from text to table.
    Thanks!
    Pages 08 v 3.03
    OS 10.6.8

    G,
    Yes, Pages has a table size limit, as you have discovered. Numbers has a much greater capacity for table length, so if you do your sort in Numbers you won't have any practical limitation.
    A better approach than switching to Numbers for the sort would be to download, install and activate Devon Wordservice. Then you could sort your list without converting it to a table.
    Jerry

  • How do I use the Services menu to convert text to an iTunes track?

    I'm trying to convert text to an iTunes track using the Services option on the Firefox drop down menu, but having trouble with it. I have set my preferences to turn on that option, but all that happens is I get a spinning wheel at the top of my screen, and it doesn't record. I can't see anything in the iTunes settings that I need to change, but wondering if that could be the problem? Any help would be appreciated.

    Then you may be much better off posting your question in the ExportPDF forum,
    http://forums.adobe.com/community/exportpdf

  • Problem in converting text to image.

    Hi I am trying to convert a text to image. The code for the same is pasted below. The problem is how do I change the background color. No matter what color I give with Graphics2D object, the background is always black. I want a white background.
    public class TextToImg1
    public static void main(String args[])
    try
    int width = 400;
    int height = 400;
    BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2D = bimage.createGraphics();
    g2D.drawString("This is the sample page to convert text to image.",100,100);
    g2D.setBackground(Color.WHITE);
    g2D.setColor(Color.WHITE);
    File f = new File ("anImage.jpg");
    ImageIO.write (bimage, "jpeg", f);
    catch(Exception exception)
    System.err.println(exception.getMessage());
    }

    Probably because you didn't draw the background. Use the fillRect(...) method to paint the background using the color your want.

  • Acrobat Pro 10.1.2, unable to convert text to outlines

    Hello,
    Since updating to Adobe Acrobat Pro 10.1.2 on Mac OS X 10.7.2, I am unable to use the flattner preview to convert text to outlines. The dialog box appears, and there are no error messages, but upon comleting the same steps I've been using for years (including last week), text is not converted to outlines. It just isn't working. There is no feedback, or error message. I have tried restarting the computer and that did not help. I will try deleting the preferences. Anyone else have this problem, or have a fix for it?
    Thank you.

    Hello,
    Thank you for the suggestion, but unfortunately that did not solve my problem.
    I use the flatner preview to covert text to outlines so that I can edit PDF files when I do not have the original fonts - and so that I don't have to use replacement fonts. Editing the text isn't necessary in this case so converting the text to curves is not a problem.
    Unfortunately, I am still without a solution. I really don't want to rasterize the file (convert to bitmap) because I would like to keep it in a vector format for editing in Illustrator.

  • Convert text in PDF to editable field in Reader

    Hi,
    Is there a way in Acrobat Pro to convert text in the PDF to an editable field so that someone opening the PDF in Reader would be able to amend the text. Or do you actually have to make the text in Acrobat?
    Thanks for any help,
    Jackie

    It can probably be achieved with a script, but if you only need to do it once, I think doing it manually is the best way to go.

  • Adapter Module to convert text message to XML

    Hello Experts,
    I am writing a custom adapter module to convert the text  content to XML message at the sender adapter end.
    I have followed the steps mentioned in the "HowToCreateModulesforJ2EEAdapterEngine" guide available on SDN.
    I have created the java logic in the process mesthod of the bean to conver the text message to XML paylod (don't know if it is correct). I do not have much idea about the Adpater API methods.
    Can anybody help me with the logic to convert the text msg to xml paylod using adapter frame work APIs or is there any way I can debug and test my logic in NWDS.
    Any help will be greatly appreciated.
    - Rajan

    Hi ,
    To convert Text message to XML why yiu want to go for Adapter Module?? Using file content conversion it self you can do it right?????
    There is no standard logic to convert text file to XML, the logic purely depends on your text message format.
    Regards,
    Raj

  • Convert text in pdf with as3

    Hallo,
    1) what is the best way to convert text to pdf from as3?
    2) what is the best way to import pdf in fash?
    Thanks.

    you'll need to use a 3rd party library like alivePDF, AlivePDF - ActionScript 3 Open-Source PDF Library – 100% client side PDF generation which makes you and your server happ… and/or purePDF, purePDF, a complete actionscript PDF library - sephiroth.it - flash world

  • Change color of compoundPathItems created by converting Text to Paths using createOutline()

    I used createOutline() to convert Text to Paths. However, the return is a GroupItem and I had difficulty in changing its stroke and fill colors.
    Here is my script:
    var docActive = app.documents.add();
    var textFrame = docActive.pathItems.rectangle( 0, 0, 200, 20);
    var areaText = docActive.textFrames.areaText(textFrame);
    areaText.contents = "Hello My Friend";
    areaText.textRange.characterAttributes.size = Math.round(20*0.85);
    var textOutline = areaText.createOutline();
    // Trying to change stroke and fill colors of textOutline but got stuck here...

    try this, I added comments next to each line
    var docActive = app.documents.add();
    var textFrame = docActive.pathItems.rectangle( 0, 0, 200, 20);
    var areaText = docActive.textFrames.areaText(textFrame);
    areaText.contents = "Hello My Friend";
    areaText.textRange.characterAttributes.size = Math.round(20*0.85);
    var textOutline = areaText.createOutline(); // this is a group
    var compoundPaths = textOutline.compoundPathItems; // each letter is a compound path
    for (i=0; i<compoundPaths.length; i++) {    // loop thru all letters
        var compoundPath = compoundPaths[i];    // this holds one letter at a time
        var pathItems = compoundPath.pathItems; // all pieces (pathItems) of the compound path make up each letter
        for (j=0; j< pathItems.length; j++) {   // loop thru all letter parts
            var pathItem = pathItems[j];            // this holds one letter piece at a time
            pathItem.fillColor = docActive.swatches[5].color;       // fill it with the 5th swatch
            pathItem.strokeColor = docActive.swatches[4].color; // stroke it with the 4th swatch

  • Convert text to Iso-8859-1

    Dear experts,
    Is there a function module or method available to convert text to the Iso-8859-1 character set?
    Or might it be possible to integrate it in OPEN DATASET TEXT MODE ENCODING WITH ? Only UTF-8 seems to be available.
    Thanks in advance!

    Hi,
    Use this:
    DATA: iso TYPE cpcodepage.
    "get code page by name
    CALL FUNCTION 'SCP_CODEPAGE_BY_EXTERNAL_NAME'
      EXPORTING
        external_name       = 'ISO-8859-1'
    IMPORTING
       sap_codepage        = iso
    EXCEPTIONS
       not_found           = 1
       OTHERS              = 2.
    CHECK sy-subrc = 0.
    "open file for reading encoding iso
    OPEN DATASET filename FOR INPUT IN LEGACY TEXT MODE CODE PAGE iso.
    Regards
    Marcin

  • Grey background in converted text

    I added some shadow to text to have it converted to an image (PNG).
    This looks good at the iMac at home. At some PC, which also doesn't show the navigation bar, the text gets a grey background. Example:
    http://www.hasselo.eu/photography/Books.html where the upper picture has real text and the lower picture contains converted text (PNG).
    Something similar here: http://www.hasselo.eu/photography/Gallery-photo_course.html where the button "Gallery" at the top has a grey background.
    I assume that not all viewers will be able to see this because some browsers show it well and others don't.
    Is there something in iWeb that I can do to fix this?
    Is this because it is PNG and some browsers have an issue with PNG.
    Alternate solution is to type the text in a graphics program, save it as jpg and at this to iWeb so that iWeb does not have to convert to PNG.
    Thanks for your help.

    fixed this in a work around

  • How can I convert text to PDF in the new "Pages" without losing info.

    How can I convert text to PDF in the new "Pages" without losing a lot if information?

    Select Export To from Pages' File menu, then select PDF from the sub-menu.

  • Can Java convert text in to three dimensional forms?

    Hi,
    I'm an MA student at Central Saint Martins College of Art and Design in London. I'm currently working on a project to convert text, entered onscreen by users, into three dimensional forms when initiated by clicking on a button. Each 3D form is to be unique to the text entered. Does anyone know how best to do this and whether Java is the best tool for this? Any help or ideas that can be offered will be greatly appreciated.
    Thanks

    Hi,
    Thank you for your help, the link is a great starting point in the development of my project, but its not the "nail on the head", which is my fault. On reading back my last posts it seems I omitted a key word (sorry, my mistake) in the description of what I want to do, which is: "…can Java convert text into abstract three dimensional forms?" By abstract three dimensional forms I was hoping to create something along the lines of what is possible with Rhinoscript, here is an example of the type of visual I want to be able create from the transformation of user entered text using computer code: http://www.theverymany.net/uploaded_images/080108_Srf_Test001_01_k_TVM-718625.jpg. I hope this sheds some light on the direction I'm hoping to take, so if you or anyone else can offer any more help or pointers I will be eternally grateful.
    Thanks

  • When I convert text to outlines, some letters, usually S, looks different. The top part of the S is moved down. Why does this happen?

    This is what happens when I convert text to outlines. Can someone please explain why this happens and what I can do to fix it? Thanks!

    You are welcome. What is most likely happening is whoever designed the font, has some garbage stray points, or an extra copy of the paths underneath.
    You will usually see this only on free fonts, and not from a major font foundry.

  • Converted text on my blog is not converting?

    Hello all. Im new to pdf conversions. I am wantig to make a series of pdf docs based on the info in my blog for fellow colleagues. When I convert text from my blog to pdf do I get a blue box around the links? I am using windows xp and have adobe reader x. I dont want to update my package just to deal with this problem. Can I adjust a setting to remove the lue box from links when I convert to pdf?
    Thanks

    Adobe Reader does not convert to PDF. What software do you use for that?

Maybe you are looking for

  • Urgent Help !!!  Export data into insert format (Oracle Sql developer)

    Hi all, Please help , when i try to export ms access table which have 400,000 over rows to insert format using oracle sql developer 1.5.5. After the export have done the exported file xxx.sql is empty. Is it because of too many rows? or what tool or

  • How to print multiple values seperated by comma in a table

    Dear All,    I have one requirement where am not able to acheive it in BO XI R4 . I tried as per this link http://scn.sap.com/thread/3245018 and it did not get the expected result. Assuming that i hagve the data as shown in below table Name City A YY

  • Cisco Technical Support v3.7 - New Features

    Accurately Update Installed Location. The Cisco Tech Support mobile application—available for Apple or Android—provides smartphone and tablet access to critical Technical Services support such as support documentation, service request creation and up

  • AP open items data

    Hi gurus,          Here i have to extract data related to ACCOUNTS PAYBLE OPEN ITEM DATA for that i have to extract Header data , item data, and vendor data, bank details.....so pls advice me from how many tables i have to  take data ... I knew some

  • Will Time Machine back up two internal hard drives on the same computer?

    Hi, I'm running a Quicksilver G4 - the last of the dual booters - and I have two hard drives installed. One is an 80Gb carrying the OS, apps, and iMovie projects and photos. The original 60Gb drive is still in there, and has the old OS9 and all my wo