02-22-2012, 10:15 PM
Code:
' assume that folder1, folder2, folder3, folder4, folder5 are the five folders located in the root folder c:\folder
' option1, option2, option3, option4, option5 are the corresponding options for above folders
' replace your root folder
rootfolder="c:\Folder"
set oFS = CreateObject("Scripting.FileSystemObject")
' replace the below code with your application specific code from you get option
selectedoption=inputbox("enter option as option1 or option2 or option3 or option4 or option5")
Set folderoption = CreateObject("Scripting.Dictionary")
' replace options and folder name as per your need
folderoption.Add "option1", "folder1"
folderoption.Add "option2", "folder2"
folderoption.Add "option3", "folder3"
folderoption.Add "option4", "folder4"
folderoption.Add "option5", "folder5"
set oFolder = oFS.GetFolder(rootfolder&"\"&folderoption.item(selectedoption))
msgbox(oFolder)
Set oFiles = oFolder.Files
For each folderIdx In OFiles
msgbox(oFolder&"\"&folderIdx.Name)
text = readTextFromFile(oFolder&"\"&folderIdx.Name)
Set clipboard = createobject("mercury.clipboard")
clipboard.Clear
clipboard.SetText(text)
msgbox(text)
SwfWindow("MyApplication").SwfEditor("xmlTextBox").Type micCtrlDwn + "v" + micCtrlUp
Next
Function readTextFromFile(pathToFile)
Set fso = createObject("Scripting.FileSystemObject")
If fso.FileExists(pathToFile) = True Then
Set f = fso.OpenTextFile(pathToFile, 1)
readTextFromFile = f.ReadAll
f.Close
End If
End Function
i attached the folder i used. remove all the msgbox codes, i have used for tracking purpose.