Results 1 to 3 of 3

Thread: Using LISP and/or Visual LISP to find something

  1. #1
    Active Member
    Join Date
    2007-02
    Location
    Calgary, Alberta, Canada
    Posts
    73
    Login to Give a bone
    0

    Default Using LISP and/or Visual LISP to find something

    I'm trying to create a LISP file by writing Visual LISP and LISP.

    I want it to find a key in the Windows registry, and if it doesn't find it, then return nil.
    If it does find it, change the key.

    Here is what I have so far, and it works. My probilem is the part that says "CADWorx 2007". I want it to find this key, and if it doesn't, then return nil, but if it does find it, use the code below to change the key. Then I want it to search for the same thing, except it says "CADWorx 2008". If it finds it, change the key (using the code below),and if it doesn't find it, then return nil.


    Code:
    (defun C:test ()
    
    
    (vl-registry-write "HKEY_USERS\\S-1-5-21-1794388629-2076409663-1235820382-4565\\Software\\COADE, Inc.\\CADWorx 2007\\Plant\\Settings"
    "Configuration 17" "J:/CAD/CADWorx System Config Files/test.cfg")
    
    )

    Any help is greatly appreciated.

    Last edited by Opie; 2008-02-04 at 02:37 PM. Reason: [CODE] tags added, see Moderator Note

  2. #2
    Active Member
    Join Date
    2007-02
    Location
    Calgary, Alberta, Canada
    Posts
    73
    Login to Give a bone
    0

    Default Re: Using LISP and/or Visual LISP to find something

    Well, no one I talked to can figure it out.

    Here's what I have done now:

    Code:
    (defun C:test ( / |reg-key1| |reg-key2|)
    
    ;_we are going to program the first key path to |reg-key1|
     (SETQ |reg-key1|
       (STRCAT "HKEY_USERS\\S-1-5-21-1794388629-2076409663-1235820382-4565\\Software\\COADE, Inc.\\CADWorx 2007\\Plant\\Settings"
       ) ;_ end of STRCAT
     ) ;_ end of setq
    
    ;_we are going to program the second key path to |reg-key2|
     (SETQ |reg-key2|
       (STRCAT "HKEY_USERS\\S-1-5-21-1794388629-2076409663-1235820382-4565\\Software\\COADE, Inc.\\CADWorx 2008\\Plant\\Settings"
       ) ;_ end of STRCAT
     ) ;_ end of setq
    
    ;_we are going to insert |reg-key1| into Windows' registry
     (vl-registry-write |reg-key1| 
       "Configuration 17" "J:/CAD/CADWorx System Config Files/EnCana.cfg"
     ) ;_writes variable to the set registry key
    
    ;_we are going to insert |reg-key2| into Windows' registry
     (vl-registry-write |reg-key2| 
       "Configuration 17" "J:/CAD/CADWorx System Config Files/EnCana.cfg"
     ) ;_writes variable to the set registry key
    
     (princ)
    
    )
    Last edited by Opie; 2008-02-04 at 02:37 PM. Reason: [CODE] tags added, see Moderator Note

  3. #3
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Using LISP and/or Visual LISP to find something

    Something like this doesn't work?
    Code:
    (defun C:test ()
    
      (defun reg_updt (target)
      (if
        (null
         (vl-registry-read
                 (strcat "HKEY_USERS\\S-1-5-21-1794388629-2076409663-1235820382-4565\\Software\\COADE, Inc.\\"
                         target  "\\Plant\\Settings")))
         nil
         (vl-registry-write (strcat "HKEY_USERS\\S-1-5-21-1794388629-2076409663-1235820382-4565\\Software\\COADE, Inc.\\"
                                    target "\\Plant\\Settings")
                  "Configuration 17" "J:/CAD/CADWorx System Config Files/test.cfg")
        )
      )
    
      (setq result1 (reg_updt "CADWorx 2007"))
      (setq result2 (reg_updt "CADWorx 2008"))
      
      (princ)
    )

Similar Threads

  1. visual lisp editor should be like visual studio
    By Wish List System in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2011-11-17, 05:33 PM
  2. Programacion en Lisp y Visual Lisp
    By ralmavar in forum AutoCAD General
    Replies: 7
    Last Post: 2009-06-15, 01:52 PM
  3. Visual LISP vs VBA
    By lxpichet in forum AutoCAD Customization
    Replies: 14
    Last Post: 2009-04-07, 10:56 PM
  4. Visual LISP: If and then?
    By mikelf in forum AutoLISP
    Replies: 4
    Last Post: 2008-04-17, 10:46 PM

Posting Permissions

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