Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Persistent Variables

  1. #11
    Member
    Join Date
    2009-03
    Posts
    33
    0 Did you find this post helpful? Yes

    Default Re: Persistent Variables

    per-var.txt

    This is after I tested the code, the original was just blank. I'll look into your suggestions too, I always find out I end up using 10 lines of code when 3 will work.

    I don't know how it would work with combining the "w" and "r" parts of the first portion. Can you use (read-line) when the file is open to "W"? The first portion is there to create the file if its not found. If you can't use read-line there, it would need closed and re-opened as "R" anyway, if you can, then it would only need the "w" either way. Experiment time I'd say... looks like nope. Still neat thought, I haven't considered using an if function like that thought it makes sense now that I'm looking at it. Still I'm kinda slapping my head that I didn't use the (getenv "userprofile") from the get-go. Can't assume everyone uses c:\ for their system files. Could probably ditch the documents folder too, just in case someone had gotten rid of that folder. Or add a "search-and-create-if-not-found" snippet for the document folder.

  2. #12
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    3,702
    0 Did you find this post helpful? Yes

    Default Re: Persistent Variables

    Quote Originally Posted by ccalder View Post
    ... I always find out I end up using 10 lines of code when 3 will work.
    Such is the nature of development; you should see my .NET applications source-code.



    Quote Originally Posted by ccalder View Post
    I don't know how it would work with combining the "w" and "r" parts of the first portion. Can you use (read-line) when the file is open to "W"? The first portion is there to create the file if its not found. If you can't use read-line there, it would need closed and re-opened as "R" anyway, if you can, then it would only need the "w" either way. Experiment time I'd say... looks like nope. Still neat thought, I haven't considered using an if function like that thought it makes sense now that I'm looking at it. Still I'm kinda slapping my head that I didn't use the (getenv "userprofile") from the get-go. Can't assume everyone uses c:\ for their system files. Could probably ditch the documents folder too, just in case someone had gotten rid of that folder. Or add a "search-and-create-if-not-found" snippet for the document folder.
    Your original code perplexed me, being hones; I just slapped that together while my project submittal was printing, hence wanting to know more.

    I still feel that this is a bit more complicated than it needs to be - creating a new mechanism for storing typed-values to an external file, when there already exists a low-risk means by which to do same using built-in functions with HKCU hive in Registry.

    Cheers
    "Potential has a shelf life." - Margaret Atwood

    Autodesk Exchange Apps
    ~ Autoloader ~ AutoCAD Security

Page 2 of 2 FirstFirst 12

Posting Permissions

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