Hi David,

    You can monitor or setup the window you want to capture for this. Of 
course you can monitor only events inside the Windows Explorer but you will 
need these 2 routines in what every way you wish to write it.

Now, the Active Window object will have the title on the page which will be 
the path to the file selected.
    Then you get the focus even and capture what you want, or set up an 
event to do it automatically for you.
    The 2 things you would want but only one is necessary, the name of the 
focused object which of course is the full file name.

    Then you can append that name onto the Window Title you have gotten from 
the Active Window. this assumes your window explorer displays the entire 
path for you.

    Thus you have the file name you selected, which of course can be another 
hotkey all together

    You can activate the explorer window you are in, select the file and 
store it. Then inactivate that explorer window. You could store that file in 
a dictionary or what ever you plan to do with it.
    Yes, of course there is a technique to store this selection in the Right 
Double clicked display.

'Global Variables:
Dim oActiveWindow:  set oActiveWindow = Nothing
Dim   oActiveChildren: Set oActiveChildren = Nothing
Dim myMSAAEvents: Set myMSAAEvents = Nothing
' First allow the customize of which MSAA events to watch
Dim myMSAAEvents: Set myMSAAEvents = msaaEventSource
' Also allow saving the connection for disconnect on shut down.
Dim myMSAAConnection: myMSAAConnection = 0

this is a hotkey that activates the window you are presently in:
Sub Activate_Read()
 ' Activates the monitoring of the window you are in.
 If myMSAAConnection = 0 Then
  set oActiveWindow = activeWindow.overlap
  Set oActiveChildren = oActiveWindow.children
  ' Filter MSAA events for only this process
  myMSAAEvents.Process = oActiveWindow.Process
  On Error GoTo 0
  ' handle all MSAA event types
  myMSAAConnection = ConnectObject( myMSAAEvents, "myMSAA_")
'Note: That the event ended with an underline
'so any proc having that same preName will be called.
  Silence
  Speak " Window Monitoring Is Turned On! "
  Speak " Window Name: " & oActiveWindow.Name
  Speak " Window Title: " & oActiveWindow.Title
  Speak " Window Module: " & oActiveWindow.ModuleName
 Else
  Disconnect myMSAAConnection
  myMSAAConnection = 0
  On Error Resume Next
  Set oActiveWindow = Nothing
  Silence
  Speak " Window Monitoring Is Shut Off! "
 End If
End Sub

Sub myMSAA_OnObjectFocus( oWin)
' event handler
' called when MSAA signals some text is focused.
 Speak " Focus event "
 Dim oWeb, oWindow, Fx
 On Error Resume Next
 If Not oWin Is Nothing Then
  Dim oRole: Set oRole = oWin.Role
  Dim oState: Set oState = oWin.State
  Speak " Focus name: {" & oWin.Name & "} "
  Speak " Child ID: [" & oWin.ChildID & "] "
  Speak " Focus Title: [" & oActiveWindow.Title & "] "
'  Speak " Value: " & oFocus.Value
  If Not oRole Is Nothing Then
   Speak " Role Text: " & oRole.Text
'   Speak " Role is: " & oRole.Text
  End If
  If Not oState Is Nothing Then
'   Speak oState.Text
   Speak " State is: " & oState.Text
  End If
  Set oRole = Nothing
  Set oState = Nothing
  Set oWindow = Nothing
End Sub


Sent: Tuesday, March 29, 2016 12:30 PM
Subject: Getting the filename from Windows Explorer


Maybe a dumb question here, but is there a way in my app, to "See" which
file has focus, when scrolling the folders under Windows Explorer? that
is, you search your disk the normal way with your arrows, in Explorer.
Coming to a file of interest, you hit a hotkey, and the app will
retrieve the filename you are focusing, and proceed with its internal
operation, with that filename in mind.

Don't know if there is any way to do this. Maybe through some kind of
Com-object. Hoped that someone out there have been dealing with this
kind of a scenario earlier.

Thanks all,

-- 
David


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
Any views or opinions presented in this email are solely those of the author 
and do not necessarily represent those of Ai Squared.

For membership options, visit 
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com.
For subscription options, visit 
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at 
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com

Reply via email to