25 Mar 2022, 13:49
I am using ahk 1.1.33.09 on Windows 7 pro.
This appears to be a genuine bug. If not on the part of the AHK then WINDOWS. I haven't tested to see if WINDOWS is the culprit.
I often run executables with a space in the fileid. But, haven't found this problem because, out of habit, I prefer to always enclose such fileids in double quotes. And, this is an extremely obscure bug!!!
I ran the following script, each time uncommenting 1 RUN command. Results are shown as comments in the code.
It appears that
1. when a blank is part of the fileid of the path the information after the blank is discarded
in determining the name of the target executable but IF and ONLY IF by doing so the fileid then becomes a fileid on a .EXE file that exists.
2. In this case, the "modified" path is the target executable of the RUN command. and
3. the "discarded" portion of the correct excutable value is interpretted as part of the paramters.
test script:
gif := "C:\Users\Joey\Documents\my photos\Other people's pics\gifs\1-64.gif"
;Run, C:\Program Files\GIF Viewer\GIF Viewer.exe "%gif%",, UserErrorLevel
;Run, C:\Program Files\GIF Viewer\GIF Viewer - Copy.exe "%gif%" ; fails
; the above runs GIF Viewer.exe
; which then asks what file to open.
;Run, C:\Program Files\GIF Viewer\GIF Viewer Copy.exe "%gif%" ; fails
; the above runs GIF Viewer.exe
; which then asks what file to open.
; this was to check if the "-" (special character, so to speak made
; a difference. it did not.
;Run, C:\Program Files\GIF Viewer\GIFViewer Copy Copy.exe "%gif%" ; works
; then create GIFViewer.exe
;Run, C:\Program Files\GIF Viewer\GIFViewer "%gif%" ; works
;Run, C:\Program Files\GIF Viewer\GIFViewer Copy Copy.exe "%gif%" ; fails
; the above runs GIFViewer.exe and apparently thinks the
; "Copy Copy.exe" %gif% are the parameters to pass
exitapp
side story.... just a diversion:
I remember as a programmer long ago, I created an MVS file with a blank in the name. This was not a simple thing to do, especially since it was frowned upon. The head of security one day came down to operations where I worked and he was furious. Especially since I was just a computer operator. He BLAMED ME for his security program failing because of my file. I was ECSTATIC. He was such a jerk!!!!