Jump to content

Status/progress bar to display until an exe is present in the Task Tray.


Recommended Posts

I have been searching the forums for some samples and came across the following script by member UEZ <> which provided a scrolling marquee. I can get it to function until the process is launched, but I need it to stay open until the it appears in the tray (hidden or shown). This is where I am running into some problems.

Here are my scenarios of how I need it to run.

- If no process (Agent.exe) is running after 5 seconds then stop marquee
- If process (Agent.exe) and tray (Systems Agent) are present then stop marquee
- If process (Agent.exe) is running but no tray (Systems Agent) then continue marquee until tray (Systems Agent) appears.

Here is the code I have so far. It runs until the process is detected then exits. But I need it to stay open until the tray icon appears as well. This way the user knows it has been launched but is just running in the background. Any help on this would be greatly appriciated. You can test on your own station by swapping out the "Agent.exe" with any of your local exe applications running.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$dir = False

GUICreate("Marquee Progress RTL", 400, 200)
$Progress = GUICtrlCreateProgress(10, 60, 380, 25, 0x08, 0x2000)
GUICtrlSendMsg($Progress, 0x040A, 1, 10)
GUISetState()
AdlibRegister("Reverse_Dir", 1350)

Do
;~ Until GUIGetMsg() = $GUI_EVENT_CLOSE

Until   ProcessExists("Agent.exe")
    Local $PID = ProcessExists("Agent.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessExists($PID)
Exit

Func Reverse_Dir()
    If $dir Then
        GUICtrlSetStyle($Progress, 0x08, 0x2000)
        $dir = False
    Else
        GUICtrlSetStyle($Progress, 0x08, $WS_EX_LAYOUTRTL)
        $dir = True
    EndIf
EndFunc

I ran the information tool to see what it returns for this exe in the tray menu and here is what I get, just in case someone is wondering.
>>>> Window <<<<
Title: 
Class: Shell_TrayWnd
Position: 0, 984
Size: 1280, 40
Style: 0x96000000
ExStyle: 0x00000088
Handle: 0x0000000000010084

>>>> Control <<<<
Class: ToolbarWindow32
Instance: 1
ClassnameNN: ToolbarWindow321
Name: 
Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1]
ID: 1504
Text: User Promoted Notification Area
Position: 1093, 2
Size: 102, 38
ControlClick Coords: 11, 24
Style: 0x56008B4D
ExStyle: 0x00000080
Handle: 0x00000000000100A4

>>>> ToolsBar <<<<
1: 3 Systems Agent

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...