Assigning a key to Curly Quotes in Word Pro for OS/2

These instructions were provided to me by John Moore:

I have done some playing around and find I cannot map a script to the quote key (probably 
because WordPro uses it internally for the Windows Smart Quotes (which don't work in...).  I 
did work up some scripts that can automate the double quotes, mapped to Alt-/.

Choose a startup script under Edit->Scripts & Macros->Set Startup Scripts (I used 
startapp.lwp).  Open the document, select Edit->Scripts & Macros->Show Script Editor.

In the top left listbox, you should be in !Globals.  In the top right, click the arrow and 
pick Initialize.

In the window that appears, between Begin Sub and End Sub, type in

Dim Key As Integer
Dim FuncName As String
REM &H4000 = CTRL, &H1000 = SHIFT, and &H2000 = ALT
Key = &H2000+Asc("/")
FuncName = "H:\LOTUSW4\WORDPRO\SCRIPTS\startapp.lwp!Quotes"
.ApplicationWindow.Accelerators.AddAccelerators FuncName, Key, 0, False

You will have to modify your directory under FuncName to show the full path to the startup 
script file you have chosen.

Now either select Create->Sub or press F3.  Name the new subroutine Quotes.

Type between the Begin Sub and End Sub:

Dim MyText As String
	
If ( .text.positionxonpage = .layout.marginleft ) Then .Type "®"
  Else
MyText = .Text.GetText( $LwpGetObjectTypeWord, False )
  If  ((Right(MyText, 1) = "") Or (Right(MyText, 1) = "¯")) Then
    .Type "®"
  Else	
    .Type "¯"
  End If
End If
	
What this does is pretty basic.  It looks to see if it's at the start of a line.  If so, you 
want a double open quote.  If not, we get the text at the cursor.  If it's either empty 
(spaces) or a double close quote, we need a double open quote.  If not, we need a double 
close quote.

You are responsible for setting up your font (for which I thank you) in advance.  The routine 
assumes you have a document open and the proper font selected, otherwise it will probably 
show you an error.

Good luck!

John Moore

Back