質問

Is it possible to get the file type using the UI Automation ?

In a folder if i have multiple files with same name but different extensions, and I have to select a file using the screen co-ordinates. We get the IUIAutomationElement, and can get only the file names and in case user has not selected the settings "Show file extensions" in the windows, then i am not able to distinguish between the files.

Was also thinking if i could trace it through the help text/tool tip. But not sure how to get the handle for tooltip in UI Automation.

I saw similar old thread, but no answer to it.. UI Automation / Retrieve File Extension

Thanks in Advance..

役に立ちましたか?

解決

there are several ways to do that:


a. change the Show File Extensions through the UI by using the UIA Framework

  • -Not Recommended-

b. retrieve the Folder Path through the UIA or any other way and then through the File Class, call the Method File.GetFiles and then Path.GetExtension to get the extension of each file.

  • -Recommended

他のヒント

No. UI Automation shows what's currently available on screen. You should be using IShellFolder or other shell APIs.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top