gpt4 book ai didi

windows - 如何使用 autoit 在特殊程序中打开文件?

转载 作者:可可西里 更新时间:2023-11-01 10:33:19 26 4
gpt4 key购买 nike

我需要在特殊程序中打开一个文件。比如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()

关于windows - 如何使用 autoit 在特殊程序中打开文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41301324/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com