[office]获取本机office可执行文件路径

获取本机office可执行文件路径

使用方法:执行脚本,按下`+1是word.exe的路径,`+2是excel.exe的路径,`+3是ppt.exe的路径。

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


getofficeexe(z){ ;获取本机office可执行文件的路径 
prg:=Object(1,"C:\Program Files",2,"C:\Program Files (x86)",3,"C:\Program Files",4,"C:\Program Files (x86)")
ver:=Object(1,16,2,15,3,14,4,12,5,11)
officeexe:=Object(1,"WINWORD.EXE",2,"Excel.exe",3,"POWERPNT.EXE")
for i,v in prg
	for m,n in ver
		for o,x in officeexe
			IfExist, %v%\Microsoft Office\OFFice%n%\%x%
		{
			if(o=z)
			return v "\Microsoft Office\Office" n "\" x
		}
}

` & 1::MsgBox % getofficeexe(1)  ;word.exe路径
` & 2::MsgBox % getofficeexe(2)  ;excel.exe路径
` & 3::MsgBox % getofficeexe(3)  ;ppt.exe路径

 

人已赞赏
AHKV1

连点器,26个字母全部都连点怎么样。真不用写500行以上

2017-10-28 14:24:22

AHKV1

[图像]获取图片实际尺寸

2017-10-29 19:03:19

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索