When I manually add my startup script path to the StartupFileList regkey then rhino does not recognise it when opening and the Document Properties RhinoScript dialogue remains empty.
I would like to be able to add my startup script path and distribute it through my installer. Can someone help test this in case I have missed something ?
Update, this certainly shows now in the Document Properties RhinoScript dialogue but only loads the script to run whilst opening Rhino for the second time.
Is there anything I can do to make Rhino run the startup script on the first try ?
RhinoScript reads the Registry when the plug-in loads, and writes the Registry when Rhino closes. It does not monitor the Registry for changes while Rhino is running. So if you make a change to the Registry while Rhino is running RhinoScript will never know about it.
not really, with rhino closed I first write to the registry - then I open rhino and expect the referenced startfile to run. This is not happening on the first try, only when I open rhino for the second time does the startup file kick in.
This bit of VBS code works, run using CSCRIPT.EXE, for me:
Option Explicit
Call Keith
Sub Keith
Call AddStartupScriptFile("C:\Users\Dale\Desktop\Test.rvb")
End Sub
Sub AddStartupScriptFile(strFile)
Const KEY0 = "HKCU\SOFTWARE\McNeel\Rhinoceros\5.0x64\Scheme: Default\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings\StartupFileListCount"
Const KEY1 = "HKCU\SOFTWARE\McNeel\Rhinoceros\5.0x64\Scheme: Default\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings\StartupFileList\File"
Dim objFSO, objShell, strKey, strValue, nCount
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists(strFile) Then
Call WScript.Echo("File not found.")
Exit Sub
End If
Set objShell = CreateObject("WScript.Shell")
strValue = objShell.RegRead(KEY0)
If IsNull(strValue) Then
Call WScript.Echo("StartupFileListCount value not found.")
Exit Sub
End If
nCount = CInt(strValue)
Call objShell.RegWrite(KEY0, CStr(nCount + 1), "REG_SZ")
strKey = KEY1 & CStr(nCount)
Call objShell.RegWrite(strKey, strFile, "REG_SZ")
End Sub
The code I posted (above) seems to work pretty consistently here. Have you captured the contents of the Registry before and after running the script? What are the differences?