wetmatter nonsense

let's get random 
Filed under

vbscript

 

vbs: Sub & Function Procedures

First off there are two types of Procedures. Sub Procedures and Function Procedures. One of the main differences is that a Sub Procedure does not return a value whereas a Function Procedure will. I won't bore you to much unnecessary details...

Syntax (Sub Procedure):

Sub ProcedureName(Arg1,Arg2)
     script statements
End Sub

Syntax (Function Procedure):

Function ProcedureName(Arg1,Arg2)
     script statements
End Function

Let's step through a simple process using both types of procedures (no returning values) stating with a Sub.

SubProc

Now let's move on to a Function Procedure.

FuncProc

So far everything is working the same. Now let's try returning a value, shall we? This time we will start with a Function Procedure.

FuncProc_ReturnedVal

Yeah it worked! Now let's try it with a Sub Procedure.

SubProc_Failed

FAIL! Can't do it, won't do it.

SubProc_Error

Filed under  //   function procedure   scripting   sub procedure   vbs   vbscript   vbsedit  
Posted by Samson Loo 

Comments [0]

Simple File Organizer v1.04

This script grabs the date (modified or create date) from the file and
creates a folder based on the date in the following format (MM-DD-YY)
and moves the file into the newly created and designated folder. If
the folder exist then the file is simply moved. NOTE: If the files
have been copied from another pc be sure to uncomment line 53
(tFile.DateLastModified) to use the Modified date instead of the
(tFile.DateCreated), so comment out line 54 before running the script.
Because if the files have a common create date then all files will be
groupped into a single folder.

This script is ideal for unorganized photos still on a media card and
files unorganized in a folder such as downloaded items, but there are
many other uses I suppose.

Example:
Filename1 has a create date of Jan. 13, 2009 then this would be
grouped into a folder called 01-13-09.
Filename2 has a create date of Oct. 17, 2009 then this would be
grouped into a folder called 10-17-09.

VERIFIED ON:
This script has been tested against Windows 2003, XP & Vista.

NOTE: Rename the file from .vbs_ to .vbs and edit line 42 to specify
the target folder before running. This only targets files in the
parent directory, files in sub-directories will not be affected.

See this posted on Microsoft's TechNet Script Center Gallery (http://bit.ly/ePsXU)

     
Click here to download:
Simple_File_Organizer_v1.04.zip (98 KB)

Click here to download:
SimpleFileOrganizer_1.04.vbs_ (2 KB)

Filed under  //   file organizer   vbs   vbscript  
Posted by Samson Loo 

Comments [0]