I can do evertyhing to a folder but close it!!! 
Author Message
 I can do evertyhing to a folder but close it!!!

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



Tue, 06 Dec 2005 21:09:21 GMT  
 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



Wed, 07 Dec 2005 01:38:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. IE window close after script is done

2. sending paging data using iexplorer and closing iexplorer when done

3. How can i close a folder with WSH?

4. Treeview control changing the picture to open folder/close folder

5. Custom Outlook Folders - Can this be done?

6. Closing the App - Can it be done?

7. How To? Closing Shelled DOS app when done

8. How to close all explorer folders without closing IE windows?

9. Closing a child window when parent closes

10. closing a popup when the parent closes.

11. Close all child windows when parent is closed

12. Problems Closing a New Window using window.close()

 

 
Powered by phpBB® Forum Software