ogonzales 0 Posted August 9, 2010 Ok so here is what I am trying to accomplish but have been unsuccesful in doing this. I have two path but one function. Can anyone help please. If FileExists("C:\Progrm Files\Microsoft Office\Office11\Excel.exe") Then _FiletypeAssociation('.tsv', 'tsv', 'C:\Progrm Files\Microsoft Office\Office11\Excel.exe "%1"', 'TSV') ElseIF FileExists("C:\Progrm Files\Microsoft Office\Office12\Excel.exe") Then _FiletypeAssociation('.tsv', 'tsv', 'C:\Progrm Files\Microsoft Office\Office12\Excel.exe "%1"', 'TSV') EndIf Func _FiletypeAssociation($extension, $type, $program, $description = '') $exitcode = RunWait(@ComSpec & ' /c ftype ' & $type & '=' & $program & _ ' && assoc ' & $extension & '=' & $type, '', @SW_HIDE) If $description And Not $exitcode Then Return RegWrite('HKCR\' & $type, '', 'Reg_sz', $description) EndIf Return Not $exitcode EndFunc Exit Share this post Link to post Share on other sites
FlyinRiz 0 Posted August 9, 2010 (edited) Ok so here is what I am trying to accomplish but have been unsuccesful in doing this. I have two path but one function. Can anyone help please.If FileExists("C:\Progrm Files\Microsoft Office\Office11\Excel.exe") Then _FiletypeAssociation('.tsv', 'tsv', 'C:\Progrm Files\Microsoft Office\Office11\Excel.exe "%1"', 'TSV')ElseIF FileExists("C:\Progrm Files\Microsoft Office\Office12\Excel.exe") Then _FiletypeAssociation('.tsv', 'tsv', 'C:\Progrm Files\Microsoft Office\Office12\Excel.exe "%1"', 'TSV')EndIf Func _FiletypeAssociation($extension, $type, $program, $description = '') $exitcode = RunWait(@ComSpec & ' /c ftype ' & $type & '=' & $program & _ ' && assoc ' & $extension & '=' & $type, '', @SW_HIDE) If $description And Not $exitcode Then Return RegWrite('HKCR\' & $type, '', 'Reg_sz', $description) EndIf Return Not $exitcode EndFunc ExitNot sure if you had copy/paste'd your script but there are a few typos like "progrm" instead of "program" and also if the path has spaces (i.e. C:\Progrm Files\Microsoft Office\Office12\Excel.exe) you need to surround it in double-quotes as well...hope that helps a little.-Aaron Edited August 9, 2010 by FlyinRiz Share this post Link to post Share on other sites