Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Wscript.network

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,54217
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Wscript.network
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Wscript.network - 12/12/2007 1:46:54 AM   
  ziminski

 

Posts: 79
Score: 2
Joined: 1/8/2006
Status: offline
I have the following code which works... usually....... at times it seems it will not map the network drive and copy the file. is there a better way? a more reliable method?
TIA
Rick

Dim objNetwork
sSaveName = "PS_Project_Rpt.xls"
sSavePath = "D:\Apps\https\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
If objFSO.DriveExists("Z:") = True Then
objNetwork.RemoveNetworkDrive "Z:"
End If
objNetwork.MapNetworkDrive "Z:", "\\UsMyserver\data", True ,"UsMyserver\mylogin","Mypass"

objFSO.CopyFile sSavePath & sSaveName, "Z:\"
 
 
Post #: 1
 
 RE: Wscript.network - 12/12/2007 6:38:47 AM   
  geezery

 

Posts: 23
Score: 0
Joined: 5/28/2007
Status: offline
Maybe you can try to add some delays after these, because it might take some time to process these commands.

Dim objNetwork
sSaveName = "PS_Project_Rpt.xls"
sSavePath = "D:\Apps\https\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
If objFSO.DriveExists("Z:") = True Then
objNetwork.RemoveNetworkDrive "Z:"
Wscript.Sleep 1000
End If
objNetwork.MapNetworkDrive "Z:", "\\UsMyserver\data", True ,"UsMyserver\mylogin","Mypass"
Wscript.Sleep 1000
objFSO.CopyFile sSavePath & sSaveName, "Z:\"
WScript.Quit

(in reply to ziminski)
 
 
Post #: 2
 
 RE: Wscript.network - 12/12/2007 7:07:18 AM   
  ziminski

 

Posts: 79
Score: 2
Joined: 1/8/2006
Status: offline
Simple enough to do! I'll give it a try and see if it helps. thx.
Is there a wait while busy like with IE? objNetwork.busy ?
Do While (oIE.Busy)' Important: wait till MSIE Is ready
'WScript.Echo "....."
WScript.Sleep 200
Loop

(in reply to geezery)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Wscript.network Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts