The COPY&GO feature of CopyWrite can be used to copy files to a remote host, and then perform some actions.
When a COPY&GO is performed to another A-Series Host, the actions include Running a program and Starting a WFL, as described in the COPY&GO section of Native File Transfer.
When a COPY&GO is performed to a Windows Host, the actions include Running a Program and Executing a Script.
A program must be a Windows Executable.
A Script must be in a language supported by the MicroSoft Windows Scripting Host, and currently only VBScript is implemented.
In this example, an A-Series text file is copied with a Windows text filename along with several other files. The text file contains a VBScript. The DOCUMENTTYPE=FTAM1 clause indicates that an action appropriate to the file type should be performed, if all the files are copied successfully. The file type is determined from the .extension.
The COPY&GO Statement is,
Copy Vbs/Test2 as 'C:\Temp\Test.vbs'(DocumentType=FTAM1),Test/=
To TestVol(CD,HostName=CPNTA);Target=1
The VBScript in this test is,
Dim Selector,FileName,Reason
Set Selector=CreateObject("CopyWriteInterface.SelectorX")
Spout("Opening " & VolumeTypeName & " in " & VolumeName)
If Not Selector.SelectVolume(VolumePath,Reason) then
Spout(Reason)
End If
For Each File In Selector
If File.FileNo <
ScriptFileNo then
FileName=ScriptDirectory & "\" & File.FlatName & ".txt"
Spout("Converting " & FileName)
If Not Selector.ConvertToText(File.FileNo,FileName,FALSE,Reason)then
Spout(Reason)
End If
End If
Next
Spout("Purge " & VolumePath)
This Script converts all the files copied, except the Script itself, into Windows text files.
When the files are copied, CopyWrite starts the Scripting Host and creates an NFTScript Object, which it adds to the Scripting Host.
The Methods and Properties of the NFTScript Object are only available to a VBScript executed in a COPY&GO.
In the example above, the Spout() Method of the NFTScript Object is used to Display a message on the originating A-Series Host. For example,
#2065 CopyWrite:[INSPIRON] Opening DiskVolume in TESTVOL
#2065 CopyWrite:[INSPIRON] Converting C:\Temp\nft_do_oo.txt
The Methods and Properties of the NFTScript Object are described later in this section.
In addition to the NFTScript Object, there are VBScript Objects available for accessing the Windows environment, and the CopyWriteInterface ActiveX Automation Objects for accessing A-Series Volumes.
The current implementation requires that the A-Series file which contains the VBScript to be executed, be copied with its complete Windows PathName. In the example above, Copy Vbs/Test2 AS 'C:\Temp\Test.vbs' . This gives CopyWrite both the actual path and an indication of FileType.
Important Note: This software should only be used in a trusted domain. CopyWrite does not dictate any policy about where files are copied on the Windows NT system. If the RU allows a remote user access, then the files may be created anywhere. CopyWrite is running as a privileged process on the Windows NT system. It is intended that a future release will provide a Windows NT Administrator greater control over the activities of an RU.
The NFTScript Object provides Methods and Properties associated with the WFL COPY&GO Statement which started the Script.
These Methods are provided by the NFTScript Object.
Methods | ||
---|---|---|
Method | Description | Example |
PROCEDURE Spout(Const Text:String) |
The Text is displayed on the originating A-Series Host. | Spout("Opening " & VolumeTypeName & " in " & VolumeName) |
These Properties are provided by the NFTScript Object.
Properties | ||
---|---|---|
Property | Description | Example |
UserName : String; | The A-Series Usercode under which the COPY Statement was executed. | Spout("Initiated
by " & UserName) #2085 CopyWrite:[WATTLE] Initiated by NFT |
ScriptFileName:String; | The Windows fully qualified pathname of the Script file being executed. | Spout("Script is " & ScriptFileName) #2093 CopyWrite:[REDGUM] Script is C:\Temp\Test.vbs |
ScriptDirectory:String; | The Directory part of the ScriptFileName. | Spout("Directory is " & ScriptDirectory) #2101 CopyWrite:[PAPERBARK] Directory is C:\Temp |
ScriptFileNo:Integer; | The FileNo of the file in the sequence of files copied. The first file copied is FileNo 1. | If File.FileNo <> ScriptFileNo then FileName=ScriptDirectory & "\" & File.FlatName & ".txt" End If |
VolumeType:Integer; | The
coded VolumeType, 0 - UnSelected 1 - DiskVolume 2 - UnitVolume 3 - CoreVolume 4 - DiskFarm 5 - WrappedVolume 6 - BLPackVolume 7 - ASeriesDisk |
Const
DiskFarm = 4 If VolumeType = DiskFarm then Spout("Copied to a Disk Farm") End If |
VolumeTypeName:String | The
mnemonic for the Volume Type , ' UnSelected' 'DiskVolume' 'UnitVolume' 'CoreVolume' 'DiskFarm' 'WrappedVolume' 'BLPackVolume' 'ASeriesDisk' |
Spout("VolumeType is " & VolumeTypeName) #2107 CopyWrite:[DESERTPEA] VolumeType is DiskVolume |
VolumePath:String; | The path of the Volume or Disk Farm where the files were copied. | Spout("VolumePath is " &
VolumePath) #2109 CopyWrite:[REDBOX] VolumePath is C:\ASeriesImages\TESTVUL.mcp |
VolumeName:String; | The name of the <destination volume> in the COPY Statement. | Spout("VolumeName is " &
VolumeName) #2121 CopyWrite:[WARATAH] VolumeName is TESTVOL |
TaskString:String; | The TASKSTRING Label Equated to the COPY Statement or Empty. For example, COPY TO HOSTNAME=TEATREE);TASKSTRING="Text for VBScript" | Spout("TaskString
is " & TaskString) #2132 CopyWrite:[TEATREE] TaskString is Text for VBScript |
HostName:String; | The HostName of the A-Series Host which initiated the Copy. | Spout("HostName is " &
HostName) #2145 CopyWrite:[SCRIBBLY] Hostname is SCRIBBLYMCP |
SW1:Boolean; SW2:Boolean; SW3:Boolean; SW4:Boolean; SW5:Boolean; SW6:Boolean; SW7:Boolean; SW8:Boolean; |
The
SW1..SW8 Attributes Label Equated to the COPY Statement.These Switch
Attributes may be used by Library/Maintenance in some contexts, SW1 - Tape Written with LABELKIND=B6500LIBRARYTAPE (7) instead of Compact Format. SW6 - Version 6 Disk File Headers SW7 - Version 7 Disk File Headers SW8 - Conditioned Tape (must be at least one file with a LICENSEKEY). CopyWrite recognizes this switch in some contexts, SW5 - Pre 4.6 Library/Maintenance Hybrid Format (After 4.6 the MCP recognizes volumes with both ISO9660 and Library/Maintenance Volume Descriptors). |
If
SW1 then Spout("SW1 is Set") End If |