如何使用 autoit 在特殊程序中打开文件?
How to openfile in special program using autoit?
我需要在特殊程序中打开一个文件。比如office word需要打开*.docx文件
我想出了如何 运行 办公室
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 ;==>
如何打开文件?
对于 Word 文档,只需将文档名称作为命令行参数传递
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 ;==>
或使用 ShellExecute()
我需要在特殊程序中打开一个文件。比如office word需要打开*.docx文件
我想出了如何 运行 办公室
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 ;==>
如何打开文件?
对于 Word 文档,只需将文档名称作为命令行参数传递
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 ;==>
或使用 ShellExecute()