a little bug of param %2 in internal association
Moderators: Hacker, petermad, Stefan2, white
a little bug of param %2 in internal association
the problem happened when there is a SPACE inside file path.
when I select more than one file, it is OK, tc can split multiple files correctly even if there is SPACE in file path.
but if I use %2 and I only select one file, if there is SPACE in the file path, TC will split the file path to different parameters.
Test under 8.01 rc5.
when I select more than one file, it is OK, tc can split multiple files correctly even if there is SPACE in file path.
but if I use %2 and I only select one file, if there is SPACE in the file path, TC will split the file path to different parameters.
Test under 8.01 rc5.
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Can't confirm, with neither x32 or x64
I have 2 files, in the path:
c:\Users\FOO\Downloads\__FOLDER SPACES__\*.*
Winpad2.exe
XCacls_Installer.exe
When I select them and choose,
1) Echo All --> A single cmd.exe window opens all the files with full paths are echo'd and quoted.
2) Echo Mult --> Multiple cmd.exe windows open, each file with full paths are echo'd and quoted.
I have 2 files, in the path:
c:\Users\FOO\Downloads\__FOLDER SPACES__\*.*
Winpad2.exe
XCacls_Installer.exe
When I select them and choose,
1) Echo All --> A single cmd.exe window opens all the files with full paths are echo'd and quoted.
2) Echo Mult --> Multiple cmd.exe windows open, each file with full paths are echo'd and quoted.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
yes, you are right, a lot applications can support the files with SPACE in the path.
I found this problem because I try to write some scripts by Autohotkey.
I use %2 to send the path information into the script.
When I try to get these parameters in my script, I found the problem, when click single file, the path information has been splitted into multiple parameters if there is SPACE in the path.
I am curious that, when I select multiple files, TC can correctly split file path into parameters, one file path into one parameter, even if there is SPACE in the path.
So I think TC has the mechanism to avoid this problem, but it seems this mechanism doesn't take effect when select single file.
I think a lot applications can support this kind of parameters because they do some compatibility process in the program, such as, check whether a parameter is started with a drive letter.
I found this problem because I try to write some scripts by Autohotkey.
I use %2 to send the path information into the script.
When I try to get these parameters in my script, I found the problem, when click single file, the path information has been splitted into multiple parameters if there is SPACE in the path.
I am curious that, when I select multiple files, TC can correctly split file path into parameters, one file path into one parameter, even if there is SPACE in the path.
So I think TC has the mechanism to avoid this problem, but it seems this mechanism doesn't take effect when select single file.
I think a lot applications can support this kind of parameters because they do some compatibility process in the program, such as, check whether a parameter is started with a drive letter.
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
I think yer not retrieving the args correctly via AHK,
This will do so, and AHK v2 (beta) has an internal variable (array I believe) for passed parameters (arguments).
In my example above, changing the internal association to
AHK Message | %AHK%\TC_TestInput.ahk "%2"
I get both programs and their paths in 2 Message Boxes.
(Where %AHK% is an environment variable)
This will do so, and AHK v2 (beta) has an internal variable (array I believe) for passed parameters (arguments).
Code: Select all
Loop, %0%
{
args:=%A_Index%
MsgBox, % args
}
AHK Message | %AHK%\TC_TestInput.ahk "%2"
I get both programs and their paths in 2 Message Boxes.
(Where %AHK% is an environment variable)
Code: Select all
C:\$M$>set ahk
AHK="C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\Users\FOO\Documents\AutoH
otkey"
AHKDir=C:\Program Files\AutoHotkey
AHKICO=C:\Program Files\AutoHotkey\Extras\AutoHotkey_AHK1.icl