Highlight All Files within a Folder in Standard Windows Open File Dialog
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Highlight All Files within a Folder in Standard Windows Open File Dialog
Our application launches a standard windows open file dialog popup. However, we load ALL the files within a folder so I cannot use TC's OpenFile() method. Trying to use a combo of namemapped objects & Keys() is not working reliably. The biggest problem appears to be trying to use Keys() to type in the path to the directory textfield. And that Windows object does not have any SetText-style methods. Any suggestions?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Open File dialog accepts multiple file names as a space-separated list of quoted items:
"C:\MyFile1.txt" "C:\MyFile2.txt"
OpenFile() sets the dialog's file name input as is, so you can try the following:
// JavaScript/JScript dlgOpen.OpenFile("\"C:\\MyFile1.txt\" \"C:\\MyFile2.txt\"");
Alternatively, you can use the Ctrl+A shortcut to select all files in the Open dialog:
var strFolder = "C:\\MyFolder\\Subfolder\\"; var dlgOpen = ...;
// Navigate to the folder var fileInput = dlgOpen.Window("ComboBoxEx32").FindChild("WndClass", "Edit", 2); fileInput.SetText(strFolder); fileInput.Keys("[Enter]");
// Select all files & open dlgOpen.FindChild("WndClass", "SHELLDLL_DefView", 5).Keys("^a"); dlgOpen.Window("Button", "&Open").Click();
This was tested on Windows 7. Other Windows versions can have different object names for the Open dialog elements, so adjust accordingly.
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> OpenFile() sets the dialog's file name input as is
Wow, this is not documented - help talks just about single file.
Helen, could you please ask your guys to expand help topic for the OpenFile() method with your piece of advise?
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AlexKaras, this is really more of a hack / unintended side effect, so I'd rather have the info just here and not in the official docs.
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I see. Thank you, Helen.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
