Автоматизация программы по списку
Select messages from
# through # FAQ
[/[Print]\]

Total Commander -> Программное обеспечение

#1: Автоматизация программы по списку Author: Slamzor PostPosted: Fri Jun 14, 2013 20:19
    —
Здравствуйте!

Мне необходима автоматизация процесса.

У меня есть программа, которая в текстовых документах вносит изменения. Работает по следующему принципу - задал ей файлы (можно различными способами) и она работает по принципу найти и заменить. Программа поддерживает открытие нескольких окон.

Пример: В каждом из трех документов(названия файлов разные) есть одинаковый текст "А" и надо заменить этот текст "А" в каждом документе на текст из списка, т.е. в первом документе "А" на "B", во втором "А" на "C", в третьем "А" на "D".
Программа поддерживает работу по спискам. Иначе говоря, можно задать список обрабатываемых файлов и список что найти ("А") и на что заменить ("?"). Так как у меня текст "А" во всех документах, мне необходимо чтобы программа произвела замену константы "А" на некоторое значение из списка для каждого файла в отдельности. То есть взяла первый файл и заменила на первое значение из списка "Найти\заменить", затем второй файл и второе значение из списка и так N количество раз.


Вот что нашел в хелпе к программе на английском:

Code:
WordPipe can be run from a DOS shell or from a shortcut with parameters to make it run automatically. This is very useful for automation and scheduling (by making the short cut an entry in the Start Up folder), and for running WordPipe from a batch file. Here is a complete example:

"C:\Program files\WordPipe\wordpipe.exe" "/f=my replaces.wpp" /G /Q

Note:

Any commands with embedded spaces must be surrounded with double quotes. You must surround the entire command/setting combination e.g. "/f=c:\Program Files\WordPipe\my replacements.wpp" NOT /f="c:\Program Files\WordPipe\my replacements.wpp"
Windows limits the command line length to about 260 characters. You can overcome this limitation by using the /Z=<filename> command to load command line parameters stored in a file. Note that you MUST remove any double quotes from around commands with embedded spaces when you put them in the command file.
Conventions used below:

<> surrounds text that is to be entered. Do NOT enter the '<' and '>' characters

Alternatives are shown in square brackets '[' and ']' with a pipe '|' character between them. Do NOT enter the square brackets or the pipe character - just type the single alternative you require.

Usage:

"C:\Program files\WordPipe\wordpipe.exe" [/MINIMIZED|/MAXIMIZED] ["/F=my replaces.wpp"] [commands] [/G [/Q]]
Where [commands] is zero or more of:

/F=<.wpp filename> Opens a WordPipe settings file. 
/REPORT=<report filename> At the conclusion of the job, a text file report is written to the given filename. The /REPORT parameter must be after any /F command and before the /G command.
/G Go. Begin processing replacements with WordPipe. Processing of the command line does not continue until the processing job is complete.
/GS Same as /G, but search only mode.
/I=<filename> Imports a search/replace list from Excel, Tab or CSV-delimited file, and adds it to the end of the grid. The current options settings are used for each row added.
/MAXIMIZED Opens the application maximized.
/MINIMIZED Opens the application minimized.
/Q Quit WordPipe at the end of processing. The current settings are not saved.
/Z=<filename> Read command line parameters from the specified file. Very useful for performing large numbers of changes, or for working around the Windows limitation of approx 260 characters on the command line.
For example, if you had the long command line

start /w wordpipe.exe "/f=my special filter.wpp" /g "/f=my special filter2.wpp" /g "/f=my special filter3.wpp" /g "/f=my special filter4.wpp" /g /q

This would change to something like

start /w wordpipe.exe /z=commands.txt

and the file commands.txt would contain

/f=my special filter.wpp
/g
/f=my special filter2.wpp
/g
/f=my special filter3.wpp
/g
/f=my special filter4.wpp
/g
/q
 



Написал разработчикам, ответили что можно из командной строки, но вот как - не сказали ...
Их ответ:
Quote:
No, you'd need 2 separate runs. You can automate this from the command line if you need to.


Можно как то уточнить, как из командной строки заставить программу произвести данные действия?

#2:  Author: FlasherLocation: Москва PostPosted: Sat Jun 15, 2013 09:46
    —
А зачем в ПО? С выделенными в панели файлами разве не надо работать?
Темы по поиску/замене имеются.

#3:  Author: Slamzor PostPosted: Sat Jun 15, 2013 17:24
    —
Видимо Вы не совсем правильно меня поняли. Программа правит текст внутри фалов (МС ВОРД). Если бы текст был разный я бы все поменял за раз. НО! У меня один текст во всех файлах и функционал программы не позволяет выбирать замены для каждого файла в отдельности. Она перебирает файлы по списку1 и заменяет все (внутри тела) что нашлось в списке2.

#4:  Author: FlasherLocation: Москва PostPosted: Sat Jun 15, 2013 18:06
    —
Я как раз всё правильно понял, кроме того, что это файлы MS Word, о чём в первом посте не сообщалось. Замену можно делать и без указанной утилиты. Но мои вопросы другого касались.

#5:  Author: Slamzor PostPosted: Sat Jun 15, 2013 22:37
    —
Утилит много, но эта одна из лучших. А если поподробней - про возможность проделать это без этой программы...

#6:  Author: FlasherLocation: Москва PostPosted: Sun Jun 16, 2013 01:18
    —
На VBSсript, например.
Можно сделать обработку в цикле двух списков. Но про первый так и не получил ответ.

#7:  Author: Slamzor PostPosted: Sun Jun 16, 2013 12:41
    —
Ответ на Вопрос про работу на панели с файлами - у меня есть файл в котором часть имени файлов, создаю маску в списках ипрограмма сама отбирает файлы в которые вносить те или инные изменения

#8:  Author: FlasherLocation: Москва PostPosted: Sun Jun 16, 2013 16:00
    —
Можно искать файлы по списку масок в ТС.
А маски сложные? Или только со звёздочками?



Total Commander -> Программное обеспечение


output generated using printer-friendly topic mod. All times are GMT + 4 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group