Hi,
I'm still trying to understand some F# so I read the old threads where I can find some understandable code (for me).
This one make me think about a way to avoid using the Autodesk.AutoCAD.Interop to get the Template path by readin in the registry.
So I tried to write a little function.
let GetTemplatePath() =
let openKey key = Registry.CurrentUser.OpenSubKey(key)
let getPath sub next key = key + "\\" + (openKey(key).GetValue(sub) :?> string) + next
("Software\\Autodesk\\AutoCAD"
|> getPath "CurVer" ""
|> getPath "CurVer" "\\Profiles"
|> getPath "" "\\General"
|> openKey).GetValue("TemplatePath") :?> string
Or, more 'generic'
let CurProfileRegKey() =
let openKey key = Registry.CurrentUser.OpenSubKey(key)
let getPath sub key = key + "\\" + (openKey(key).GetValue(sub) :?> string)
("Software\\Autodesk\\AutoCAD" |> getPath "CurVer" |> getPath "CurVer") + "\\Profiles"
|> getPath "" |> openKey
CurProfileRegKey().OpenSubKey("General").GetValue("TemplatePath")