The only way I can think of doing it is to submit a file (via ajax or iframe) and then the callback or whatever method you prefer sets the value of a variable.
Perhaps if you explained what you were trying to do someone can give a good starting point for research or code example?
Looks like you are close. GetFile seems to require an absolute path. Try instead:
fileObj = fso.GetFile("C:\foo.txt"); //this assumes the file lives on the C:\ drive.
Hope that helps.