@@ -649,20 +649,56 @@ hyf_onekeyHide() {
649
649
650
650
hyf_getDocumentPath (winTitle:="" ) { ;获取当前窗口编辑文档的路径
651
651
exeName := StrLower(WinGetProcessName(winTitle))
652
- if (exeName == " gvim.exe" || exeName == " iThought.exe" )
653
- return WinGetTitle (winTitle)
654
- else if (exeName == " excel.exe" )
655
- return ox().ActiveWorkbook.fullname
656
- else if (exeName == " winword.exe" )
657
- return ComObjActive (" Word.application" ).ActiveDocument.fullname
658
- else if (exeName == " powerpnt.exe" )
659
- return ComObjActive (" Powerpoint.application" ).ActivePresentation.fullname
660
- else if (RegExMatch (substr (getCommandLine(winTitle), 4 ), " [a-zA-Z]:[^:]+$" , & m))
661
- return m[0 ]
652
+ exeName := RegExReplace (exeName, " \.exe$" )
653
+ switch exeName {
654
+ case " gvim" : return WinGetTitle (winTitle)
655
+ case " ithought" : return WinGetTitle (winTitle)
656
+ case " excel" : return ox().ActiveWorkbook.fullname
657
+ case " winword" : return ComObjActive (" Word.application" ).ActiveDocument.fullname
658
+ case " powerpnt" : return ComObjActive (" Powerpoint.application" ).ActivePresentation.fullname
659
+ case " hh.exe" : return getDocPathOfHH(winTitle)
660
+ default :
661
+ if (RegExMatch (substr (getCommandLine(winTitle), 4 ), " [a-zA-Z]:[^:]+$" , & m))
662
+ return m[0 ]
663
+ }
662
664
getCommandLine (winTitle:="" ) {
663
665
for item in ComObjGet (" winmgmts:" ).ExecQuery(format (" Select * from Win32_Process where ProcessId={1}" , WinGetPID(winTitle)))
664
666
return item.CommandLine
665
667
}
668
+ ; comcall 简化了下面3行
669
+ ; if !dllcall(numget(numget(0,pobj,"UPtr"), 0, "UPtr"), "Ptr",pobj, "Ptr",PID, "Ptr*",&psp:=0)
670
+ ; && !dllcall(numget(numget(0,psp,"UPtr"),A_PtrSize*3,"UPtr"), "Ptr",psp, "Ptr",Query_Guid4String(&SID,SID), "Ptr",IID=="!"?SID:Query_Guid4String(&IID,IID), "Ptr*",&pobj:=0) {
671
+ ; dllcall(numget(numget(0,psp,"UPtr"),A_PtrSize*2,"UPtr"), "Ptr",psp)
672
+ getDocPathOfHH (winTitle:="" ) {
673
+ ctl := ControlGetHwnd(" Internet Explorer_Server1" , winTitle)
674
+ dllcall (" LoadLibrary" , " Str" ," oleacc" , " Ptr" )
675
+ numput ('int64',0x11CF3C3D618736E0 , 'int64',0x719B3800AA000C81 , IID:=buffer(16 ))
676
+ if (! dllcall (" oleacc\AccessibleObjectFromWindow" , " ptr" ,ctl, " uint" ,0 , " ptr" ,IID, " ptr*" ,& pacc:=0 )) {
677
+ accWin := ComValue(9 , pacc, 1 )
678
+ chmPath := Query_Service(accWin, " {332C4427-26CB-11D0-B483-00C04FD90119}" ).document.url
679
+ chmPath := RegExReplace (chmPath, " im)mk\:\@MSITStore\:(.*)\:\:.*$" , " $1" )
680
+ chmPath := StrReplace (chmPath, " %20" , " " )
681
+ return chmPath
682
+ }
683
+ ; 没单独放起来,可能有重复
684
+ Query_Service (pobj, SID, IID:="!", bRaw:="" ) {
685
+ if (isobject (pobj))
686
+ pobj := ComObjValue (pobj)
687
+ numput ('int64',0x11CE74366D5140C1 , 'int64',0xFA096000AA003480 , pid:=buffer(16 ))
688
+ res0 := comcall(0 , pobj, " Ptr" ,pid, " Ptr*" ,& psp:=0 )
689
+ res3 := comcall(3 , psp, " Ptr" ,Query_Guid4String(& SID, SID), " Ptr" ,IID==" !" ?SID:Query_Guid4String(& IID,IID), " Ptr*" ,& pobj:=0 )
690
+ if (! res0 && ! res3 || ObjRelease(psp)) {
691
+ if (bRaw)
692
+ return pobj
693
+ else
694
+ return ComValue(9 , pobj, 1 )
695
+ }
696
+ }
697
+ Query_Guid4String (&GUID, sz:="" ) {
698
+ dllcall (" ole32\CLSIDFromString" , " WStr" ,sz?sz:sz=="" ?" {00020400-0000-0000-C000-000000000046}" :" {00000000-0000-0000-C000-000000000046}" , " Ptr" ,GUID:=buffer(16 ,0 ))
699
+ return GUID
700
+ }
701
+ }
666
702
}
667
703
668
704
; funHwnd 处理 winHwnd 为 true 则添加
0 commit comments