Wednesday 14 March 2018

VBS: Select item in Windows Explorer last active window

I use the following code to select a file in a Windows Explorer window:


Set objShellAPP = CreateObject("Shell.Application")
objShellAPP.Open(WScript.Arguments(0))
WScript.Sleep(300)

On Error Resume Next ' For new unsaved files.
With objShellAPP.Windows(objShellAPP.Windows.Count - 1).document
.SelectItem .Folder.Items.Item(WScript.Arguments(1)), 29
End With

Set objShellAPP = Nothing

objShellAPP.Open() opens the folder in the last active window;


objShellAPP.Windows.Count - 1 is not necessarily that window.


How can I get the last active window for the With objShellAPP.Windows(---).document line?


Thank you.




See:


Open and Select a file in an existing Explorer window


VBS: Select one file in a folder

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...