Code: Select all
IsNetworkConnected()
{
try
{
FileRead, filecheck, \\mydrive\test.txt ;(I've also tried FileCheck() with the same results)
return "yes"
}
catch
{
msgbox, hmm
return
}
}
Things seem to work when the drive is connected. However, when it's disconnected, instead of reaching the catch (or making it through FileRead and returning "yes") the script locks up completely. I thought maybe I could make do, by putting the FileRead in a second script, launching it from my main script, then killing the second script if it takes too long. But I can't seem to kill it. Here's what I tried:
Code: Select all
SetTitleMatchMode,2
DetectHiddenWindows,on
WinClose,\filecheck.ahk - Autohotkey
So. Does anyone know a better way to check if a drive/file can be accessed, or a better way to kill a frozen script?