FileSelect'd filename doesn't work as a param for RunWait
Posted: 17 Jan 2022, 14:40
I'm sure this must be easy, it's just I can't figure it out - any pointers gratefully received:
So, this works as expected:
Runwait "Notepad.exe" ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
and this also works as expected:
name := ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
Runwait "Notepad.exe" Name
But this DOESN'T work (see code comments for more detail):
Name := FileSelect(,,, "*.txt") ;Selected file = "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt"
Name := " `' `"" . Name . "`" `'"
MsgBox(Name) ;name = ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
Runwait "Notepad.exe" Name ;Popup err = "The filename, directory name, or volume label syntax is incorrect." Notepad starts but is empty.
I'd be really grateful for your thoughts.
So, this works as expected:
Runwait "Notepad.exe" ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
and this also works as expected:
name := ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
Runwait "Notepad.exe" Name
But this DOESN'T work (see code comments for more detail):
Name := FileSelect(,,, "*.txt") ;Selected file = "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt"
Name := " `' `"" . Name . "`" `'"
MsgBox(Name) ;name = ' "D:\AutoHotKey\My AHK projects\RunXRef+\XRef+ExcludedWordsList.txt" '
Runwait "Notepad.exe" Name ;Popup err = "The filename, directory name, or volume label syntax is incorrect." Notepad starts but is empty.
I'd be really grateful for your thoughts.