Advertisement
AZJIO

Компилировать CHM

Apr 1st, 2017
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.95 KB | None | 0 0
  1. Local $hFile, $sText, $name
  2.  
  3. $name = 'Project'
  4.  
  5. If MsgBox(4 + 48,  'Предупреждение', 'Компилировать?') = 7 Then Exit
  6. $sFile = @ScriptDir & '\' & $name & '.hhp'
  7.  
  8. Switch @OSArch
  9.     Case "X64", "IA64"
  10.         $sPath = @HomeDrive & 'Program Files (x86)\HTML Help Workshop\hhc.exe'
  11.     Case Else
  12.         $sPath = @ProgramFilesDir & '\HTML Help Workshop\hhc.exe'
  13. EndSwitch
  14.  
  15. If Not FileExists($sPath) Then
  16.     MsgBox(0,  'Предупреждение', 'Не найден  путь: ' & $sPath)
  17.     Exit
  18. EndIf
  19.  
  20. FileMove(@ScriptDir & '\' & $name & '.chm', @ScriptDir & '\' & $name & '_1.chm', 9)
  21. If ProcessExists("hh.exe") Then ProcessClose("hh.exe") ; закрывает процесс, недающий компилировать CHM
  22.  
  23.  
  24. $sText= _
  25. @CRLF & _
  26. '[OPTIONS]' & @CRLF & _
  27. 'Compatibility=1.1 or later' & @CRLF & _
  28. 'Compiled file=' & $name & '.chm' & @CRLF & _
  29. 'Contents file=' & $name & '_TOC.hhc' & @CRLF & _
  30. 'Default Window=Help Window' & @CRLF & _
  31. 'Default topic=html\index.htm' & @CRLF & _
  32. 'Display compile progress=Yes' & @CRLF & _
  33. 'Enhanced decompilation=Yes' & @CRLF & _
  34. 'Error log file=_errorlog.txt' & @CRLF & _
  35. 'Full-text search=Yes' & @CRLF & _
  36. 'Index file=' & $name & '_Index.hhk' & @CRLF & _
  37. 'Language=0x419' & @CRLF & _
  38. 'Title=Проект (' & @MDAY & '.' & @MON & '.' & @YEAR & ')' & @CRLF & _
  39. @CRLF & _
  40. '[WINDOWS]' & @CRLF & _
  41. 'Help Window="Проект  (' & @MDAY & '.' & @MON & '.' & @YEAR & ')","' & $name & '_TOC.hhc","' & $name & '_Index.hhk","html\index.htm",,,,,,0x63520,,0x10000c,[0,0,1024,768],0x80000,,,,,,0' & @CRLF & _
  42. @CRLF & _
  43. '[INFOTYPES]' & @CRLF
  44.  
  45. $hFile = FileOpen($sFile, 2)
  46. FileWrite($hFile, $sText)
  47. FileClose($hFile)
  48.  
  49. RunWait($sPath & ' "' & $sFile & '"', @ScriptDir, @SW_HIDE)
  50. FileDelete(@ScriptDir & '\' & $name & '_1.chm')
  51. ; ShellExecute(@ScriptDir & '\' & $name & '.chm', "", @ScriptDir, "open")
  52. Run('hh.exe "' & @ScriptDir & '\' & $name & '.chm"')
  53.  
  54. ; MsgBox(0, '', 'Готово!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement