MOVEit Automation custom scripts use Microsoft VBScript and PowerShell. In addition to the basic functions provided by that environment, MOVEit Automation also makes available several application-specific functions.
The functions and subroutines, and associated details are listed in alphabetical order in the following table.
The functions and subroutines are described as follows:
For example, errcode =
MISetDestHost(ConfiguredHostName [,idest])
Where MISetDestHost is the function name
errcode
is the return value
ConfiguredHostName
is the required argument
idest
is an optional argument.
Functions and Subroutines |
Description |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MIAddFile CacheFilename, AssignedFilename |
Adds a file to the list of files to be sent to destinations. Note: Before you use MIAddFile, call MINewCacheFilename() to create the temporary file to send. CacheFilename - The name of the temporary file to send AssignedFilename - The name to be given to the file on the destination server. The filename can be specified with forward slash ( To prevent infinite loops, scripts are not currently run on files added via MIAddFile. |
||||||||||||||
DirName = MICacheDir() |
Returns the full path of the directory where MOVEit Automation keeps its temporary files |
||||||||||||||
FileName = MICacheFilename() |
Returns the name of the temporary copy of the file. This file can be overwritten if the custom script needs to change the contents of the file before it is transferred. |
||||||||||||||
FilesString = MICacheFiles() |
Returns a string containing the subdirectories and filenames for all active files in the cache. These names are relative to MICacheDir and reflect the actual names on disk in the cache directory, not the original names from the sources. The names are separated by the pipe (|) character. The last file does not have a | at the end. This list is empty immediately after a call to MIIgnoreFiles. The list does not include, for instance, the names of zip files that have been downloaded from sources marked "Uncompress Archives". |
||||||||||||||
bOK = MIDeleteFileSecure(Filename) |
Overwrites the specified file with random bytes, and then deletes the file. Returns True if successful. |
||||||||||||||
MIDirAddEntry FilenameToMatch, Date, Size, bIsDir, FilenameForGet, FilenameOriginal |
Adds an entry to the FTP or SSH directory listing that is being parsed. This should be called only from custom directory parsing scripts. For more information, see Custom Directory Parsing |
||||||||||||||
sDirListing = MIDirGetListing() |
Returns the entire verbatim listing from the FTP or SSH server. Call this function only from custom directory parsing scripts. For more information, see Custom Directory Parsing. |
||||||||||||||
DbgLevel = MIGetDebugLevel() |
Returns the debug level currently set in MOVEit Automation. Values: Level Meaning 0 Internal errors 10 Task/File Errors 20 Task/File Warnings 30 Task Completions 40 File Completions 50 Some Debug 60 More Debug 70 All Debug |
||||||||||||||
OriginalFilename=MIGetOriginalFilename() |
Returns the original filename of the file. |
||||||||||||||
Result = MIGetTaskInfo(InfoString) |
Returns the specified information about the current task. Values:
|
||||||||||||||
ParamValue = MIGetTaskParam(ParamName) |
Returns the value of the specified task parameter. If the current task has no such parameter, the empty string is returned. |
||||||||||||||
MIIgnoreFiles [bDeleteOrigIfCfg [,bKeepAsNew]] |
Causes all files already downloaded or added via MIAddFile to be ignored in subsequent processing steps. For example, use this if your custom script creates a zip file containing the downloaded files, and you do not want the downloaded files to be sent.
|
||||||||||||||
MIIgnoreThisFile [bDeleteOrigIfCfg [,bKeepAsNew]] |
|
||||||||||||||
MILogMsg Message |
Logs a message to system log file. The message is preceded by the task name. |
||||||||||||||
MyString = MIMacro(MacroText) |
Evaluates the macro MacroText and returns the resulting text. MacroText can contain any combination of macros. The MacroText attribute must be enclosed in square brackets. For example, [OrigName] is the original name of the file. |
||||||||||||||
FileName = MINewCacheFilename() |
Returns a new, unique temporary filename. The filename will be a full path and will be in the cache folder. |
||||||||||||||
bOK = MIReplaceCacheFile(Filename) |
Securely deletes the current temporary cache file, and replaces it with the contents of Filename. For example, use this to send a different file, such as a file that you just created, instead of the downloaded file. Typically you first call MINewCacheFilename() to get a filename, use the FileSystemObject to create the file based on the contents of the file in the cache, and then call MIReplaceCacheFile() to tell MOVEit Automation to use the new file |
||||||||||||||
retval = MIRunCommand(Command) |
Runs a Windows system command through the Windows system command interpreter. Command is a command, such as "Notepad MyFile.txt". This can be the name of a command, such as an .exe or .bat file, or the name of a file with an associated extension, such as .vbs, or a built-in CMD.EXE command such as DIR. MIRunCommand waits until the command is complete. If you want the custom script to continue running while the command runs, use the Windows START command to launch the program. MIRunCommand returns either:
|
||||||||||||||
errcode = MISetDestHost(ConfiguredHostName [,idest]) |
Changes the current file's view of one of the task's destinations so that it points to the given configured host. ConfiguredHostName is the name of one of the configured hosts such as "XYZ Corp FTP Server", not an Internet host domain name. The new host does not need to be the same type as the destination being changed. For example, the destination can be of type FileSystem, but you can change it to point to an FTP server. Only the current file being processed (if any), and any files added via MIAddFile during this run of the process, are affected. If you are using this command to switch between hosts of different types (for example, between FTPS and MOVEit Transfer servers) use the "MISetDestPath" command to ensure that destination paths are properly parsed. Use a value of " idest is the ordinal number of the destination to change. Default is 1, which means the first destination in the task. (Most tasks have only one destination.) Returns an error code: 0 indicates success 2540 indicates that the named host does not exist
|
||||||||||||||
errcode = MISetDestPath(NewPath [,idest]) |
Changes the current file's view of one of the task's destinations so that it points to a different path. NewPath is the new path or directory name. idest has the same meaning that it does for MISetDestHost. Only the current file being processed (if any), and any files added via MIAddFile during this run of the process, are affected. Returns an error code: 0 indicates success
|
||||||||||||||
MISetErrorCode NumericErrorCode |
Sets the error code and error description for this process. If the custom script determines that the file should not be transferred, it calls MISetErrorCode with a non-zero numeric error code and MISetErrorDescription with a textual description of the error. This information is recorded by MOVEit Automation, and the file is not sent. If the special value 5000 is set by MISetErrorCode, MOVEit Automation ignores the file. That is, it does not send the file, does not delete the original file, and does not flag an error that would cause the task to fail. Returning error code 5000 can be used to ignore unwanted files without alarming operators by having the task marked as unsuccessful. See also MIIgnoreThisFile If the special value 5010 is set by MISetErrorCode, MOVEit Automation does not count this process as having been run. Ordinarily, MOVEit Automation marks a task has having completed successfully (as opposed to "No actions taken") if any process runs, even if no files were downloaded or uploaded. However, if all processes in a task call MISetErrorCode 5010, and no files are transferred, then that task run is considered to have completed with "No actions taken". This affects which Next Actions are executed at the end of the task |
||||||||||||||
MISetErrorDescription ErrorDescription |
Sets the error code and error description for this process. If the custom script determines that the file should not be transferred, it calls MISetErrorCode with a non-zero numeric error code and MISetErrorDescription with a textual description of the error. This information is recorded by MOVEit Automation, and the file is not sent. If the special value 5000 is set by MISetErrorCode, MOVEit Automation ignores the file. That is, it does not send the file, does not delete the original file, and does not flag an error that would cause the task to fail. Returning error code 5000 can be used to ignore unwanted files without alarming operators by having the task marked as unsuccessful. See also MIIgnoreThisFile If the special value 5010 is set by MISetErrorCode, MOVEit Automation does not count this process as having been run. Ordinarily, MOVEit Automation marks a task has having completed successfully (as opposed to "No actions taken") if any process runs, even if no files were downloaded or uploaded. However, if all processes in a task call MISetErrorCode 5010, and no files are transferred, then that task run is considered to have completed with "No actions taken". This affects which Next Actions are executed at the end of the task |
||||||||||||||
MISetFilename NewFilename |
Changes the name under which the file should be stored at the destination. Do not include a path in NewFilename. |
||||||||||||||
MISetStatus StatusText |
Set the status text to be displayed by MOVEit Automation Admin while the script is running. This can be used by long-running scripts to inform the operator the status of the process. If MISetStatus is not called, the message "Running script scriptname" is displayed. |
||||||||||||||
MISetTaskParam ParamName,ParamValue |
Sets the value of the specified task parameter ParamName. If the current task has no such parameter, a parameter of that name is created. Parameter names are not case-sensitive. |
||||||||||||||
MISleep Milliseconds |
Suspends the custom script for the specified number of milliseconds. Very little processor time is consumed during the pause. |
||||||||||||||
ErrCode = MIStartTask(TaskNameOrID [,TaskParams]) |
Starts the specified task. TaskNameOrID is either a task name or a task ID. (MOVEit Automation checks first for a task name match.) TaskParams allows you to specify values for task parameters. If a parameter name matches the name of a parameter configured in the task definition, the new value overwrites the configured value. The format of TaskParams is Example 1: Run a task called ShowMyID that shows the value of the ID stored in variable
Example 2: A task called SendSummaryFile is started with two task parameters computed from within the script:
Returns 0 if the task was started. Note: the task will probably still be running when this function returns; a 0 return code does not mean that the task will successfully run to completion |
||||||||||||||
TaskGroups = MITaskGroups() |
Returns the name of the task that is running the custom script. |
||||||||||||||
TaskName = MITaskname() |
Returns the names of the task groups to which the task belongs. This is a string containing the names of all applicable groups, separated by |. For example, the result might be "Daily|For Argus Bank|By Fred", or just "". You can process this in VBScript by creating an array from it using the Split function. |