【问题标题】:How to get starting time of a File Explorer window?如何获取文件资源管理器窗口的开始时间?
【发布时间】:2018-10-19 00:24:30
【问题描述】:

我正在构建 Autohotkey 脚本以备份打开的文件资源管理器窗口列表。
我正在寻找一种方法来获取每个窗口的开始时间(我打开窗口的时间)

我有这个功能:

list_opened_folders(byref file_explorer_windows) {
  ; file_explorer_windows := [] ; array of file_explorer_windows

  for window in ComObjCreate("Shell.Application").Windows {
    file_explorer_windows[a_index] := {}
    file_explorer_windows[a_index].path := window.Document.Folder.Self.Path
    file_explorer_windows[a_index].id := window.HWND
    file_explorer_windows[a_index].started_time := window.Document.Folder.Self.Time ; Line I'm trying to add (I know this is invalid but to illustrate my idea)
  }
}

【问题讨论】:

  • 可以在here at MSDN找到可用信息列表。
  • @KenWhite 我看到它不可用。不管怎么说,还是要谢谢你。可能我需要尝试另一种方法,Autohotkey 本身会记录每个窗口的打开时间。

标签: windows shell com autohotkey


【解决方案1】:

试试:

#Persistent
DetectHiddenWindows, On 
SetTitleMatchMode, 2

file_explorer_windows := {}

SetTimer, GetExplorer, 100

GetExplorer:

    Process, Exist, Explorer.exe
    If ErrorLevel 
    {

        for window in ComObjCreate("Shell.Application").Windows { 
            if (file_explorer_windows[window.HWND]["id"] == "") {
                file_explorer_windows[window.HWND] := {id: window.HWND
                                                     , path: window.Document.Folder.Self.Path
                                                     , start: A_NowUTC}
            }
      }
    }
Return

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多