StartupFileList regkey error

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 ?

thx
Keith

Which registry key do you write it to? To which plug-in does it belong? (the one with GUID 1c7a3523…)

Hi menno,

HKEY_CURRENT_USER\SOFTWARE\McNeel\Rhinoceros\5.0x64\Scheme: Default\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings\StartupFileList

This is the same plugin regkey that is created when using the Document Properties RhinoScript dialogue within Rhino.

thx,
Keith

It looks like you also have to set the StartupFileListCount variable (in the screenshot below it is zero).

Thanks menno, that is very handy as I can use this to create the next File(number) for the StartupFileList Name.

Keith

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 ?

Keith

Maybe try the InitializationMode parameter in the registry, I have no idea really…

@dale any ideas?

@brian could you have a look at this thread please ?

thx,
Keith

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.

Does this help?

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.

thx,
Keith

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

Thanks Dale, but this still only loads my rvb file on the second try of opening Rhino.

Would you like to connect to my computer to verify ?

Keith

Sorry…replace this line:

nCount = CInt(nCount)

with this:

nCount = CInt(strValue)

Still not loading my simple “hello world” rvb script on the first opening of Rhino.

You are welcome to link computers to verify.

Keith

Hi @Keith1634. I don’t have anything to add here, it looks like @dale has been helping you and has the best handle on this problem so far.

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?