Thread: New to python

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    New to python


    Hi all,

    I'm looking to create a py script which basically automates all of my day to day habits such as after I login update my av, check for updates for my firewall open thunderbird and check for new emails.

    But first I would like a way to authenticate the name for security purposes. is this possible with an if statement?

    Is all of this possible and if so could someone give me an idea on how to start it.

    Thanks in advance and this is what I have so far. not very much

    Code:
    import os
    
    greet = input("What is your name? ") # wait for user input
    if "Glynn":
        print ("Hello " + greet) # print name & greeting
    
    level1 = input("What would you like to do? ") # more user input
    
    if "Check Email":
        import subprocess
        subprocess.call(['C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe'])
    Last edited by pylover; July 9th, 2012 at 11:48 AM. Reason: Finished part of the code now onto elif statements :)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    55
    Rep Power
    3
    This is an awesome starting project. Though, forgive me if I am wrong, but wouldnt it be easier to simply click the Thunderbird icon as opposed to opening this, typing it in, etc? Sounds like de-automation to me!
    Perhaps write it to check for new emails by its self and a few others things in one click. Thats luxury!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    6
    Rep Power
    0
    I never thought of it like that this is just my starting project put everything I learn into a script which I can always come back to but what you said does sound pretty good wish I had thought of that, I might try that later.

    and now i'm stuck on if statements trying to create a menu with a list e.g

    print"""menu
    1) Check Emails
    2) Update AV
    3) Browse the web"""

    if 1 .... can't seem to get the syntax right.
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,905
    Rep Power
    481
    Code:
    greet = input("What is your name? ") # wait for user input
    
    if "Glynn" == greet:   #### See the test?????
        print ("Hello " + greet) # print name & greeting
    
    level1 = input("What would you like to do? ") # more user input
    
    if '1' == level1: # Check Email  ####  See the test?
        import subprocess
        subprocess.call(['C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe'])
    [code]Code tags[/code] are essential for python code and Makefiles!
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    6
    Rep Power
    0
    thank you b49P23TIvg, for this snippet it looks alot cleaner than mine. hopefully one day mine might be as clean.
  10. #6
  11. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,905
    Rep Power
    481

    huh?


    It's the same as your snippet except that
    "a non-empty string is always true"
    "a" == b # truth depends upon the value of b
    [code]Code tags[/code] are essential for python code and Makefiles!
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    6
    Rep Power
    0
    Right well it looks like i'll have to understand python a little more.

IMN logo majestic logo threadwatch logo seochat tools logo