Jump to content

Script will not close on Exit


Recommended Posts

Here is what I have:

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",1)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

$n = 13

$r = 0

Do

MsgBox(0, "Test","$n = " & $n & " &r = " & $r,3)

GETSCSDATA($n,$r)

Sleep(3000)

Until $r = 1

MyCloseFunction()

Func MyCloseFunction()

Exit

EndFunc

Func GETSCSDATA($num,$rep)

Run('C:\WINDOWS\system32\mmc.exe /s "C:\Program Files\Symantec\Symantec System Center\Symantec System Center.msc"')

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

Send("{APPSKEY}u")

WinWait("Unlock Server Group","Remember this user n")

If Not WinActive("Unlock Server Group","Remember this user n") Then WinActivate("Unlock Server Group","Remember this user n")

WinWaitActive("Unlock Server Group","Remember this user n")

Send("{ENTER}")

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")

Send("{DOWN}")

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")

Send("+{DOWN " & $n & "}")

Sleep(1000)

IF WinActive("Symantec System Center - [Console Root\Reporting]","Console Root\Reporti") Then

Send("{ALTDOWN}{F4}{ALTUP}")

WinWait("Microsoft Management Console","Save console setting")

If Not WinActive("Microsoft Management Console","Save console setting") Then WinActivate("Microsoft Management Console","Save console setting")

WinWaitActive("Microsoft Management Console","Save console setting")

Send("n")

$r = 1

EndIf

WinWait("Program Manager","FolderView")

If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")

WinWaitActive("Program Manager","FolderView")

Sleep(1000)

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

Sleep(1000)

Send("{ALTDOWN}{ALTUP}al")

WinWait("Export List","Save &Only Selected ")

If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")

WinWaitActive("Export List","Save &Only Selected ")

Send("{SHIFTDOWN}dv{SHIFTUP}" & $n & "{ENTER}")

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

Send("v{ALTDOWN}{ALTUP}v{DOWN}{UP}{UP}{ESC}{ALTDOWN}{ALTUP}vs{ENTER}")

Sleep(1000)

Send("{ALTDOWN}{ALTUP}al")

WinWait("Export List","Save &Only Selected ")

If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")

WinWaitActive("Export List","Save &Only Selected ")

Send("{SHIFTDOWN}av{SHIFTUP}" & $n & "{ENTER}")

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

Send("{ALTDOWN}{ALTUP}vss{ENTER}{ALTDOWN}{ALTUP}al")

WinWait("Export List","Save &Only Selected ")

If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")

WinWaitActive("Export List","Save &Only Selected ")

Send("{SHIFTDOWN}fw{SHIFTUP}" & $n & "{ENTER}")

WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")

Send("{ALTDOWN}{F4}{ALTUP}")

WinWait("Microsoft Management Console","Save console setting")

If Not WinActive("Microsoft Management Console","Save console setting") Then WinActivate("Microsoft Management Console","Save console setting")

WinWaitActive("Microsoft Management Console","Save console setting")

Send("n")

$n = $n + 1

EndFunc

When $r = 1 the script stops running but stays in the tasktray. I want it to completely close... Any ideas please?

Link to comment
Share on other sites

Hi, could you format your code?

Use the blue A button in the web editor to get the autoit coloring tags. Also indenting code would be helpful. Make sure to use Global or Local to declare your variables. My guess is that you never reach the until part of the loop.

EDIT: PS, Welcome to the forum..:shocked:

Edited by Uten
Link to comment
Share on other sites

Hi should use some code or autoit tags when posting this much, but try this-

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",1)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

$n = 13
$r = 0
Do
    MsgBox(0, "Test","$n = " & $n & " &r = " & $r,3)
    GETSCSDATA($n,$r)
    Sleep(3000)
Until $r = 1

MyCloseFunction()

Func MyCloseFunction()
    Exit
EndFunc


Func GETSCSDATA($num,$rep)
    Run('C:\WINDOWS\system32\mmc.exe /s "C:\Program Files\Symantec\Symantec System Center\Symantec System Center.msc"')
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    Send("{APPSKEY}u")
    WinWait("Unlock Server Group","Remember this user n")
    If Not WinActive("Unlock Server Group","Remember this user n") Then WinActivate("Unlock Server Group","Remember this user n")
    WinWaitActive("Unlock Server Group","Remember this user n")
    Send("{ENTER}")
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents]","Console Root\Symante")
    Send("{DOWN}")
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents\Groups]","Console Root\Symante")
    Send("+{DOWN " & $n & "}")
    Sleep(1000)
    IF WinActive("Symantec System Center - [Console Root\Reporting]","Console Root\Reporti") Then
    Send("{ALTDOWN}{F4}{ALTUP}")
    WinWait("Microsoft Management Console","Save console setting")
    If Not WinActive("Microsoft Management Console","Save console setting") Then 
        WinActivate("Microsoft Management Console","Save console setting")
        WinWaitActive("Microsoft Management Console","Save console setting")
        Send("n")
    EndIf
    $r = 1
    WinWait("Program Manager","FolderView")
    If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")
    WinWaitActive("Program Manager","FolderView")
    Sleep(1000)
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    Sleep(1000)
    Send("{ALTDOWN}{ALTUP}al")
    WinWait("Export List","Save &Only Selected ")
    If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")
    WinWaitActive("Export List","Save &Only Selected ")
    Send("{SHIFTDOWN}dv{SHIFTUP}" & $n & "{ENTER}")
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    Send("v{ALTDOWN}{ALTUP}v{DOWN}{UP}{UP}{ESC}{ALTDOWN}{ALTUP}vs{ENTER}")
    Sleep(1000)
    Send("{ALTDOWN}{ALTUP}al")
    WinWait("Export List","Save &Only Selected ")
    If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")
    WinWaitActive("Export List","Save &Only Selected ")
    Send("{SHIFTDOWN}av{SHIFTUP}" & $n & "{ENTER}")
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    Send("{ALTDOWN}{ALTUP}vss{ENTER}{ALTDOWN}{ALTUP}al")
    WinWait("Export List","Save &Only Selected ")
    If Not WinActive("Export List","Save &Only Selected ") Then WinActivate("Export List","Save &Only Selected ")
    WinWaitActive("Export List","Save &Only Selected ")
    Send("{SHIFTDOWN}fw{SHIFTUP}" & $n & "{ENTER}")
    WinWait("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    If Not WinActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante") Then WinActivate("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    WinWaitActive("Symantec System Center - [Console Root\Symantec System Center\System Hierarchy\TVM-SCS3-WorkstationParents","Console Root\Symante")
    Send("{ALTDOWN}{F4}{ALTUP}")
    WinWait("Microsoft Management Console","Save console setting")
    If Not WinActive("Microsoft Management Console","Save console setting") Then WinActivate("Microsoft Management Console","Save console setting")
    WinWaitActive("Microsoft Management Console","Save console setting")
    Send("n")
    $n = $n + 1
EndFunc

You had a $r=1 assignment inside an If-Then-Endif Case that may never execute.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...