SaveSettings

I’m accessing the integer successfully with this
intAmount_ev = Rhino.GetSettings(Rhino.InstallFolder & “Gelfling.ini”, “AdvancedDivideCurves”, “Amount_ev”)
If IsNull(intAmount_ev) Then intAmount_ev = 1 Else intAmount_ev = CInt(intAmount_ev)

I used to be able to save the integer with this ?
Rhino.SaveSettings Rhino.InstallFolder & “Gelfling.ini”, “AdvancedDivideCurves”, “Amount_ev”, intAmount_ev

I tried a couple variations of Rhino.SetDocumentData with no success.?

thanks Mark

Hi Mark,

This is a permissions problem. I believe the last Microsoft OS that allows you to freely write to the Program Files folder was Windows XP. Newer operating systems project this folder.

Here is a better way to get a folder that you can write into:

Sub Main
  Dim objShell, strPath
  Set objShell = CreateObject("WScript.Shell")
  strPath = objShell.ExpandEnvironmentStrings("%AppData%")
  ' TODO...
End Sub

– Dale

hi Dale
My apologies I do not have a formal programming background, I only have a half an idea how to use this. Would the “strPath” be the equivalent to “intAmount_ev” in my prior post. ?

thanks Mark

Hi Mark

My take would be to replace the 'TODO with your could.

Dale’s code seems to lift the write restrictions.

-Willem

Hi Mark,

Replace your use of Rhino.InstallFolder with my code.

For example:

Dim strPath, intAmount_ev

Set objShell = CreateObject("WScript.Shell")
strPath = objShell.ExpandEnvironmentStrings("%AppData%")
strPath = strPath & "\Gelfling.ini"

intAmount_ev = Rhino.GetSettings(strPath, "AdvancedDivideCurves", "Amount_ev")
If IsNull(intAmount_ev) Then 
  intAmount_ev = 1 
Else 
  intAmount_ev = CInt(intAmount_ev)
End If

' TODO...

a very sincere thank you… Mark