Создал скрипт AutoIt:
#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
; http://www.autoitscript.com/site/autoit/downloads/
Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Local $sWriteExePath = @WorkingDir & "\write.exe"
If Not FileExists($sWriteExePath) Then
$sWriteExePath = FileOpenDialog("Select the write.exe path", "c:\", "Write (write.exe)", $FD_FILEMUSTEXIST)
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "No write.exe path was selected!")
Exit
EndIf
EndIf
Local $sFilePath = FileSelectFolder("Select the WRI files directory", "c:\")
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "No folder was selected!")
Exit
EndIf
Local $aFileList = _FileListToArray($sFilePath, "*.wri", 1)
If @error = 1 Then
MsgBox($MB_SYSTEMMODAL, "", "Path was invalid!")
Exit
EndIf
If @error = 4 Then
MsgBox($MB_SYSTEMMODAL, "", "No files were found!")
Exit
EndIf
For $i = 1 To $aFileList[0]
Call("WriToTxt", $sWriteExePath, $sFilePath, $aFileList[$i])
Next
Func WriToTxt($writeExe, $dir, $fileName)
Local $pathFrom = $dir & '\' & $fileName
Local $pathTo = StringReplace($pathFrom, ".wri", ".txt", 1)
Local $winName = "Write - " & StringReplace($fileName, ".wri", '')
If Not FileExists($pathTo) Then
Run($writeExe & ' ' & $pathFrom)
WinWaitActive($winName)
Send("!fa")
WinWaitActive("Save As")
Send($pathTo)
ControlSend("Save As", "", "[CLASS:ComboBox; INSTANCE:1]", "Text Files (*.TXT)")
Sleep(1)
ControlClick("Save As", "", "[CLASS:Button; TEXT:OK]")
WinWaitActive("Write", "Do you want to save?", 2)
If WinActive("Write", "Do you want to save?") Then
Send("!y")
EndIf
WinClose($winName)
EndIf
EndFunc
person
janeks malinovskis
schedule
13.01.2014