Frequently Asked Question

Export images reporting oversize to a separate folder
Last Updated 5 months ago

Script:

SplitOnline VBScript Module

Option Explicit

' Global Variables
Dim FileSaveModule
Dim TopSizeTrigger

Dim objFso, objFolder, objFile' Objects
Dim strFolder, strFileName, strPath ' Strings

Const ForAppending = 8

' Called when channel execution begins
Sub OnChannelExecute

' Names of Split Fragmentation modules in this channel
Dim FileSaveModuleName

FileSaveModuleName = "Big_Rock_Save"
Set FileSaveModule = Channel.GetModule(FileSaveModuleName)

TopSizeTrigger = 10

strFileName = "\Large Rock Log.csv"
strFolder = "C:\Users\eking.SPLITENG\Desktop\Belt Mask Example Images\Topsize"
strPath = strFolder & strFileName

End Sub

' Called when channel execution terminates
Sub OnChannelTerminate

Set FileSaveModule = Nothing

End Sub


' Called when this module is executed in each channel iteration
Sub OnIteration

Dim TopSizeValue

On Error Resume Next

' Get TopSize
TopSizeValue = Channel.GetValue("Fnos\Topsize")

' Set File Save Off by default
FileSaveModule.SetEnabled(False)

If TopSizeValue > TopSizeTrigger Then
' Enable FileSaveModule
SplitApp.Log "Saving Picture of large Rock... Topsize: " & TopSizeValue
FileSaveModule.SetEnabled(True)

' Write Time and Topsize to file
Set objFso = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolder) Then
Set objFolder = objFSO.GetFolder(strFolder)
Else
Set objFolder = objFSO.CreateFolder(strFolder)
End If

'Create the file if it doesn't already exist
If objFSO.FileExists(strPath) Then
Set objFile = objFso.OpenTextfile(strPath, ForAppending, True)
Else
Set objFile = objFso.CreateTextFile(strPath, True)
objFile.WriteLine("TimeStamp" & "," & "TopSize")
End If

'Close File
objFile.WriteLine(Now & "," & TopSizeValue)
objFile.Close


End If


End Sub

Instructions to Install Script:

Both the VB Script module and File Save module are to inserted in the channel after the calibration module



image


Please Wait!

Please wait... it will take a second!