Thanks guys.
That helps a lot. You see, I don't like to rely on environment variables. So I define a global constant in the beginning of UVK's code like this:
Code: Select all
Global Const $SystemDrive = StringLeft(@WindowsDir,2)
So if @WindowsDir is
C:\Windows, $SystemDrive is
C:
As it turns out, it seems to be an AutoIt bug in some computers, where @WindowsDir is returning a path in the DVD drive instead (probably the drive Windows was installed from). No wonder I couldn't find any error in my code.
Now what I don't know is whether AutoIt gets the @WindowsDir path using
SHGetFolderPath(), or
GetWindowsDirectory(), or if it just expands the %SystemRoot% or %WinDir% environment variable.
If you guys don't mind helping out with this issue, when you see it happen again, please run the UVK script below, and post a screenshot with the message box that is displayed.
Code: Select all
<AutoItScript>
$rn2 = @CRLF&@CRLF
$msg = '@WindowsDir = '&@WindowsDir&$rn2&'@SystemDir = '&@SystemDir&$rn2
$aCall = DllCall('Kernel32.dll', 'UINT','GetWindowsDirectoryW', 'wstr','', 'UINT',260)
If Not @error Then $msg &= 'GetWindowsDirectory() = '&$aCall[1]&$rn2
$aCall = DllCall('Kernel32.dll', 'UINT','GetSystemWindowsDirectoryW', 'wstr','', 'UINT',260)
If Not @error Then $msg &= 'GetSystemWindowsDirectory() = '&$aCall[1]&$rn2
$aCall = DllCall('Kernel32.dll', 'UINT','GetSystemDirectoryW', 'wstr','', 'UINT',260)
If Not @error Then $msg &= 'GetSystemDirectory() = '&$aCall[1]&$rn2
$aCall = DllCall('Shell32.dll', 'LONG','SHGetFolderPathW', 'HWND',0, _
'int', 36, 'HANDLE',0, 'DWORD',0, 'wstr','')
If Not @error Then $msg &= 'SHGetFolderPath(CSIDL_WINDOWS) = '&$aCall[5]&$rn2
$aCall = DllCall('Shell32.dll', 'LONG','SHGetFolderPathW', 'HWND',0, _
'int', 37, 'HANDLE',0, 'DWORD',0, 'wstr','')
If Not @error Then $msg &= 'SHGetFolderPath(CSIDL_SYSTEM) = '&$aCall[5]&$rn2
$msg &= '%WinDir% = '&EnvGet('WinDir')&$rn2
$msg &= '%SystemRoot% = '&EnvGet('SystemRoot')&$rn2
$msg &= '%SystemDrive% = '&EnvGet('SystemDrive')
MsgBox(0,'System paths',$msg)
That will help me not only determine where the bug is, but also choose the best function to retrieve the paths.
Thanks.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.
Fred