ashley Posted August 6, 2004 Report Share Posted August 6, 2004 I see that there is a character command that will change words to all capital letters or all little letters, but is there anything that will capitalize just the first letter in a word? I need to do this for a name and address file. Quote Link to comment Share on other sites More sharing options...
Pete Posted August 6, 2004 Report Share Posted August 6, 2004 Hi Ashley, attached is a playable macro which will do what you want Set String T1 = Peter Modify String Copy Char 1 of T1 to T2 Modify String Copy T2 to T3 Modify String Uppercase T3 Modify String Rplace T2 with T3 in T1 (NOT all instances) There are probably several other ways to do it too. Pete. capitalise.mxe Quote Link to comment Share on other sites More sharing options...
Tim Posted August 8, 2004 Report Share Posted August 8, 2004 I had a similar situation a few weeks ago. One of my customers had downloaded a mailing list (all in uppercase characters) and wanted to quickly convert the names and addresses to capitalized words. I found a command in the "PGM Functions Library" named "{ String - Proper }" that did the job. The library is sold by the same people that sponsor this forum. I think the whole library was $29.95. And I did notice that they are having a 30% off sale this weekend but, like I said, I got mine a few weeks ago. Anyway, here is a link to more information about the library and here is a link to the free manual. Good Luck! Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted August 21, 2004 Report Share Posted August 21, 2004 Hi Ashley, I wrote a macro a couple of weeks ago that capitalizes the first letter in EVERY word in a text string. It is not what one would call "title case" with some words such as "the" in lower case. The macro starts off basically as Pete showed. It then works through the string looking for spaces and sets a flag if one found. The next non-space character is capitalized and the flag reset. It is designed to change the first letter after a space or "-". Other exceptions are easy to add - see listing in Scripting Editor It will not presently handle a cr/lf so the first words in multiline selections are not changed. It is designed to be run after text in some document has been selected (highlighted). The hotkey is pressed, text is copied, processed and then pasted back. If the text is input via another method the macro needs to be modified. Macro worked for my purposes but not extensively tested. 1st_letter_uppercase.mxe Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted August 21, 2004 Report Share Posted August 21, 2004 Thanks to Nicolas' help with Ascii codes, I have upated my macro to work with all the common text delimiters, space, comma, semi-colon, colon, hyphen, underscore, tab, line feed. It is fairly clear in the macro how to add (or remove) delimiters in plain text or ascii character code. The first character in a text string, and any character after a delimiter, will be capitalized. Example (all lines of text selected): abc -def ghi- jkl ;mno pqr,stu,vwx_yz Abc -Def Ghi- Jkl ;Mno Pqr,Stu,Vwx_Yz 1st_letter_uppercase_r2.mxe Quote Link to comment Share on other sites More sharing options...
Nicolas Posted August 21, 2004 Report Share Posted August 21, 2004 you could enhance your macro to insert missing spaces / remove extra ones ... for instance : - if you have two spaces, it should remove the second one - there should be a space after and no space before "single" symbols such as commas and dots - there should be a space after and another one before "double" symbols such as colons, semi-colons (at least in France, because I know it depends on the country) Quote Link to comment Share on other sites More sharing options...
Noggin the Nog Posted August 22, 2004 Report Share Posted August 22, 2004 I'm sure there are lots of variations you could make but you are then getting into application-specific. What suits one person does not suit another. For very specific uses, a custom macro can be written. For general use it is better to have a suite of simple macros that can be put together in different combinations to produce the required results. Regarding spaces, I have another macro that goes though a block of text reducing all the gaps between words to one space (though I will have to modify to cope with tabs, ascii 9!) Quote Link to comment Share on other sites More sharing options...
Bernd.Frisch Posted August 23, 2004 Report Share Posted August 23, 2004 1. Invert If accidently I hit the key Capslock it would be very helpful if the text written false could be automatically corrected instead of typing again from scratch. The best solution would be if each character would be inverted, so that a capital letter would become small and a small letter capitalized. 2. Capital letters If all letters are capitalized your macro doesn't work (yet) :-) But if I add <TMVAR2:13:01:00:000:000:><REM2:Change all letters to lowercase>..... Quote Link to comment Share on other sites More sharing options...
ashley Posted August 25, 2004 Author Report Share Posted August 25, 2004 Funny that you should mention that Bernd. I started using the Proper function from the pgm suite and it does lower-case everything first before upper-casing the first letter. It even capitalizes the first character in a word if the character before it is a punctuation mark, and not just whitespace. I do want to thank everyone for their answers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.