Code: Select all
MsgBox % fixCasingOfPath("c:\autohotkey_2.0-beta.3") ; C:\AutoHotkey_2.0-beta.3
fixCasingOfPath(fullPath) {
DllCall("shell32\SHParseDisplayName", "Ptr", &fullPath, "Uint", 0, "Ptr*", pIDL, "Uint", 0, "Uint", 0)
VarSetCapacity(pszPath, 600) ;600 was a random number
DllCall("shell32\SHGetPathFromIDListW", "Ptr", pIDL, "Ptr", &pszPath)
DllCall("ole32\CoTaskMemFree", "Ptr", pIDL) ;free memory
return StrGet(&pszPath+0)
}
Code: Select all
GetFullPathName(path) { ;https://www.autohotkey.com/boards/viewtopic.php?t=67050#p289536
cc := DllCall("GetFullPathNameW", "str", path, "uint", 0, "ptr", 0, "ptr", 0, "uint")
VarSetCapacity(buf, cc*2)
DllCall("GetFullPathNameW", "str", path, "uint", cc, "ptr", &buf, "ptr", 0, "uint")
return StrGet(&buf)
}
Code: Select all
activeEditorLong:="C:\autoHotkey_2.0-beta.3\你好,世界!.ah2" ;since it's SHGetPathFromIDListW instead of SHGetPathFromIDListA, it works..
activeEditorLong:=GetFullPathName(activeEditorLong)
activeEditorLong:=fixCasingOfPath(activeEditorLong)