ScriptTip#102: PunctuationModeForEditSessions. Have you got one punctuation mode set for reading messages, (perhaps set to None, or Some), and have to set it to another mode during a reply, or when creating a new message? Here is a means of having it switched to "All" when editing, and back to your normal setting when not editing. What it does: This routine, when detecting that you are entering an edit session either by creating a new message, (Control+N), replying to the current message, (Control+R), or replying to all addresses on the current message, (Control+Shift+R) saves your default punctuation mode setting for Outlook Express, and sets it to the highest mode, "All" for the time you are in that edit session. When you leave that editing session, it returns you to your default mode again. For informational purposes, the different Punctuation modes, (or levels), are "None"=0, "Some"=1, "Most"=2, and "All"=3. Since the text strings are not set as constants anywhere, we'll use the numeric values in this routine, but with a comment line signifying what it is. 1) Launch the Script editor by hitting Insert+0. 2) Arrow down to the line that reads "Globals" and hit End key, then Enter key. This will place you on a blank line within the Globals section. (Note: If you arrow down and come to the first script without seeing a "Globals" line, then you probably don't have a Globals section, so place it on a blank line yourself, then place a blank line underneath that line.) 3) Type in, or Cut and Paste, the following lines: int MyNormalPunctuationMode, int IsThisTheFirstTime Those are two variables we'll use to hold integer values, (numbers); the MyNormalPunctuationMode will hold your default punctuation mode setting, and IsThisTheFirstTime will hold another integer (number) that we'll use as a "flag" for determining if Outlook Express just gained focus due to the program being launched, or by the user moving to OE from another window, such as with the Alt+Tab. I'll explain why this even matters below. To initialize, (or assign a value to), these two variables, we need to create an "AutoStartEvent()" function, if one doesn't already exist. To see if you've already got that function, hit Control+L to bring up a list of all the scripts and functions in this script file. Since it is sorted, the "A" list should be at the top. Look through those and see if there is an AutoStartEvent() function. If so, highlight it and whack Enter to get into that function; if there isn't one, hit Escape to cancel that list, then hit F2. This will jump you to the first function, which should be AutoFinishEvent. Move up a line and type in, or cut and paste, the following lines: (The comments are optional... function AutoStartEvent() If(IsThisTheFirstTime==YES) Then ;Did OE just get launched? If so, save my default punctuation mode. let MyNormalPunctuationMode=GetJcfOption(OPT_Punctuation) ;set the flag to FALSE now that we know it has launched. let IsThisTheFirstTime=NO EndIf EndFunction This function gets executed automatically whenever the application becomes the active focus, be it by running the application, or Alt+Tab from another window. If it is the first time we've run the application, then save the current punctuation mode to the MyNormalPunctuationMode variable, so we can come back to it when not editing. We also set the IsThisTheFirstTime to No, so if we Alt+Tab out of this application during an editing session, and Alt+Tab back into OE, it will not save the current punctuation mode to the MyNormalPunctuationMode. Remember, we have punctuation set to "All" in the editing sessions, so without that flag, we would be setting the default to "All" if we Alt+Tab back into this program, which would make this routine useless! If you didn't quite understand that, drop me a line privately and I'll try to explain in more detail. 4) Now that we have the variables initialized, hit Control+S to compile what we have so far. If it compiled Ok, go on, but if it didn't, check your spelling in the Globals, and the AutoStartEvent function. 5) Hit Control+L to bring up the Script list and hit the letter "F". It should take you to the first listing starting with that letter. Highlight the FocusChangedEvent function and whack Enter. 6) Arrow down to the first line beginning with the word "If". Hit Home, then Enter to place a blank line above that line. 7) Hit UpArrow and type in, or cut and paste, the following If/Then statement: If CaretVisible() Then ;if there is a caret, it is an edit field. SetJcfOption(OPT_Punctuation, 3) ;set punctuation mode to "All". Else ;if it isn't an edit field... SetJcfOption(OPT_Punctuation,MyNormalPunctuationMode) ;give me back my default settings! EndIf 8) Hit Control+S to compile the changes. If they compiled Ok, hit Alt+F4 to exit the Script Manager, then exit Outlook Express. Return to Outlook and see if the script works the way you think it should! Hope this helps! Thanks, Dennis Brown, [EMAIL PROTECTED] Visit the Blind Programming site at http://www.mindspring.com/~brown99/ What it does: - Visit the jfw ml web page: http://jfw.cjb.net
