Solved

registration checker

Posted on 2011-03-17
3
336 Views
Last Modified: 2012-06-27
Itrying to  have my registration checker will be looking in registry :
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\SEMS\
for key:
Expiration
value in format:
MM/DD/YYYY
(month/day can be 1 or 2 characters in length, year will always be 4)

then warns you if you are <60 days from expiration and has a different message for last day usable.

If not online, use computer clock - if online get online time and update "last time online" to current date. (also in format MM/DD/YYYY)

This is the code I am trying to modify

aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE\SOFTWARE\SEMS\)
I keep getting a syntax error

Open in new window

from _winreg import *

print r"*** Reading from SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***"
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)

aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run") 
for i in range(1024):                                           
    try:
        n,v,t = EnumValue(aKey,i)
        print i, n, v, t
    except EnvironmentError:                                               
        print "You have",i," tasks starting at logon..."
        break          
CloseKey(aKey) 

Open in new window

                                               
0
Comment
Question by:dolamitejenkins
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
Comment Utility
The ConnectRegistry function is looking for the root registry handle to open (e.g,. HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER).  It's not looking for the actual key that you want to work with.  That key is specified in the OpenKey call.

from _winreg import *

aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"SOFTWARE\SEMS")
expiration = QueryValueEx(aKey, "Expiration")
print expiration
CloseKey(aKey)

Open in new window

0
 

Author Comment

by:dolamitejenkins
Comment Utility
thanks
0
 

Author Closing Comment

by:dolamitejenkins
Comment Utility
Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now