ICANSEEYOU7687 Posted August 26, 2010 Share Posted August 26, 2010 BASICALLY what im doing, and have it working very well, is to have a little gui with a log in and password. Where I work, the employee's have several mapped network drives. One of them being a personal one. Do to a change we know have a couple locations of these drives, with each user having their own folder using their user name, hence the $USER variable Local $USER = GUICtrlRead($TITLE) Local $PASSWORD = GUICtrlRead($PASS) $folder = FileExists("\\directory1\" & $USER) While $folder > 1 Sleep(1) MsgBox(4096, "Wait...", "Please Wait") WEnd [b] IF $folder == 1 Then RunWait(@ComSpec & " /C " & "net use I: \\directory1\" & $USER &" " & "/user:Domain\" & $USER &" " & $PASSWORD, "", @SW_HIDE) Sleep(1000) EndIf IF $folder == 0 Then RunWait(@ComSpec & " /C " & "net use I: \\directory2\" & $USER &" " & "/user:Domain\" & $USER &" " & $PASSWORD, "", @SW_HIDE) Sleep(1000) EndIf[/b] RunWait(@ComSpec & " /C " & "net use S: \\directory3\data$" &" " & "/user:Domain\" & $USER &" " & $PASSWORD, "", @SW_HIDE) RunWait(@ComSpec & " /C " & "net use T: \\directory3\data2" &" " & "/user:Domain\" & $USER &" " & $PASSWORD, "", @SW_HIDE) MsgBox(4096, "AutoIt", "Please check to see if the drive mapped!") the directory3 has not change so this works correctly every time. The I drive is the problem. This actualy works perfectly while on our buildings internal network is great. But on an outside network, and using VPN, FileExist will always return 0, unless they are using a machine they are logged into with kerberos credentials. But for example, a Personal laptop (non work issued laptop) on their home network, FileExist will ALWAYS return 0 because it does not have credentials (I can use the command prompt net use, because I can include the needed log in and password) I apologize if this is confusing but I would really appreciate the help! And please exscuse my bad coding. I know a little bit but not a whole lot. Link to comment Share on other sites More sharing options...
wakillon Posted August 26, 2010 Share Posted August 26, 2010 (edited) I apologize if this is confusing but I would really appreciate the help! And please exscuse my bad coding. I know a little bit but not a whole lot. I should not find answer because I already forgot the question ! I know FileExists work for mapped Drive butFileExists return 0 or 1, so why did you write "While $folder > 1" Edited August 26, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
ICANSEEYOU7687 Posted August 26, 2010 Author Share Posted August 26, 2010 Well the reason is, if your using FileExist from a remote location, I noticed there was a delay. I really dont know how autoit handles its code. Does it wait to finish FileExist before moving on? The while loop was my way of waiting until it came up with a value. Like I said a user trying to check a folder from a remote location (hell we even have a user at work who tethers with her blackberry for her home internet ><) I was trying to write a quick solution to make the program wait until it got a value. But thats really neither here nor there, and it is probably unecessary, but I really dont know how to program in autoit well. BUT Anyways... basically for a user from the company to use FileExist from a remote location (not on our LAN) I need to be able to use some kind of logon credentials from our Active Directory. Just wondering if this was possible. Also is there any way I can see the coding for FileExist? I briefly looked through some of the includes, but didnt find it. I did need to work afterall haha Link to comment Share on other sites More sharing options...
wakillon Posted August 27, 2010 Share Posted August 27, 2010 Well the reason is, if your using FileExist from a remote location, I noticed there was a delay. I really dont know how autoit handles its code. Does it wait to finish FileExist before moving on? The while loop was my way of waiting until it came up with a value. Like I said a user trying to check a folder from a remote location (hell we even have a user at work who tethers with her blackberry for her home internet ><) I was trying to write a quick solution to make the program wait until it got a value. But thats really neither here nor there, and it is probably unecessary, but I really dont know how to program in autoit well. BUT Anyways... basically for a user from the company to use FileExist from a remote location (not on our LAN) I need to be able to use some kind of logon credentials from our Active Directory. Just wondering if this was possible. Also is there any way I can see the coding for FileExist? I briefly looked through some of the includes, but didnt find it. I did need to work afterall haha For the waiting until value I suggest $_TimerInit = TimerInit ( ) $folder=0 While $folder=0 $folder = FileExists ( "\\directory1\" & $USER ) $_TimerDiff = Round ( TimerDiff ( $_TimerInit )/1000 ) If $_TimerDiff > 5 Then ExitLoop TrayTip ( "Wait...", "Please Wait", 5, 1 ) Sleep ( 1000 ) WEnd TrayTip ( "", "" ) It wait for 5 sec ( change it like you want ) and exit the loop... have you see for FileExists in Autoit help ? Function is pretty basic ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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