Solved

Need help modifying VB Script, need to remove WSH notify box prior to file move.

Posted on 2009-03-29
3
256 Views
Last Modified: 2012-05-06
I posted earlier for help on my script, but now im getting the WSH box prior to the file being moved, I would like for the script to run without any on-screen notification or someone having to click a button for it to proceed. Any help would be much appreciated. Thanks.
Force "wscript"
 
StartPath = "C:\DELL\"
DestPath = "\\Workstation-1\FTP FROM SERVER\"
 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFolder = objFSO.GetFolder(StartPath)             
Set colfiles = objFolder.Files                           
 
LogFile = "c:\MovedScanFilesLog.txt"
 
Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNotExist = -1
 
Set LogObjFSO = CreateObject("Scripting.FileSystemObject")
 
If LogObjFSO.FileExists(LogFile) Then
        Set LogObjFile = LogObjFSO.OpenTextFile(LogFile, ForAppending)
Else Set LogObjFile = LogObjFSO.CreateTextFile(LogFile)
        LogObjFile.Close
        Set LogObjFile = LogObjFSO.OpenTextFile(LogFile, ForWriting)
End If  
 
 
If colfiles.Count >0 Then 
        
        LogObjFile.WriteBlankLines(1)
        LogObjFile.WriteLine "The following files were moved on: " & Now
                
        For Each objFile In colfiles
                wscript.echo objFile.Name
                LogObjFile.WriteLine objFile.Name
                objFSO.MoveFile objFile,DestPath
        Next
Else 
 LogObjFile.WriteLine "There were no files to be moved on: " & Now 
End If
 
LogObjFile.Close
 
 
 
Sub Force(sScriptEng)
 If Lcase(Right(Wscript.FullName, 12)) = "\wscript.exe" Then
  If Instr(1, Wscript.FullName, sScriptEng, 1) = 0 Then
   'Need to switch to CSCRIPT
   CreateObject("Wscript.Shell").Run "cscript.exe " & Chr(34) & Wscript.ScriptFullName & Chr(34)
   Wscript.Quit
  End If
 Else
  If Instr(1, Wscript.FullName, sScriptEng, 1) = 0 Then
   'Need to switch to WSCRIPT
   CreateObject("Wscript.Shell").Run "wscript.exe " & Wscript.ScriptFullName
   Wscript.Quit
  End If
 End If
End Sub

Open in new window

WSH-Notify-Box.JPG
0
Comment
Question by:WiredPC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Marcjev earned 500 total points
ID: 24014689
You do it yourselves in this line.
Remove it.

--> wscript.echo objFile.Name
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24014700
Hi, WiredPC.

Delete line 30.
0
 

Author Closing Comment

by:WiredPC
ID: 31564107
PERFECT!!! I knew that (actually, Not!). Thanks for your help.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question