0 Replies Latest reply on Mar 10, 2008 2:52 PM by (Archie_Tucker)

    DoScript VBScript to VBScript?

    Level 1
      I would like to have serveral common VBScripts that are run by different VBScripts. Would the DoScript command be the correct choice to do this? Below is a script that I'm working on that has several Functions. I would like to put each Function in a separate VBScript. I will have maybe 30 or more scripts that all do the same thing, just the size, quantity and template will change (below is for a N12, will also need N10, N24, etc.) and would like to avoid having each script have the same set of Functions.
      Thanks,
      Archie

      Rem N12 Script

      Rem SCRIPT INFO
      Rem -----------

      Rem Copyright Mindware Corporation Of America
      Rem Author: Archie O Tucker
      Rem Created: 03/03/08
      Rem Revised:

      Dim myInDesign
      Set myInDesign = CreateObject("InDesign.Application.CS3")
      Set myDialog = myInDesign.Dialogs.Add

      Set FileSys = CreateObject("Scripting.FileSystemObject")

      Rem SET VALUES
      Rem ----------
      Dim MountSize
      Dim TemplateFolder

      myMountLetter = "N"
      myMountSize = "12"
      myMountNumber = "8"
      myTextFolder = "E:\sxs\pm65\CA\"
      Rem myTextFolder = "X:\SXS_Test\pm65\CA\"
      myTemplateFolder = "E:\SXS\ID\"
      Rem myTemplateFolder = "X:\SXS_Test\ID\"
      myBatchFolder = "E:\SXS\ID\"
      Rem myBatchFolder = "X:\SXS_Test\ID\"
      myTemplateName = myTemplateFolder + myMountLetter + myMountSize + ".indt"

      Rem DISPLAY DIALOG
      Rem --------------
      myDialog.Name = myMountLetter + myMountSize + " Autobatch "

      Set myDialogColumn = myDialog.DialogColumns.Add
      set myBorderPanel = myDialogColumn.BorderPanels.Add
      set mySubDialogColumn = myBorderPanel.DialogColumns.Add
      Set myBatchNumberLabel = mySubDialogColumn.StaticTexts.Add
      myBatchNumberLabel.StaticLabel = "Batch Number: "
      Set mySubDialogColumn = myBorderPanel.DialogColumns.Add
      Set myBatchNumberField = mySubDialogColumn.TextEditboxes.Add
      myBatchNumberField.EditContents = "65926C" REM *** For Testing ***
      myBatchNumberField.MinWidth = 100

      myResult = myDialog.Show

      If myResult = True Then
      myBatchNumber = myBatchNumberField.EditContents
      myOpenTemplate myDocument, myTemplateName
      myDefineColors myDocument
      myPlaceText myDocument, myTextFolder, myMountSize, MyBatchNumber
      myMakeTextFit myDocument
      myPlaceGraphics myDocument, myMountNumber
      mySaveBatch myInDesign, myBatchFolder, myBatchNumber
      myCloseTemplate myInDesign
      myDialog.Destroy
      Else
      myDialog.Destroy
      myCloseTemplate myInDesign
      End If

      Rem OPEN TEMPLATE
      Rem -------------
      Function myOpenTemplate (myDocument, myTemplateName)

      Set myDocument = myInDesign.Open(myTemplateName, True)

      End Function

      Rem PLACE TEXT FUNCTION
      Rem -------------------
      Function myPlaceText (myDocument, myTextFolder, myMountSize, myBatchNumber)

      Set myTextFrames = myDocument.TextFrames
      Set myFirstFrame = myTextFrames.Item(1)
      myFirstFrame.Place (myTextFolder + myMountSize + "_" + myBatchNumber + ".TXT")

      MsgBox "Ok:"

      End Function

      Rem MAKE TEXT FIT
      Rem -------------
      Function myMakeTextFit (myDocument)

      Set myCurrentFrame = myDocument.TextFrames.Item(1)
      myHorizontalScale = 100
      Do While myCurrentFrame.overflows = true
      myHorizontalScale = myHorizontalScale - 1
      Set myText = myCurrentFrame.Characters.Item(1)
      With myText
      .HorizontalScale = myHorizontalScale
      End With
      Loop

      End Function

      Rem PLACE GRAPHICS
      Rem --------------
      Function myPlaceGraphics (myDocument, myMountNumber)

      For I = 1 to cInt(myMountNumber)
      Rem For I = 4 to myDocument.TextFrames.Count

      Set myCurrentFrame = myDocument.TextFrames.Item(I)
      myCharacterCount = MyCurrentFrame.Characters.Count
      If myCharacterCount > 0 Then
      If left(myCurrentFrame.Texts.Item(1).Contents,7) = "[place=" Then
      myFile = Mid(myCurrentFrame.Texts.Item(1).Contents,8)
      myFile = Split(myFile,"]")(0)' get all to "]"
      Set myGraphic = myDocument.Pages.Item(1).Place (myFile)
      Set myGraphic = myGraphic.Item(1)
      Set myRectangle = myGraphic.Parent
      myGraphicBounds = myRectangle.GeometricBounds
      myGraphicWidth = myG