<commit_before>' See http://msdn2.microsoft.com/en-us/library/bb238158.aspx
Const wdFormatPDF = 17  ' PDF format.
Const wdFormatXPS = 18  ' XPS format.

Const WdDoNotSaveChanges = 0

Dim arguments
Set arguments = WScript.Arguments

' Make sure that there are one or two arguments
Function CheckUserArguments()
  If arguments.Unnamed.Count < 1 Or arguments.Unnamed.Count > 2 Then
    WScript.Quit -1
  End If
End Function


' Transforms a doc to a pdf
Function DocToPdf( docInputFile, pdfOutputFile )

  Dim fileSystemObject
  Dim wordApplication
  Dim wordDocument
  Dim wordDocuments
  Dim baseFolder

  ' Get existing instance of word
  Set wordApplication = GetObject(, "Word.Application")
  Set wordDocuments = wordApplication.Documents

  ' Find files
  Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
  docInputFile = fileSystemObject.GetAbsolutePathName(docInputFile)
  baseFolder = fileSystemObject.GetParentFolderName(docInputFile)

  ' Open word document
  Set wordDocument = wordDocuments.Open(docInputFile, false, true, false)

  ' Convert: See http://msdn2.microsoft.com/en-us/library/bb221597.aspx
  wordDocument.SaveAs pdfOutputFile, wdFormatPDF

  ' Close word document
  wordDocument.Close WdDoNotSaveChanges

  ' Free local resources
  Set fileSystemObject = Nothing
  Set wordApplication = Nothing
  Set wordDocument = Nothing
  Set wordDocuments = Nothing
  Set baseFolder = Nothing

End Function

' Execute script
Call CheckUserArguments()
If arguments.Unnamed.Count = 2 Then
 Call DocToPdf( arguments.Unnamed.Item(0), arguments.Unnamed.Item(1) )
Else
 Call DocToPdf( arguments.Unnamed.Item(0), "" )
End If

' Free local resources and quit
Set arguments = Nothing
WScript.Quit 0<commit_msg>Removed unused variable.<commit_after>' See http://msdn2.microsoft.com/en-us/library/bb238158.aspx
Const wdFormatPDF = 17  ' PDF format.
Const wdFormatXPS = 18  ' XPS format.

Const WdDoNotSaveChanges = 0

Dim arguments
Set arguments = WScript.Arguments

' Make sure that there are one or two arguments
Function CheckUserArguments()
  If arguments.Unnamed.Count < 1 Or arguments.Unnamed.Count > 2 Then
    WScript.Quit -1
  End If
End Function


' Transforms a doc to a pdf
Function DocToPdf( docInputFile, pdfOutputFile )

  Dim fileSystemObject
  Dim wordApplication
  Dim wordDocument
  Dim wordDocuments

  ' Get existing instance of word
  Set wordApplication = GetObject(, "Word.Application")
  Set wordDocuments = wordApplication.Documents

  ' Find files
  Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
  docInputFile = fileSystemObject.GetAbsolutePathName(docInputFile)

  ' Open word document
  Set wordDocument = wordDocuments.Open(docInputFile, false, true, false)

  ' Convert: See http://msdn2.microsoft.com/en-us/library/bb221597.aspx
  wordDocument.SaveAs pdfOutputFile, wdFormatPDF

  ' Close word document
  wordDocument.Close WdDoNotSaveChanges

  ' Free local resources
  Set fileSystemObject = Nothing
  Set wordApplication = Nothing
  Set wordDocument = Nothing
  Set wordDocuments = Nothing

End Function

' Execute script
Call CheckUserArguments()
If arguments.Unnamed.Count = 2 Then
 Call DocToPdf( arguments.Unnamed.Item(0), arguments.Unnamed.Item(1) )
Else
 Call DocToPdf( arguments.Unnamed.Item(0), "" )
End If

' Free local resources and quit
Set arguments = Nothing
WScript.Quit 0
{'fraction_non_alphanumeric': 0.0714498362607919, 'fraction_numerical': 0.016076213158678177, 'mean_word_length': 4.5813953488372094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3011726', 'n_tokens_mistral': 1052, 'n_tokens_neox': 983, 'n_words': 302}