Sign in to follow this  
Followers 0
HexCore

Review my code - suggestions needed

1 post in this topic

Looking for some advice here, due to the awesome guru's in these forums I have come up with the below code, I would like to ensure that it is clean code..

I am not sure if I'm using the AdlibRegister correctly for my "_Win_Act" function... ??

My 2nd issue is this, I belive I could use IE.au3 to assist but wasn't seeing examples that I would help me understand to apply the code, I did look at the help file and the light was just not going off...

My issue with the way I'm using the "_Win_Act" function is the following:

what I am doing is showing canned reports & 2 weather pages... I would like to refresh the reports every 24hrs and the weather pages every 2hrs or so, as when I just the page run the radar view has some issues, I have seen that with the refresh this issue is no longer present..

my goals are:

1- ensure IE is running in Theatre mode ( I was trying to get this done using IE.au3 include but couldn't figure it out.. I didn't understand what to set $oIE to globably to ensure that theatre mode was enabled... )

2- get my weather IE pages refreshed every few hours ( I would prefer to do the refreshes in the background, I don't like the way this looks when it sets focus to the weather radar page and sends a refresh, with the page active you see the screen re-draw, would prefer the refresh to happen in the background

3 - send a refresh every 24hrs to ensure daily stats are updated.

; Use ESC to quit
HotKeySet("{ESC}", "On_Exit")
;Window names for Array
$RivTitle = "[Title:Cisco Unified Computing System Manager - Vyyyy]"
$DenTitle = "[Title:Cisco Unified Computing System Manager - Vxxxx]"
; Get the initial size and position
$aInitPos_Riv = WinGetPos($RivTitle)
$aInitPos_Den = WinGetPos($DenTitle)
; Run the check every 5 secs
AdlibRegister("_Check_Pos", 5000)
AdlibRegister("_Win_Act" , 5000)
; And keep the script alive
While 1
    Sleep(10)
WEnd
; This is what is run every 5 secs
Func _Check_Pos()
    ; Clear a flag
    $fChanged_Riv = False
$fChanged_Den = False
    ; Get the current position
    $aCurrPos_Riv = WinGetPos($RivTitle)
$aCurrPos_Den = WinGetPos($DenTitle)
    For $i = 0 To 3
        ; if the value is not what it was initially
        If $aCurrPos_Riv[$i] <> $aInitPos_Riv[$i] Then
            ; set the flagtr
            $fChanged_Riv = True
        EndIf
  if $aCurrPos_Den[$i] <> $aInitPos_Den[$i] Then
   ;set the flag
   $fChanged_Den = True
  EndIf
    Next
    ; if the flag is set
    If $fChanged_Riv Then
        ; Reset ehe windoe to the initial pos and size
        WinMove($RivTitle, "", $aInitPos_Riv[0], $aInitPos_Riv[1], $aInitPos_Riv[2], $aInitPos_Riv[3])
        ConsoleWrite(@SEC & " - Reset window Riverview UCS" & @CRLF)
    Else
        ConsoleWrite(@SEC & "Riverview UCS - Window had not changed" & @CRLF)
    EndIf
If $fChanged_Den Then
  WinMove($DenTitle, "", $aInitPos_Den[0], $aInitPos_Den[1], $aInitPos_Den[2], $aInitPos_Den[3])
  ConsoleWrite(@SEC & " - Reset window Denver UCS" & @CRLF)
Else
  ConsoleWrite(@SEC & "Denver UCS - Window had not changed" & @CRLF)
  EndIf
EndFunc
Func On_Exit()
    Exit
EndFunc
;Activating IE tabs to set focus on window - dashboard stats & weather
Func _Win_Act()
sleep(40000)
WinActivate("System Center Operations Manager","Lync")
sleep(40000)
WinActivate("System Center Operations Manager","Hyper")
sleep(40000)
WinActivate("System Center Operations Manager","Exchange")
sleep(40000)
WinActivate("Cisco Unified Computing System Manager - Vyyyy")
WinActivate("Cisco Unified Computing System Manager - Vxxxx")
sleep(40000)
WinActivate("Tampa, Florida")
send ("{F5}")
sleep(40000)
WinActivate("Forefront Dashboard")
sleep(40000)
WinActivate("Denver, Colorado")
send ("{F5}")
sleep(40000)
WinActivate("Security Summary")
sleep(40000)
WinActivate("PasswordDashboard")
sleep(40000)
WinActivate("AgingIncidentsDashboard")
sleep(40000)
WinActivate("AvayaCallsDashboard")
sleep(40000)
WinActivate("IncidentSatisfactionDashboard")
sleep(40000)
WinActivate("IncidentsChartDashboard")
EndFunc

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