This plug-in allows a user to run batch files on command.
make sure that your .bat files are in the Ultra Hal Assistant 6 folder for the plug-in to work. because the vbscript will call from where the plug-in resides.
Rem Type=Plugin
Rem Name=Batch File Controller
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Program Controller; PROGRAM NAME: can be anyname like; LIGHTS, APPLICATION NAME: Light.bat <- include .bat extension"
lblPlugin(0).Move 120, 10, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PRE-PROCESS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.
If HalBrain.CheckTableExistence("BatchFileListings") = False Then
HalBrain.CreateTable "BatchFileListings", "TopicSearch", ""
End If
Set MyBatchApp = CreateObject("WScript.Shell")
'Example; create a batch file path to a batch file and give it a name the computer will use to identify it and run it.
'Batch File Name: Lights, Batch File Path: C:Lights.bat
If BatchFileName = "" Then BatchFileName = HalBrain.SearchPattern(InputString, "*PROGRAM NAME: *, APPLICATION NAME: *", 2)
If BatchFilePath = "" Then BatchFilePath = HalBrain.SearchPattern(InputString, "*PROGRAM NAME: *, APPLICATION NAME: *", 3)
If BatchFileName <> "" And BatchFilePath <> "" Then
HalBrain.AddToTable "BatchFileListings", "TopicSearch", Trim(BatchFileName), Trim(LCase(BatchFilePath))
UltraHal = "I have mapped out this specific batch file to run on command, just say: run, start, begin, turn on, turn off along with the batch file name you gave me and I will run the batch file for you."
Exit Function
End If
RunABatch = HalBrain.TopicSearch(InputString, "BatchFileListings")
RunABatch = Trim(RunABatch)
If RunBatProg = "" Then RunBatProg = False
If InStr(1, InputString, "run", vbTextCompare) > 0 Then RunBatProg = True
If InStr(1, InputString, "start", vbTextCompare) > 0 Then RunBatProg = True
If InStr(1, InputString, "begin", vbTextCompare) > 0 Then RunBatProg = True
If InStr(1, InputString, "turn on", vbTextCompare) > 0 Then RunBatProg = True
If InStr(1, InputString, "turn off", vbTextCompare) > 0 Then RunBatProg = True
If RunBatProg = True And RunABatch <> "" Then
HalBrain.ReadOnlyMode = True
MyBatchApp.Run "cmd /C Start " & RunABatch
UltraHal = "I will run the program for you."
Exit Function
End If
If RunBatProg = True Then HalBrain.ReadOnlyMode = True
If BatchFileName <> "" And BatchFilePath <> "" Then HalBrain.ReadOnlyMode = True
Jerry[8D]