Mil*_*oDC 10 windows ftp windows-explorer
当我使用 Windows 资源管理器浏览 FTP 站点时,它默认为平铺视图。我需要它默认为列表视图。
我没有看到注册表设置,并且标准的 [工具 -> 文件夹选项... -> 查看 -> 应用于文件夹] 显然对 FTP 站点没有影响。
我写这个是为了使用 Autoit 来做到这一点:只需运行脚本,您的 ftp 资源管理器窗口在第一次查看时应该处于列表视图中。它还不完美,但它具有您想要的基本功能。还需要我在这里找到的库。
在 Windows 7 64 位上测试。
#include "Automating Windows Explorer\Includes\AutomatingWindowsExplorer.au3" ;UDF
#include <Array.au3>
Local $str = "Address: ftp" ;part of visible text in explorer control, unique to ftp, I think...
Local $CheckedWindows[5] ;Keep track of activated windows because I don't have a shell hook for window.created
Local $hExplorer
while 1
Sleep(2000)
$hExplorer = WinWaitActive("[CLASS:CabinetWClass]", $str)
If not ContainsElement($CheckedWindows,$hExplorer) then ;Only trigger on a *new* window
setFTPview($str,$hExplorer)
_ArrayAdd($CheckedWindows,$hExplorer)
EndIf
;delete unused handles to prevent aliases or large array, but I don't know the shell hook for window.closed
;alternative is to periodically loop through existing windows and delete non-existing handles (todo)
WEnd
func ContainsElement($arr,$el)
Local $Bound = UBound($arr)
For $i=0 to ($Bound -1)
If $arr[$i] == $el then return True
Next
return False
Endfunc
func setFTPview($str,$hExplorer)
GetIShellBrowser( $hExplorer )
If Not IsObj( $oIShellBrowser ) Then
MsgBox( 0, "Automating Windows Explorer", "Could not get an IShellBrowser interface. Terminating." )
Return
EndIf
GetShellInterfaces() ; Get other interfaces, might not be needed
SetIconView($FVM_LIST)
Sleep(1000)
endfunc
Run Code Online (Sandbox Code Playgroud)
附录:您可能需要将“AutomatingWindowsExplorer.au3”的第 257 行从 更改If @OSVersion "WIN_XP" Then为If @OSVersion <> "WIN_XP" Then