I know Scriptor has some command line support (if you associate BOS files with it, it opens them fine), so my question is this: is it possible to control Scriptor from the command line? Like run it with some parameters and a filename so that it will compile the script and then quit? Better yet, is it possible to make it compile all the scripts in a given folder?
I'm asking this because it's quite a long job to recompile scripts for nearly a 100 units after one include change that affects them all. Of course it can be done by hand, but it would be so much faster in batch mode.
Question about batch-compiling with Scriptor
Moderator: Moderators
I've managed to create a sort of batch-compiling program using the Windows Script Host. Here it is (sorry for VBScript, but it still gets the job done):
Place that code in a file, name it something like build.vbs, change the lineto point to where your BOS files are (they must all be in one folder for this to work).
The requirement to run it is to have BOS files associated with Scriptor (so that doubleclicking them opens Scriptor with the file loaded). The script will open each file, send the Ctrl+F7 (compile) command to Scriptor, wait a bit, then close the file and move to the next file, etc. In my test it compiled 96 BOS files in about 3 minutes on my computer, your results may vary.

Code: Select all
Dim WSHShell
Dim objFSO
Dim objShell
Dim objFolder
Dim colItems
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
TargetFolder = "e:\scripts"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(TargetFolder)
Set colItems = objFolder.Items
processedScripts = 0
compiledScripts = 0
For i = 0 to colItems.Count - 1
Set curScriptFileName=colItems.Item(i)
If LCase(Right(curScriptFileName, 3))="bos" Then
processedScripts = processedScripts + 1
curScriptName=Left(curScriptFileName, Len(CurScriptFileName)-4)
curCompiledFileName=curScriptFileName+".cob"
If objFSO.FileExists(curCompiledFileName) Then
objFSO.DeleteFile(curCompiledFileName)
End If
'Run the compiler
curScriptFileName.InvokeVerbEx("Open")
'Wait a bit for the compiler to load
WScript.Sleep(500)
'Find the window
WSHShell.AppActivate("Scriptor - "+curScriptName)
WScript.Sleep(100)
'Send the Ctrl+F7 command
WSHShell.SendKeys("^{F7}")
'Wait a bit for the COB file to appear
repeatCounter = 10
While repeatCounter>0
If objFSO.FileExists(curScriptName+".cob") Then
repeatCounter = 0
compiledScripts = compiledScripts + 1
Else
repeatCounter = repeatCounter - 1
WScript.Sleep(500)
End If
Wend
'Close the file
WSHShell.SendKeys("^{F4}")
WScript.Sleep(100)
End If
Next
compileErrors=processedScripts-compiledScripts
MsgBox("Compiling done. "+CStr(processedScripts)+" BOS files found, "+CStr(compiledScripts)+" COBs made, "+CStr(compileErrors)+" errors.")
Code: Select all
TargetFolder = "e:\scripts"
The requirement to run it is to have BOS files associated with Scriptor (so that doubleclicking them opens Scriptor with the file loaded). The script will open each file, send the Ctrl+F7 (compile) command to Scriptor, wait a bit, then close the file and move to the next file, etc. In my test it compiled 96 BOS files in about 3 minutes on my computer, your results may vary.
