Page 1 of 1

vbscript and TextPad as a Spellchecker

Posted: Sun May 04, 2014 7:33 am
by empeyg
Hi,
I currently have some vbscript that is using MS Word as a spellchecker. However, whenever the text is pasted back to my calling application, the apostrophe's are slanted. I've tried fixed fonts and a variety of other's with no success. So I thought I'd try to use TextPad. Anyone ever tried?
Another option would be to call an External Spell Checker. Know of any?

The following is my code for MS Word:

Code: Select all

' A simple script that checks the spelling of a Song Title

Sub SpellCheck
  ' Define variables
  Dim list, lstItm
  Dim objWord, objDoc, objSel
  
  Set objWord = CreateObject("Word.Application")
  objWord.Visible = True

  ' Get list of selected tracks from MediaMonkey
  Set list = SDB.CurrentSongList 

  ' Process all selected tracks
  For i=0 To list.count-1
    Set lstItem = list.Item(i)

    Set objDoc = objWord.Documents.Add
    objDoc.Activate
    
    objDoc.Content.Text = lstItem.Title
    objDoc.CheckSpelling

    Set objSel = objWord.Selection
    objSel.Font.Name = "Courier New"

    lstItem.Title = Left(objdoc.Content.Text, Len(objDoc.Content.Text) - 1)
    
    Set objSel = Nothing
    objDoc.Saved = False
    objDoc.Close (0)
    Set objDoc = Nothing
  Next

  ' Write all back to DB and update tags
  list.UpdateAll
  
  objWord.Quit
  Set objWord = Nothing
  
  MsgBox "Spell Check is complete."
End Sub

Posted: Mon May 05, 2014 10:09 pm
by kengrubb
When you say, apostrophes are slanted, are you saying that you get these:

‘ or ’

Rather than this:

'

Posted: Mon May 05, 2014 11:34 pm
by ak47wong
This is off-topic for TextPad, but you can turn off curly quotes in Word:

In Word 2003 or earlier, click Tools and then click AutoCorrect Options.

In Word 2007, click the Office button, click Word Options, click Proofing and then click AutoCorrect Options.

In Word 2010, click File, click Options, click Proofing and then click AutoCorrect Options.

On the AutoFormat As You Type tab, under Replace as you type, clear "Straight quotes" with "smart quotes".

Posted: Tue May 06, 2014 2:12 am
by empeyg
To the first reply:
Yes, i get ‘ or ’ rather than this: '

I just realized I could try to do a replace for the ‘ or ’, if I knew what ASCII characters they were, but then what about other characters I'm not aware of. Oh, the complexity. :)

To the second reply:
I could change those options in Word, however, when I'm creating word documents I would want the curly quotes. The chances of me remembering to change it back and forth and slim.

Posted: Tue May 06, 2014 2:36 am
by ak47wong
Although this is still off-topic for TextPad, you can turn the option off and on in your script:

Code: Select all

  objWord.Options.AutoFormatAsYouTypeReplaceQuotes = False
  objWord.Options.AutoFormatAsYouTypeReplaceQuotes = True

Posted: Tue May 06, 2014 2:52 am
by empeyg
Well look at that. Thanks! I'll do that!!!!