' ------------------------------------------------------------------------------------
'				WordSpellCheck.vbs
' Uses Microsoft Word to spell check a picture comment
'
' Code adapted from Microsoft Product Support Service
'	http://support.microsoft.com/support/kb/articles/Q243/8/44.ASP
' ------------------------------------------------------------------------------------

Option Explicit

Dim alb, pic
  set alb = app.GetCurrentAlbum
  ' Get the current picture
  set pic = alb.GetVisiblePicture( alb.nCurrentPicture )

Dim oWord, oTmpDoc, lOrigTop
   
 ' Create a Word document object...
 Set oWord = CreateObject("Word.Application")
 Set oTmpDoc = oWord.Documents.Add
   
 ' Position Word off screen to avoid having document visible...
 lOrigTop = oWord.Top
 oWord.WindowState = 0
 oWord.Top = -3000
   
 ' Assign the picture comment to the document and check spelling...
 oTmpDoc.Content.Text = pic.sComment
 oTmpDoc.Activate
 oTmpDoc.CheckSpelling
   
 ' After user has made changes, get text back...
 dim text
 text = oTmpDoc.Content.Text
 ' get rid of the extra linefeed added at the end
 pic.sComment = left(text,len(text)-1)
   
 ' Close the document and exit Word...
 oTmpDoc.Saved = True 
 oTmpDoc.Close

 Set oTmpDoc = Nothing
   
 oWord.Top = lOrigTop
 oWord.Quit
 Set oWord = Nothing
   
