Sign in to follow this  
Followers 0
Golbez

problem closing window

4 posts in this topic

When i open zone alarm and the window is open. the "winclose" command is not closing the window and i dont no why. I also tried the "winkill" command. it did not work eather :P

someone help me plz? ;)

btw. im tring 2 make a program 2 run on start up that will open 3 programs that for some reason my computer fucks up if other stuff is not booted first. so i make it so the 3 programs opened after time passes and what im looking for in this post is a way to close the program windows if they are opened. i cant get the windows to close :whistle:

Code

;#NoTrayIcon
Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText", 1)
Global $OpenTime, $PDir, $Popen, $Popentime, $TDir, $Topen, $Topentime, $Twaittime, $ZDir, $Zopen, $ZopenTime, $Pwinname, $Twinname, $Zwinname

LoadIni()
Sleep($OpenTime)
If $Popen = 1 then
    Sleep($Popentime)
    run($PDir)
    IF WinExists ($Pwinname) = 1 then WinClose ($Pwinname)
EndIf
If $Topen = 1 then
    Sleep($Topentime)
    run($TDir)
    Sleep($Twaittime)
    If WinExists($Twinname) Then
        send("{ENTER}")
    ElseIf WinExists($Twinname) Then
        send("{ENTER}")
    EndIf
EndIf
If $Zopen = 1 then
    If $Topen = 1 And $Popen = 1 Then $ZopenTime = $ZopenTime - ($Topentime + $Popentime)
    If $Topen = 1 And $Popen = 0 Then $ZopenTime = $ZopenTime - $Topentime
    If $Popen = 1 And $Topen = 0 Then $ZopenTime = $ZopenTime - $Popentime
    Sleep($ZopenTime)
    run($ZDir)
    IF WinExists ($Zwinname) = 1 then WinClose ($Zwinname)
EndIf
Exit

Func LoadIni()
;PStart
    $Popen = IniRead ("RunStuff.ini", "PStart", "PStart", "1")
    $Popentime = IniRead ("RunStuff.ini", "PStart", "OpenTime", "1")
    $Pwinname = IniRead ("RunStuff.ini", "PStart", "WindowName", "PStart")
    $PDir= IniRead ("RunStuff.ini", "PStart", "PStartDir", "C:\Program Files\Pegtop\PStart\PStart.exe")
;Tray It
    $Topen = IniRead ("RunStuff.ini", "TrayIt", "TrayIt", "1")
    $Topentime = IniRead ("RunStuff.ini", "TrayIt", "OpenTime", "500")
    $Twaittime = IniRead ("RunStuff.ini", "TrayIt", "WaitTime", "500")
    $Twinname = IniRead ("RunStuff.ini", "TrayIt", "WindowName", "TrayIt!")
$TDir= IniRead ("RunStuff.ini", "TrayIt", "TrayItDir", "C:\Program Files\TrayIt\trayit!.exe")
;ZoneAlarm
    $Zopen = IniRead ("RunStuff.ini", "ZoneAlarm", "ZoneAlarm", "1")
    $ZopenTime = IniRead ("RunStuff.ini", "ZoneAlarm", "OpenTime", "180000")
    $Zwinname = IniRead ("RunStuff.ini", "ZoneAlarm", "WindowName", "ZoneAlarm")
    $ZDir= IniRead ("RunStuff.ini", "ZoneAlarm", "ZoneAlarmDir", "C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe")
;Other
    $OpenTime = IniRead ("RunStuff.ini", "Other", "OpenTime", "5000")
EndFunc

ini

**********************************************************
**                      NOTES:                          **
**                                                      **
**  60000=1 minute  120000=2 minutes  180000=3 minutes  **  
**  C:\Program Files\Pegtop\PStart\PStart.exe           **
**  C:\Program Files\TrayIt\trayit!.exe                 **
**  C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe   **
**  1 = Yes     0 = No                                  **
**      EX:  PStart=0,  This Turns PStart load off  **
**********************************************************

[Pstart]
PStart=0
OpenTime=5000
WindowName=PStart
PStartDir=C:\Program Files\Pegtop\PStart\PStart.exe

[TrayIt]
TrayIt=1
WaitTime=400
OpenTime=5000
WindowName=TrayIt!
TrayItDir=C:\Program Files\TrayIt\trayit!.exe

[ZoneAlarm]
ZoneAlarm=0
OpenTime=180000
WindowName=ZoneAlarm Pro
ZoneAlarmDir=C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe

[Other]
OpenTime=5000

Share this post


Link to post
Share on other sites



Try using the classname= option + Opt('WinTitleMatchMode', 4) + Opt('WinSearchChildren', 1)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

tried and failed BUT i might have done it wroung..

btw do u no that it works of hand?

btw thanks for the fast replay smoke :whistle:

edit: heres my test n not working....

;#NoTrayIcon
Opt("WinDetectHiddenText", 1)
Opt("WinSearchChildren", 1)
Global $OpenTime, $PDir, $Popen, $Popentime, $TDir, $Topen, $Topentime, $Twaittime, $ZDir, $Zopen, $ZopenTime, $Pwinname, $Twinname, $Zwinname

LoadIni()
Opt("WinTitleMatchMode", 4)
classname=$Zwinname
IF WinExists ($Zwinname) = 1 then 
    WinKill ($Zwinname)
    WinClose ($Zwinname)
    $R = 1
Else
    $R = 0
EndIf
MsgBox("", "Test", WinKill ($Zwinname) & WinClose ($Zwinname))

exit
Sleep($OpenTime)
If $Popen = 1 then
    Opt("WinTitleMatchMode", 4)
    Sleep($Popentime)
    run($PDir)
    IF WinExists ($Pwinname) = 1 then WinClose ($Pwinname)
EndIf
If $Topen = 1 then
    Opt("WinTitleMatchMode", 2)
    Sleep($Topentime)
    run($TDir)
    Sleep($Twaittime)
    If WinExists($Twinname) Then
        send("{ENTER}")
    ElseIf WinExists($Twinname) Then
        send("{ENTER}")
    EndIf
EndIf
If $Zopen = 1 then
    Opt("WinTitleMatchMode", 4)
    If $Topen = 1 And $Popen = 1 Then $ZopenTime = $ZopenTime - ($Topentime + $Popentime)
    If $Topen = 1 And $Popen = 0 Then $ZopenTime = $ZopenTime - $Topentime
    If $Popen = 1 And $Topen = 0 Then $ZopenTime = $ZopenTime - $Popentime
    Sleep($ZopenTime)
    run($ZDir)
    IF WinExists ($Zwinname) = 1 then WinClose ($Zwinname)
EndIf
Exit

Func LoadIni()
;PStart
    $Popen = IniRead ("RunStuff.ini", "PStart", "PStart", "1")
    $Popentime = IniRead ("RunStuff.ini", "PStart", "OpenTime", "1")
    $Pwinname = IniRead ("RunStuff.ini", "PStart", "WindowName", "PStart")
    $PDir= IniRead ("RunStuff.ini", "PStart", "PStartDir", "C:\Program Files\Pegtop\PStart\PStart.exe")
;Tray It
    $Topen = IniRead ("RunStuff.ini", "TrayIt", "TrayIt", "1")
    $Topentime = IniRead ("RunStuff.ini", "TrayIt", "OpenTime", "500")
    $Twaittime = IniRead ("RunStuff.ini", "TrayIt", "WaitTime", "500")
    $Twinname = IniRead ("RunStuff.ini", "TrayIt", "WindowName", "TrayIt!")
$TDir= IniRead ("RunStuff.ini", "TrayIt", "TrayItDir", "C:\Program Files\TrayIt\trayit!.exe")
;ZoneAlarm
    $Zopen = IniRead ("RunStuff.ini", "ZoneAlarm", "ZoneAlarm", "1")
    $ZopenTime = IniRead ("RunStuff.ini", "ZoneAlarm", "OpenTime", "180000")
    $Zwinname = IniRead ("RunStuff.ini", "ZoneAlarm", "WindowName", "ZoneAlarm")
    $ZDir= IniRead ("RunStuff.ini", "ZoneAlarm", "ZoneAlarmDir", "C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe")
;Other
    $OpenTime = IniRead ("RunStuff.ini", "Other", "OpenTime", "5000")
EndFunc
Edited by Golbez

Share this post


Link to post
Share on other sites

anyone? ;)

i cant get it and i havent gone 2 sleep yet xD

i now have 2 go 2 work :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0