本帖最后由 wants 于 2014-10-31 14:43 编辑
自己整了一下,貌似达到了自己想要的效果,需将文件添加到右键的发送到才有效果,在XP和WIN7下试了都可以,可多选发送。#Region ;**** 参数创建于 ACNWrapper_GUI ****
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
; Windows Explorer on XP, Vista, 7, 8
;$hExplorer = WinGetHandle( "[REGEXPCLASS:Progman]" )
$hExplorer = WinGetHandle( "[REGEXPCLASS:^(Cabinet|Explore)WClass$]" )
GetFocusedFullPath()
Func opendir()
$oShell = ObjCreate( "Shell.Application" )
; Find window
For $oWindow In $oShell.Windows()
If $oWindow.HWND() = $hExplorer Then ExitLoop
Next
For $oItem In $oWindow.Document.SelectedItems()
;ConsoleWrite( $oItem.Path() & @CRLF )
If $oItem.Path()<>"" Then
MsgBox(0, "1",$oItem.Path())
;FileWrite ( "www.ini", $oItem.Path())
EndIf
Next
; Selected items
EndFunc
Func GetFocusedFullPath()
$ListViewHWnd = ControlGetHandle("", "", "SysListView32")
$ItemSelectedId = ControlListView("", "", $ListViewHWnd, "GetSelected",1)
$dz1 = StringSplit($ItemSelectedId, "|", 1)
If $dz1[0] >=1 Then
For $t = 1 To $dz1[0]
$ItemText = ControlListView("", "", $ListViewHWnd, "GetText", $dz1[$t])
$Path = ControlGetText("", "", "Edit1")
If $ItemText<>"" And $path<>"" Then
opendir()
ExitLoop
ElseIf $ItemText<>"" Then
If StringInStr(StringRight($ItemText, 4),".")=0 Then
$kzm=".*"
Else
$kzm=""
EndIf
$search = FileFindFirstFile( @DesktopDir &""&$ItemText&$kzm)
$file = FileFindNextFile($search)
;MsgBox(0, "2", @DesktopDir &""& $file)
FileWrite ( "www.ini", @DesktopDir &""& $file&@CRLF)
Else
opendir()
EndIf
Next
EndIf
EndFunc ;==>GetFocusedFullPath
。 |