Want a DropBox

by MYLE 3. March 2011 20:39

Had  a client ask me
I want a Dropbox where he wanted to drop a jpg on on the vbs copy it to a differance location BUT give it the name of the script.jpg

well that got me thinking

can i get the name of the running script yes FileName = WScript.ScriptName

can i get what been drop on it Set objArgs = WScript.Arguments

can i return the file status fso.FileExists(filespec)

so put all in on

 

'***************************************************************
' Copyright 2011 MYLE (Making Your Life Easy)
'
' Written By: StePhan Mckillen
' Please leave the Copyright notes
'***************************************************************
Const CopyTo = "E:\TNL\tofolder\"
 
'*************************************************************
' Please do not change anything pass this point
'*************************************************************
dim ws, filesys, objargs
Set ws = WScript.CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
FileName = WScript.ScriptName

For Each strArg in objArgs
	set ReplaceFile = filesys.getfile(strArg)
	ext=Split(replacefile.name,".")
	filename = replace(Ucase(filename),"VBS",ext(1))
	if ReportFileStatus(Copyto & filename) then
		if Msgbox("Replace" & vbnewline & replacefile.name & " >>> " & filename,vbyesno)=vbyes then
			filesys.Copyfile replacefile , CopyTo & filename ,true
			Msgbox("Done :" & replacefile.name & "=>" &  CopyTo & filename ) 
		else 'dont Copy it
			
		End if
	else
		filesys.Copyfile replacefile , CopyTo & filename ,true
		Msgbox("Done :" & replacefile.name & "=>" &  CopyTo & filename ) 
	End if
	
Next 



Function ReportFileStatus(filespec)
   Dim fso, msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists(filespec)) Then
      msg = true
   Else
      msg = false
   End If
   ReportFileStatus = msg
End Function

 

so if i

Comments

11/18/2011 9:34:06 PM #

credit report dispute letter

I admire the important information you provide inside your articles. I will bookmark your blog page and have my children check up here usually. I’m very certain they are going to find out tons of new stuff here than anybody else!

credit report dispute letter United States |

1/26/2012 3:55:20 AM #

carpet cleaning forest lake

I am so happy to read this. This is the type of manual that needs to be given and not the accidental misinformation that is at the other blogs. Appreciate your sharing this greatest doc.

carpet cleaning forest lake United States |

Comments are closed

Dislexia

I see people have commented about my style of writting.
Well I have dislexia so spelling is not one of my good points
but when it comes to reading/written code thats the easy bit.

 

 

Poll

What Search Engine Do you use




Show Results

Disclaimer of Liability

While every effort will be made to ensure that the information contained within this website is accurate and up to date, The Company's listed with this web site and any associated parties, make no warranty, representation or undertaking, whether expressed or implied, nor does it assume any legal liability, whether direct or indirect, or responsibility for the accuracy, completeness, or usefulness of any information.

 

Google Ads

Most comments

apply cash advance apply cash advance
1 comments
us United States
cloudy cloudy
1 comments
us United States
mutuelle mutuelle
1 comments
fr France

RecentComments

Comment RSS