Guest
Public paste!

Nick F0x

By: a guest | Feb 4th, 2010 | Syntax: AutoIt | Size: 2.36 KB | Hits: 364 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. $dir = IniRead("odt2any.ini", "Main", "OO", "OpenOffice.org 3")
  2. $ext = IniRead("odt2any.ini", "Main", "ext", "doc")
  3. $int = IniRead("odt2any.ini", "Main", "int", "odt")
  4. $del = IniRead("odt2any.ini", "Main", "delete", "0")
  5. If $CmdLine[0] = 0  Then
  6.         $Dir2Convert = @ScriptDir
  7.         $Dir2Convert = $CmdLine[1]
  8.         If StringRight($Dir2Convert,1) = "\" Then $Dir2Convert = StringTrimRight ($Dir2Convert, 1)
  9.  
  10. ; MsgBox(4096, "Result", $dir & $ext)
  11. $command = '"' & @ProgramFilesDir & '\' & $dir &'\program\soffice.exe" -accept="socket,port=8100;urp;"'
  12. ProcessWait("soffice.bin")
  13.  
  14. ; Shows the filenames of all files in the current directory
  15. $search = FileFindFirstFile($Dir2Convert & "\*." & $int)
  16.  
  17. ; Check if the search was successful
  18. If $search = -1 Then
  19.     MsgBox(0, "Error", "No files/directories matched the search pattern")
  20.     Exit
  21. $count = 0
  22.         $file = FileFindNextFile($search)
  23.         $count = $count + 1
  24.         TrayTip ("Обрабатывается:", $file, 5, 1)
  25.  
  26.         $newname = StringReplace($file, $int, $ext)
  27.         $command = '"' & @ProgramFilesDir & '\' & $dir &'\program\python.exe" DocumentConverter.py "'  & $Dir2Convert & '\' & $file & '" "' & $Dir2Convert & '\' & $newname & '"'
  28.         Run ($command,@ScriptDir,@SW_MINIMIZE)
  29.         ProcessWaitClose("python.exe")
  30.         $time_file = FileSetTime($Dir2Convert & "\" & $newname, FileGetTime ($Dir2Convert & "\" & $file, 0, 1), 0)
  31.         $time_file = FileSetTime($Dir2Convert & "\" & $newname, FileGetTime ($Dir2Convert & "\" & $file, 1, 1), 1)
  32.         $time_file = FileSetTime($Dir2Convert & "\" & $newname, FileGetTime ($Dir2Convert & "\" & $file, 2, 1), 2)
  33.  
  34.         If $del = 1 Then
  35.                 FileDelete ($Dir2Convert & "\" & $file)
  36. ;               TrayTip ("Удаляется:", $file, 5, 1)
  37.         EndIf
  38. ; MsgBox(4096, "File:", $file)
  39.  
  40.  
  41.  
  42. ; Close the search handle
  43. FileClose($search)
  44.  
  45. TrayTip ("Завершено:", "Конвертировано: " & $count, 5, 1)
  46. ; MsgBox(4096, "Завершение", "Конвертировано: " & $count)