Запустите программу, когда откроется другая программа

7801
metasequoia

Я хотел бы метод запуска программы, когда другая программа запускается. В частности, я хотел бы открыть документ MS Word и одновременно открыть мой менеджер цитирования (EndNote поддерживает эту функцию в настройках MS Word, но я недавно переключил менеджеры цитирования).

Пакетные сценарии, которые я видел до сих пор, включая этот, не соответствуют требованиям. Я хотел бы иметь возможность открыть любой существующий документ Word на моем диске и запустить вторую программу.

0

1 ответ на вопрос

3
Karan

One possible solution:

1) Create a batch file such as C:\ViewDoc.bat:

@echo off start "Word" "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" %1 start "CiteMan" "Drive:\Path\to\Citation Manager.exe" 

Edit the paths as required.

2) Right-click any .DOC file, click on Open with, browse and select the batch file:

1

Make sure the Always use the selected program to open this kind of file option is checked.

3) Do the same with any .DOCX file.

Now when you double-click to open any document, the batch file will run instead of Word directly. It in turn will launch Word and open the selected document, as well as launch the other program you want.


An alternate way to do this with any .DOCM macro-enabled document is to add the following code via the Developer tab / Visual Basic editor:

Private Sub Document_Open() Shell "Drive:\Path\to\Citation Manager.exe" End Sub 

This will auto-launch the specified program whenever the .DOCM is opened.

Это отвечает всем требованиям. +1 за добавление подхода .DOCM metasequoia 11 лет назад 0