[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

registration checker

Posted on 2011-03-17
3
Medium Priority
?
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 2000 total points
ID: 35161357
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
ID: 35162069
thanks
0
 

Author Closing Comment

by:dolamitejenkins
ID: 35173802
Thanks
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
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…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…
Suggested Courses

649 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