home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Lotus / LOTUS / WORDPRO / SCRIPTS / PRSIT.LSS < prev    next >
Text File  |  1998-02-10  |  2KB  |  82 lines

  1. ' The Present-It Script
  2. ' Copies selected text from the current document to the clipboard,
  3. ' launches Freelance, and creates presentation content from the
  4. ' text on the clipboard.
  5.  
  6. Sub    PrsIt()
  7.     On Error Goto HandleProblem    
  8.     ' Use these flags to detect the most common errors.
  9.     NullSelectionFailure = False
  10.     LaunchFailure = False
  11.     
  12.     'Save previous view info
  13.     IsPrevViewOutline = CurrentWindow.WinViewPrefs.IsInOutline
  14.     ' Show outline, if not already showing
  15.     If IsPrevViewOutline = False Then
  16.         .BeginChange True
  17.         CurrentWindow.WinViewPrefs.IsInOutline = True
  18.         .EndChange True
  19.     End If
  20.     ' Copy to clipboard
  21.     NullSelectionFailure = True
  22.     .CopySelection
  23.     NullSelectionFailure = False
  24.     
  25.     
  26.     ' Fire up Freelance
  27.     LaunchFailure = True
  28.     Set FLG = CreateObject("Freelance.Application")
  29.     LaunchFailure = False
  30.     Set Doc = FLG.NewDocument()
  31.     ' Otherwise the new presentation will be inaccessible
  32.     FLG.Visible = True
  33.     ' Go to the Freelance outline view
  34.     Doc.ViewMode = FLG.GetEnum("ViewOutliner")
  35.     ' Paste in the WP doc
  36.     Doc.ActivePage.Paste
  37.     ' Go to the Freelance sorter view
  38.     Doc.ViewMode = FLG.GetEnum("ViewSorter")
  39.     PageCount = Doc.Pages.Count
  40.     If PageCount = 1 Then
  41.         ' Nothing pasted?
  42.         ' Print "debug: no pages created"
  43.     Else
  44.         ' Last page is the empty title page - get rid of it.
  45.         Set LastPage = Doc.Pages.Item(PageCount)
  46.         LastPage.Remove
  47.     End If
  48.     ' Return to draw view
  49.     Doc.ViewMode = FLG.GetEnum("ViewDraw")
  50.     ' Leave Freelance running with new document active.
  51.     Goto AllIsWell
  52.     
  53. HandleProblem:
  54.     On Error Goto VeryEnd
  55.     If NullSelectionFailure = True Then
  56.         Messagebox "Please select the text you wish to use before running this procedure.", 48, "Error Creating Presentation"
  57.     Else    
  58.         If LaunchFailure = True Then
  59.             Messagebox "Lotus Freelance Graphics must be installed before running this procedure.", 48, "Error Creating Presentation"
  60.         End If
  61.         
  62.     End If
  63.     Resume Out
  64.     
  65. AllIsWell:
  66.     ' Print "Completed successfully."
  67.     
  68. Out:
  69.     ' Restore view if not outline
  70.     If IsPrevViewOutline = False Then
  71.         .BeginChange True
  72.         CurrentWindow.WinViewPrefs.IsInOutline = False
  73.         .EndChange True
  74.     End If
  75. VeryEnd:
  76.     
  77. End Sub 'PRSIT
  78.  
  79. Sub Main
  80.     Call PrsIt
  81. End Sub
  82.