Some additional information in one line

Writing custom VBS scripts in Tasks

Technical top tips for MOVEit MFT
MOVEit Automation Standard edition upwards (previously MOVEit Central Enterprise) brings with it the ability to write your own scripts.  As with any computer software, this is useful for managing those tricky little tasks that arrive as either a legacy requirement or through a business process that you must adhere to.

It’s always difficult to decide where to start when writing scripts, however with MOVEit Automation you must always start with the restriction of the scripting language available to you.  Custom scripts must be written in one of the core Window Script Host languages, Visual Basic.  Whilst this article will attempt to convey some of the things you need to know about MOVEit Automation scripting, it does not include teaching in Visual Basic itself; there are a plethora of teaching guides available on the internet to assist with this.

The first place to start is the Ipswitch Portal.  This contains some useful scripts already, which although basic, nevertheless will get you started in the right direction.  The next thing to look at is the online documentation; there are 24 subroutines and functions that you can include in a VBS script to allow you to pass information back and forth between MOVEit and the script.  For example, to access a file as it comes into the cache use the function MICacheFilename; to replace the outgoing file use the function MINewCacheFilename.

When calling a script, you can pass parameters in the same way as any regular script; you can then access these parameters in the script using the function MIGetTaskParam.  Use MILogMsg to write messages out to the log file to keep track of what the script is doing (very useful for debugging while writing the script).

So let’s create a new blank script, give it a name and description:

Script Wizard
Script Defination
You work on a script locally on your own computer, then upload it using the “Reload” menu option.  Our script will be quite simple – renaming part of a folder path using parameters passed to it from the task.  There is no error checking in this example!

‘We start by getting the parts of the folder to
‘rename and the folder path itself.  
Source = MIGetTaskParam(“Source”)
Dest = MIGetTaskParam(“Dest”)
FullPath = MIMacro(“[FullPath]”)
‘The FullPath macro unfortunately contains
‘the filename, which we need to remove:
OrigName = MIMacro(“[OrigName]”)
FullPath = Replace(FullPath,OrigName,””)
‘Now we update the folder path with the new name
NewPath = Replace(FullPath,Source,Dest)
MyResult = MISetDestPath(NewPath)
‘Write out a log message and result
MILogMsg “changed ” & FullPath & ” to ” & NewPath & “ RC” & MyResult

In the task itself we would then simply set the source and desk parameter values:
Edit Parameters
When the task is executed, we can see the new folder is set:
VBS Script

 

(Please note: All screenshots have been taken from MOVEit Central Enterprise Edition 8.0)

Need UK-based MOVEit support?

We are certified Progress MOVEit Titanium Partners and our team includes the UK’s leading MOVEit expert.
See our range of support and consultancy services to help you get the most out of your MOVEit solution.