Hey, Well, after a bit of learning curve here Is what I am currently using to fit my need of automating my Windows start-up routine. #Include <GuiToolBar.au3>
AutoItSetOption("TrayIconHide", 1)
Global $sToolTipTitle = "WinVNC" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here
Global $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)
Global $isWinvncRunning = "" ;
Global $isHamachiRunning = "" ;
If $iSystray_ButtonNumber = 0 Then
$isWinvncRunning = "False"
;MsgBox(16, "Error", "winvnc is not running")
$sToolTipTitle = "Hamachi" ;
$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)
If $iSystray_ButtonNumber = 0 Then
$isHamachiRunning = "False"
;MsgBox(16, "Error", "Hamachi is not running")
Else
$isHamachiRunning = "True"
;MsgBox(16, "Error", "Hamachi is running")
EndIf
Else
$isWinvncRunning = "True"
;MsgBox(16, "Error", "winvnc is running")
$sToolTipTitle = "Hamachi" ;
$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)
If $iSystray_ButtonNumber = 0 Then
$isHamachiRunning = "False"
;MsgBox(16, "Error", "Hamachi is not running")
Else
$isHamachiRunning = "True"
;MsgBox(16, "Error", "Hamachi is running")
EndIf
EndIf
Select
Case $isHamachiRunning = "True" And $isWinvncRunning = "True"
;MsgBox(0, "", "Both Are True")
RunWait('C:\Windows\System32\HIDE.EXE /w c:\windows\syswow64\cmd.exe /c c:\windows\sysnative\cmd.exe /c start /b /w /D"C:\StartAndEnd\scripts" ProcessExplorerTrueTrue.ahk', "", @SW_HIDE)
Case $isHamachiRunning = "False" And $isWinvncRunning = "False"
;MsgBox(0, "", "Both Are False")
RunWait('C:\Windows\System32\HIDE.EXE /w c:\windows\syswow64\cmd.exe /c c:\windows\sysnative\cmd.exe /c start /b /w /D"C:\StartAndEnd\scripts" ProcessExplorerFalseFalse.ahk', "", @SW_HIDE)
Case $isHamachiRunning = "True" And $isWinvncRunning = "False"
;MsgBox(0, "", "Hamachi is Is True And WinVNC Is False")
RunWait('C:\Windows\System32\HIDE.EXE /w c:\windows\syswow64\cmd.exe /c c:\windows\sysnative\cmd.exe /c start /b /w /D"C:\StartAndEnd\scripts" ProcessExplorerTrueFalse.ahk', "", @SW_HIDE)
Case $isHamachiRunning = "False" And $isWinvncRunning = "True"
;MsgBox(0, "", "Hamachi Is False And WinVNC Is True")
RunWait('C:\Windows\System32\HIDE.EXE /w c:\windows\syswow64\cmd.exe /c c:\windows\sysnative\cmd.exe /c start /b /w /D"C:\StartAndEnd\scripts" ProcessExplorerFalseTrue.ahk', "", @SW_HIDE)
Case Else
MsgBox(0, "", "Bug")
EndSelect
Exit
;............
Func Get_Systray_Index($sToolTipTitle)
; Find systray handle
Local $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Exit
EndIf
; Get systray item count
Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount = 0 Then
MsgBox(16, "Error", "No items found in system tray")
Exit
EndIf
; Look for wanted tooltip
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) > 0 Then ExitLoop
Next
If $iSystray_ButtonNumber = $iSystray_ButCount Then
Return 0 ; Not found
Else
Return $iSystray_ButtonNumber ; Found
EndIf
EndFuncSo pretty simple really. It is checking to see if two products are running, Hamachi and WinVNC. Then running the correct AutoHotkey script to do a few things to Process Explorer when I boot up my computer. I'm also making use of Easy Macro Recorder @ http://www.flashplayerpro.com/MacroRecorder/ to do a few things. So using AutoIt, AutoHotkey, and Easy Macro Recorder. I'm sure AutoIt can probably do everything I need but don't know how, yet. I left a lot of extra stuff in there for my debugging needs. I'm just glad Windows finally (with Win7) remembers placement of system tray icons. Thanks for all the help. Will