Results 1 to 5 of 5

Thread: Type info into the registry

  1. #1
    I could stop if I wanted to
    Join Date
    2001-07
    Posts
    318
    Login to Give a bone
    0

    Default Type info into the registry

    Hello,
    I was wondering if there is a way to choose what kind of info I want to put in the registry :
    string, int... using (vl-write-registry..) automatically it's a string but I'd like a real.
    Thanks

    in wiki
    List of Registry Value Types
    0 REG_NONE No type
    1 REG_SZ A string value
    2 REG_EXPAND_SZ An "expandable" string value that can contain environment variables
    3 REG_BINARY Binary data (any arbitrary data)
    4 REG_DWORD / REG_DWORD_LITTLE_ENDIAN A DWORD value, a 32-bit unsigned integer (numbers between 0 and 4,294,967,295 [232 – 1]) (little-endian)
    5 REG_DWORD_BIG_ENDIAN A DWORD value, a 32-bit unsigned integer (numbers between 0 and 4,294,967,295 [232 – 1]) (big-endian)
    6 REG_LINK symbolic link (UNICODE)
    7 REG_MULTI_SZ A multi-string value, which is an array of unique strings
    8 REG_RESOURCE_LIST Resource list
    9 REG_FULL_RESOURCE_DESCRIPTOR Resource descriptor
    10 REG_RESOURCE_REQUIREMENTS_LIST Resource Requirements List..

    Thanks

  2. #2
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Type info into the registry

    If you use the vl-registry-write function it depends on what type of value is in the val-data argument. E.g.:
    Code:
    (setq path "HKEY_CURRENT_USER\\Software\\Autodesk")
    
    (vl-registry-write path "0" "This will be a string") ;REG_SZ
    (vl-registry-write path "1" 100) ;REG_DWORD
    (vl-registry-write path "2" 100.0) ;Error unsupported
    (vl-registry-write path "3" '(1 2 3)) ;Error unsupported
    (vl-registry-write path "4" '("1" "2" "3")) ;Error unsupported
    So you can only write strings or integers to the registry. If you want any more features, I'd advise going the ActiveX route:
    Code:
    (setq reg (vlax-get-or-create-object "WScript.Shell"))
    (vlax-invoke reg 'RegWrite (strcat path "\\2") 100 "REG_BINARY")
    (vlax-invoke reg 'RegWrite (strcat path "\\4") "%TEMP%" "REG_EXPAND_SZ")
    (vlax-release-object reg)
    But it doesn't do much different except you can specify such things as REG_EXPAND_SZ, which allows you to expand paths, e.g.:
    Code:
    (vlax-invoke reg 'ExpandEnvironmentStrings (vlax-invoke reg 'RegRead 
    (strcat path "\\4")))
    Would show the fully qualified path as stored in key "4", which has a value of "%TEMP%".

    Unfortunately there's no easy way of saving say a real number. It'll need some conversion to integer. Alternatively you could save it as a string using rtos, just ensure your precision is set high enough not to loose accuracy.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  3. #3
    I could stop if I wanted to
    Join Date
    2001-07
    Posts
    318
    Login to Give a bone
    0

    Default Re: Type info into the registry

    Thanks for the info and the link.
    You're right, at first sight there no way to save a real in the registry.
    So I'll stay working with strings.
    Thanks

  4. #4
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: Type info into the registry

    You check around; somebody may have written a LISP callable .NET DLL to handle this circumstance.
    If you are going to fly by the seat of your pants, expect friction burns.
    Some say beauty is in the eye of the Beholder... perhaps so, but I've only seen the disintegration beam.
    Everyone else being wrong is not the same thing as being right.

  5. #5
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Type info into the registry

    Yes, it might be possible to use something through NET to cast the real variable to a binary array and then save to registry as a REG_BINARY. Read and cast back to double / extended. Unfortunately lisp doesn't seem to have a way of casting a variable into another type.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

Similar Threads

  1. 2012: Schedules: Family Type Parameter info
    By JSeferian in forum Revit MEP - General
    Replies: 1
    Last Post: 2011-12-27, 03:18 PM
  2. More info on "Family Type" type of Parameter
    By jsteinhauer in forum Revit Architecture - Families
    Replies: 7
    Last Post: 2008-03-19, 11:19 PM
  3. Displaying wall type info on plan
    By jwilhelm in forum Revit Architecture - General
    Replies: 4
    Last Post: 2004-12-31, 06:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •