2016-12-23 3 views
2

Ich muss eine Datei in einem speziellen Programm öffnen. Zum Beispiel muss ich * .docx-Datei öffnen, wenn Bürowort.Wie öffnet man Datei im speziellen Programm mit Autoit?

Ich habe herausgefunden, wie Büro

Example() 

Func Example() 
    ; Run Notepad with the window maximized. 
    Local $iPID = Run("C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.EXE", "", @SW_SHOWMAXIMIZED) 

    ; Wait 10 seconds for the Notepad window to appear. 
    WinWait("[CLASS:winword]", "", 5) 

    ; Wait for 2 seconds. 
    Sleep(2000) 

    ; Close the Notepad process using the PID returned by Run. 
    ProcessClose($iPID) 
EndFunc ;==> 

So öffnen Sie die Datei laufen zu lassen?

Antwort

1

Für Word-Dokumente, geben Sie einfach den Namen des Dokuments als Argument Befehlszeile

Example() 

Func Example() 
    ; Run Notepad with the window maximized. 
    Local $iPID = Run("C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.EXE" & " " & "path_to_document", "", @SW_SHOWMAXIMIZED) 

    ; Wait 10 seconds for the Notepad window to appear. 
    WinWait("[CLASS:winword]", "", 5) 

    ; Wait for 2 seconds. 
    Sleep(2000) 

    ; Close the Notepad process using the PID returned by Run. 
    ProcessClose($iPID) 
EndFunc ;==> 

Oder nutzen Sie ShellExecute()

Verwandte Themen