startWriteOutputToFile, stopWriteOutputToFile and other undocumented functions

Post topics about HALion scripting.
Post Reply
misohoza
Member
Posts: 860
Joined: Sun Oct 05, 2014 12:18 am
Contact:

startWriteOutputToFile, stopWriteOutputToFile and other undocumented functions

Post by misohoza » Sat Jul 06, 2019 8:16 pm

Recently I tried to experiment with metatables and lua environment in general. So I thought I'd check what global variables are used by Halion.

Code: Select all

--print globals
--set Max Lines to 1000
local g = {}
for k in pairs(_G) do table.insert(g, k) end
table.sort(g)
for _, v in ipairs(g) do print(v) end
This should print:

Code: Select all


AudioFile
AudioOutput
Bus
Container
DebugLevel
Effect
Element
Event
EventType
Instance
KeySwitchType
Layer
LoadProgress
LuaElement
MessageBoxResult
MessageBoxType
MidiFileFormat
MidiModule
ModulationDestination
ModulationMatrixRow
ModulationSource
NoteExpressionType
ParameterDefinition
Program
QCAssignmentMode
Serializable
Slot
UIScriptModule
UndoContext
Zone
_G
_VERSION
__internal
addLayerPassword
afterTouch
assert
assignAutomation
beat2ms
bit32
changeNoteExpression
changePan
changeTune
changeVolume
changeVolumedB
class
clone
collectgarbage
controlChange
debug
debugFunction
debugger
defineModulation
defineParameter
defineSlotLocal
dofile
endUndoBlock
error
fade
forgetAutomation
getAllocatedMemory
getAutomationIndex
getBarDuration
getBeatDuration
getBeatTime
getBeatTimeInBar
getCC
getContext
getElement
getFreeVoices
getHostName
getHostVersion
getKeyProperties
getKeySwitches
getMsTime
getNoteDuration
getNoteExpression
getNoteExpressionProperties
getProcessedSamples
getProductName
getProductVersion
getSamplingRate
getScriptExecTimeOut
getScriptVersion
getSlotIndex
getTempo
getTime
getTimeSignature
getUndoContext
getUsedMemory
getUsedVoices
getUsedVoicesOfSlot
getUserPresetPath
getVoices
getmetatable
insertEnvelopePoint
insertEvent
ipairs
isKeyDown
isNoteHeld
isOctaveKeyDown
isPlaying
load
loadPreset
loadPresetAsync
loadfile
loadstring
math
messageBox
module
ms2beat
ms2samples
next
openURL
package
pairs
pcall
pitchBend
playNote
playTriggerPad
postEvent
print
printRaw
property
rawequal
rawget
rawlen
rawset
readMidiFile
releaseVoice
removeEnvelopePoint
require
resolveAlternateData
resolveStorageString
runAsync
runSync
samples2ms
savePreset
select
setDebugLevel
setDebugLevelController
setDebugLevelProcessor
setScriptExecTimeOut
setmetatable
sortEvents
spawn
startUndoBlock
startWriteOutputToFile
stopWriteOutputToFile
string
super
table
this
tonumber
tostring
type
unpack
wait
waitBeat
waitForRelease
writeMidiFile
xpcall
Some of the items on the list aren't documented anywhere. Maybe they are not meant for the end user but it would be great if a developer could comment on that.


I tried some of them (trial and error):

startWriteOutputToFile, stopWriteOutputToFile

Code: Select all

--startWriteOutputToFile(filename: string [, append: boolean [, onlyToFile: boolean]])
--stopWriteOutputToFile()
startWriteOutputToFile("D:/Desktop/Halion.txt", false, true)
print("Program name: "..this.program.name)
stopWriteOutputToFile()
savePreset

Code: Select all

--savePreset(path: string, layerOrProgram: object [, class ID?])
--returns: boolean
local layers = this.parent:findLayers()
local folder = "D:/Desktop"
for _, layer in ipairs(layers) do
  local saved = savePreset(folder.."/"..layer.name..".vstpreset", layer)
  if saved then print(string.format("Preset %q saved", layer.name)) end
end
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest