Doxie Posted July 13, 2004 Posted July 13, 2004 This is not working, complains about overflow... First() Second() Exit Func First() Run("net use z: \\server\share /user:**** ***** /y") EndFunc Func Second() $var = DriveStatus( "z:\" ) IF $var = "READY" THEN FileCopy("z:\test2.txt", "C:\") Run("net use z: /d") Else Second() EndIf Sleep(5000) EndFunc Exit How can i make it continue testing the DriveStatus and proceed when ready? I could use a simple "Sleep" command, but since the time it take to map the drive vary alot, it would be best if it could just check when its done. Any suggestions? Were ever i lay my script is my home...
pekster Posted July 13, 2004 Posted July 13, 2004 How can i make it continue testing the DriveStatus and proceed when ready?Try this: First() Second() Exit Func First() Run("net use z: \\server\share /user:**** ***** /y") EndFunc Func Second() While DriveStatus("z\") <> "READY" Sleep(100) WEnd FileCopy("z:\test2.txt", "C:\") Run("net use z: /d") Sleep(5000) EndFunc Exit Note how I don't use a recursive function call when it could theoretically call up to the max allowed recursion level. Use a while loop instead for that. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Doxie Posted July 13, 2004 Author Posted July 13, 2004 This seems to work Else Sleep(5000) Config() EndIf EndFunc I just moved the sleep command, and now it does not complain about overflow. Were ever i lay my script is my home...
Doxie Posted July 13, 2004 Author Posted July 13, 2004 Thanks Pekster I need to learn more about the while loops Your code look much better then my desperate attempt. :iamstupid: Were ever i lay my script is my home...
Doxie Posted July 13, 2004 Author Posted July 13, 2004 I remade the whole script, now it looks like this. Run("net use z: \\server\share /user:***** ***** /y") While DriveStatus("z:\") <> "READY" Sleep(100) WEnd FileCopy("z:\*.*", "d:\") Run("net use z: /d") Sleep(5000) Exit Less code, but doing the job better PS. I really like to use the smilies Were ever i lay my script is my home...
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