SAMPLE
Applies To:
ITScriptNet V1/V2
This sample shows how to move the output file (defined on Configure Receive screen) after the collected data has been processed into it. Code to accomplish this task must be written in VBScript because it executes in the Data Processing Scripts which only interpret VBScript Language.
This functionality allows files to be moved during the processing step which may be necessary to move the collected data to a specific location, move new validation files into the current directory, etc...
DETAILS
Place the following code in the 'After Processing Data' script of the Data Processing scripts (Program->Configure Receive->Edit Scripts...).
'CREATE FILE SYSTEM OBJECT
Set oFSO = CreateObject("Scripting.FileSystemObject")
'GET CURRENT FOLDER
Set oFolder = oFSO.GetFolder(".")
'GET THE PATH OF THE CURRENT FOLDER
sDir = oFSO.GetAbsolutePathName(oFolder)
'MAKE SURE THE FILE DOES NOT ALREADY EXIST
IF oFSO.FileExists(sDir & "Data.txt") THEN
'FILE EXISTS - WARN USER
msgbox "File Cannot be moved! File already exists in destination folder."
ELSE
'MOVE FILE TO TEMP DIRECTORY
oFSO.Movefile sDir & "\Data.txt" , "..\File Move\Temp\Data.txt"
END IF
This Script uses VBScript's File System Object to accomplish the following tasks:
- Get the Current Folder
- Get the FULL Path of the Current Folder
- Checks to make sure the file exists before attempting to move it
- Moves the output file to a new directory
This article last updated:
1/1/2009 12:00:00 AM