
I can do evertyhing to a folder but close it!!!
It opens the folder multiple times because you have it in a loop.
try this
For Each file in folder.Files
'look for new files
upext = ucase(fso.GetExtensionName(file.Name))
If upext = "WPD" or upext = "PDF" Then
flag = 1 'Determine that the file exists and get out of the loop
Exit For ' You can exit the loop early because you have determined
that one of these files exists
End If
Next
If flag = 1 Then
MsgBox "Sharon you have orders that have been signed",, "orders"
' opens folder for user
WshShell.Run "c:\opndirs.bat",1,TRUE
End If
Good luck
HS
Quote:
> Hello All,
> I need a script that looks for a folder to a network share on a users
> desktop, and I am having problems.
> The situation is if a documnet is put into a network share I want to
> notify a user and then open the folder, but I don't want to keep
> reopening the folder.
> Here is what I have so far and it works except the folder keeps
> opening.
> dim WshShell
> set WshShell = WScript.createObject("WScript.Shell")
> set fso = CreateObject("Scripting.FileSystemObject")
> cleanpath = "c:\signed_orders"
> DO While true
> cleanup fso.GetFolder(cleanpath)
> wscript.sleep 900000
> Loop
> '---------------------------------------------------------
> sub cleanup (folder)
> dim file, subfolder
> 'declare local variables
> for each file in folder.Files
> 'look for new files
> upext = ucase(fso.GetExtensionName(file.Name))
> if upext = "WPD" or upext = "PDF" then
> MsgBox "Sharon you have orders that have been signed",, "orders"
> WshShell.Run "c:\opndirs.bat",1,TRUE
> ' opens folder for user
> end if
> next
> end sub
> thanks
> mattd