Forum Discussion
AlexeyKolosov
Staff
15 years agoHi Michael,
Here is the script that demonstrates how to open each file from the 'C:\MyFiles' folder via the Open dialog invoked from Notepad. Before running the script, launch Notepad:
Sub OpeningAllFilesInFolder
Dim notepad, wndNotepad, strDesktop
FolPath = "C:\MyFiles"
FilesNum = aqFileSystem.GetFolderInfo(FolPath).Files.Count
Set FileItems = aqFileSystem.GetFolderInfo(FolPath).Files
Set notepad = Sys.Process("notepad")
Set wndNotepad = notepad.Window("Notepad")
For i = 0 to FilesNum-1
wndNotepad.MainMenu.Click("File|Open...")
notepad.Window("#32770", "Open").OpenFile(FolPath & "\" & FileItems.Item(i).Name)
Next
End Sub