if statements

maximilianscherr MaximilianScherr at T-Online.de
Fri Jan 18 09:38:42 EST 2002


That's my script, ill write my question to the right:

import os

from Tkinter import *

def ixsave():
    if ixisfile == 1:
        os.remove("ilaunch.xml")
        
    xmlstr = "<?xml version='1.0'?>"
    xmlstr = xmlstr +"<config"
    xmlstr = xmlstr +"last_server=\"0\""
    xmlstr = xmlstr +"last_client=\"0\""
    xmlstr = xmlstr +"client_dir=\""+ ptceentry.get() +"\""
    xmlstr = xmlstr +"ignition_cfg=\""+ pticentry.get() 
+"\Ignition.cfg\""
    xmlstr = xmlstr +"use_injection=\""+ useinjvar.get() +"\""
    xmlstr = xmlstr +"close=\"true\""
    xmlstr = xmlstr +">"
    xmlstr = xmlstr +"<server name=\"Ultima Online: A New Age\" 
address=\"uoana.dyndns.org,5003\" username=\""+ anentry.get() +"\" 
password=\""+ apentry.get() +"\"/>"
    xmlstr = xmlstr +"<client name=\"client.exe\" path=\""+ 
ptceentry.get() +"\client.exe\"/>"
    xmlstr = xmlstr +"</config>"
    ix = open("ilaunch.xml", "w")
    ix.write(xmlstr)
    ix.close()

def uoanacsave():
    if uoanacisfile == 1:
        os.remove("uoana.cfg")
        
    writean = anentry.get()
    writeap = apentry.get()
    writeptce = ptceentry.get()
    writeptic = pticentry.get()
    writeuseinj = useinjvar.get()
    writeixtolm = str(os.path.getmtime("ilaunch.xml"))
    cfgstr = writean +"\n"
    cfgstr = cfgstr + writeap +"\n"
    cfgstr = cfgstr + writeptce +"\n"
    cfgstr = cfgstr + writeptic +"\n"
    cfgstr = cfgstr + writeuseinj +"\n"
    cfgstr = cfgstr + writeixtolm
    uoanac = open("uoana.cfg", "w")
    uoanac.write(cfgstr)
    uoanac.close()
    
def savecheck():
    if uoanacisfile == 0:
        ixsave()
        uoanacsave()
        
    if uoanacisfile == 1:
        if ixisfile == 0:
            if anentry.get() != readan or apentry.get() != readap or 
ptceentry.get() != readptce or pticentry.get() != readptic or 
useinjvar.get() != readuseinj:
                ixsave()
                uoanacsave()

            if anentry.get() == readan and apentry.get() == readap 
and ptceentry.get() == readptce and pticentry.get() == readptic and 
useinjvar.get() == readuseinj:
                ixsave()
                
        if ixisfile == 1:
            if str(os.path.getmtime("ilaunch.xml")) != readixtolm:
                if anentry.get() != readan or apentry.get() != readap 
or ptceentry.get() != readptce or pticentry.get() != readptic or 
useinjvar.get() != readuseinj:
                    ixsave()
                    uoanacsave()

                if anentry.get() == readan and apentry.get() == 
readap and ptceentry.get() == readptce and pticentry.get() == 
readptic and useinjvar.get() == readuseinj:
                    ixsave()

            if str(os.path.getmtime("ilaunch.xml")) == readixtolm:
                if anentry.get() != readan or apentry.get() != readap 
or ptceentry.get() != readptce or pticentry.get() != readptic or 
useinjvar.get() != readuseinj:
                    ixsave()
                    uoanacsave()
                    
def launch():
    savecheck()                       <---ok heres my big question
    ie = os.popen("ilaunch.exe", "w") <---how can i start that prog
    ie.write("L")                     <---(normal windows one) and 
    ie.close()                        <---send a keyboard input to
                                      <---it like "l", cause it has
def close():<---would this overwrite  <---a button binding for launch
    savecheck()<-the normal file.close()
    window.quit()
    
uoanacisfile = os.path.isfile("uoana.cfg")
ixisfile = os.path.isfile("ilaunch.xml")
if uoanacisfile == 1:
    uoanac = open("uoana.cfg", "r")
    readan = uoanac.readline()[:-1]
    readap = uoanac.readline()[:-1]
    readptce = uoanac.readline()[:-1]
    readptic = uoanac.readline()[:-1]
    readuseinj = uoanac.readline()[:-1]
    readixtolm = uoanac.readline()
    uoanac.close()
    
window = Tk()
window.title("Ultima Online: A New Age")
window.iconbitmap("uoana.ico")
infolabel = Label(window, text="Information")
infolabel.pack()
infotext = Text(window)
infotext.pack()
emptylabel1 = Label(window, text="")
emptylabel1.pack()
anlabel = Label(window, text="Account Name")
anlabel.pack()
anentry = Entry(window, width=40)
anentry.pack()
if uoanacisfile == 1:
    anentry.insert(0, readan)
    
emptylabel2 = Label(window, text="")
emptylabel2.pack()
aplabel = Label(window, text="Password")
aplabel.pack()
apentry = Entry(window, show="*", width=40)
apentry.pack()
if uoanacisfile == 1:
    apentry.insert(0, readap)
    
emptylabel3 = Label(window, text="")
emptylabel3.pack()
ptcelabel = Label(window, text="Path to client.exe")
ptcelabel.pack()
ptceentry = Entry(window, width=40)
ptceentry.pack()
if uoanacisfile == 1:
    ptceentry.insert(0, readptce)
    
emptylabel4 = Label(window, text="")
emptylabel4.pack()
pticlabel = Label(window, text="Path to Ignition.cfg")
pticlabel.pack()
pticentry = Entry(window, width=40)
pticentry.pack()
if uoanacisfile == 1:
    pticentry.insert(0, readptic)
    
emptylabel5 = Label(window, text="")
emptylabel5.pack()
useinjvar = StringVar()
useinjcheckbutton = Checkbutton(window, offvalue="false", 
onvalue="true", text="Use Injection", variable=useinjvar)
useinjcheckbutton.pack()
useinjcheckbutton.deselect()
if uoanacisfile == 1:
    if readuseinj == "true":
        useinjcheckbutton.select()
        
launchbutton = Button(window, command=launch, text="Launch")
launchbutton.pack(side=LEFT)
closebutton = Button(window, command=close, text="Close")
closebutton.pack(side=RIGHT)
window.mainloop()

--- In python-list at y..., "Chris Gonnerman" <chris.gonnerman at n...> 
wrote:
> Yeah, that's right... why don't you post more of your script
> so we can help you?
> 
> ----- Original Message ----- 
> From: "maximilianscherr" <MaximilianScherr at T...>
> To: <python-list at c...>
> Sent: Friday, January 18, 2002 7:23 AM
> Subject: if statements
> 
> 
> > how can i include more stuff into if statements, like
> > if var1 != 0 or var2 != 0 or var3 != 1:
> > ...
> > 
> > is this the right way? caus emy script doen't seem to cae what i 
> > wrote there, it just keeps on running
> > 
> > 
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list
> > 
> > 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list