WorknMan Posted October 24, 2010 Share Posted October 24, 2010 ARRRRGGGHHHH!!! I'm about to tear my hair out trying to figure this out. Got some simple code: If FileExists("U:\") Then MsgBox(0, "Test", "File does exist!") Else MsgBox(0, "Test", "File does NOT exist!") EndIf If I run the script by double clicking on it, it sees the drive. If I run the script from an external app, it doesn't. In this case, the external app is TheBat (email program - I'm launching the app as part of a mail rule.) If I change the network drive to a local drive, it works both ways. I just can't launch it externally when the network drive is specified? Any ideas??? Link to comment Share on other sites More sharing options...
martin Posted October 24, 2010 Share Posted October 24, 2010 (edited) ARRRRGGGHHHH!!! I'm about to tear my hair out trying to figure this out. Got some simple code: If FileExists("U:\") Then MsgBox(0, "Test", "File does exist!") Else MsgBox(0, "Test", "File does NOT exist!") EndIf If I run the script by double clicking on it, it sees the drive. If I run the script from an external app, it doesn't. In this case, the external app is TheBat (email program - I'm launching the app as part of a mail rule.) If I change the network drive to a local drive, it works both ways. I just can't launch it externally when the network drive is specified? Any ideas??? No idea why, I imagine the email program cannot see the network drives either, so if you save an attachmnet As you can't see U? Maybe you could have a script running all the time like this expandcollapse popup;compile and run this, then run the other script below HotKeySet("+^{F10}", "terminate");Shift Ctr F10 to end $G = GUICreate("doesdriveexist@1234");some unlikely title just so we have a gui to send the messages to. $typeMesg = RegisterWindowMessage("GetTheNetworkDrives01");get a unique message number GUIRegisterMsg($typeMesg, "getDrive");assign it to a function which will handle it while 1 sleep(20);hang around WEnd Func Terminate() Exit EndFunc ;==>Terminate Func getDrive($Hwnd, $IMsg, $WP, $LP) Local $DRiveLetter = Chr($WP) If FileExists($DRiveLetter & ":") Then Return 1 Else Return 0 EndIf EndFunc ;==>getDrive ;register window message ;returns a unique message number. if the message has already been registered then the ;the unique number for $stext is returned. ;Useful for two scripts to communicate Func RegisterWindowMessage($sText) Local $aRet = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', $sText) Return $aRet[0] EndFunc ;==>RegisterWindowMessage and then replace your script with this #include <SendMessage.au3> $typeMesg = RegisterWindowMessage("GetTheNetworkDrives01") $H1 = WinGetHandle("doesdriveexist@1234") $Drive = "U";or whatever drive you want $driveNum = Asc($Drive) If _SendMessage($H1, $typeMesg, $driveNum) = 1 Then MsgBox(0, "Test", "File " & $Drive & " does exist!") Else MsgBox(0, "Test", "File " & $Drive & " does NOT exist!") EndIf exit Func RegisterWindowMessage($sText) Local $aRet = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', $sText) Return $aRet[0] EndFunc ;==>RegisterWindowMessage Edited October 24, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now