If it depends on the extension of the file name, eg. "myExcel.xls" or "myText.txt" just write code to check the file name extension, "xls" or "txt" and do the correct process to open the file in either Excel or Notepad.
I'm not sure about the second situtation, what do you mean settings on...