Jump to content

SysTray_UDF


tuape
 Share

Recommended Posts

Hello,

After I use _SysTrayIconRemove(_SysTrayIconIndex($st_process)) to hide a icon, there is a empty space in the left of the clock (I think there is place for another icon). But if I start another app that has a tray icon, the systray refreshes and there is no empty space.

Is there a way to remove that empty space?

Here is a pic to be more specific :lmao:

Thank you.

The way to get rid of the empty space is to do something with a tray icon for example

Opt("TrayIconHide", 1); hide autoit tray icon
Opt("TrayIconHide", 0); show autoit tray icon
Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

* bump *

Can someone with Win2000 please try if getting tooltip texts work on that? Thanks.

It does not work on win 2000. Mouse cursor moves to start of tray but cannot move it. Same code works great in windows xp. Rats.

Dr SherlockAlways a way

Link to comment
Share on other sites

I downloaded the SysTray_UDF and integrated into automation code. After a few boo boos, it works great on Windows XP. Tired the same code on Windows 2000, the cursor moves to the start of the tray and that is it. Is there an update to this UDF? Thanks

Dr SherlockAlways a way

Link to comment
Share on other sites

  • 2 weeks later...

i was trying this UDF my turn ... very nice indeed ...

i have the following question ... all is running as expected BUT when i try to hide REALVNC icon (yeah, yeah ... i know ...) with _SysTrayIconRemove the icon reappear a few seconds later ...

When i use _SysTrayIconVisible(1, _SysTrayIconIndex($st_process)) the icon doesn't reappear even after completion of the script ...

Am i doing anything wrong ? do u have any idea why it behaves this way ?

Thanks !

Link to comment
Share on other sites

I am trying to remove the Windows Update icon from the System Tray. It looks like a yellow shield with a black explanation point. I believe the process name is wuauclt.exe (please correct me if I am wrong about this). The code below does not remove the icon from the tray. What am I doing wrong?

Thanks,

-John

#include "SysTray_UDF.au3"

$st_process = "wuauclt.exe"
_SysTrayIconRemove(_SysTrayIconIndex($st_process))
Link to comment
Share on other sites

  • 3 months later...
  • 7 months later...

Is it possible to check all icons for certain path (to some app), and if there is match, hide the icon? what i mean is, hide the icon only if it belongs to certain application exe path.. something like this:

$TrayPaths = _SysTrayIconGetPaths()
For $i = 0 To Ubound($TrayPaths)-1
      If $TrayPaths[$i] = "c:\some app\app.exe" Then _SysTrayIconVisible(1, $i)
Next

Is it possible?

Thanks.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

If combined with GUIConstants.au3 it gives me an error:

C:\PROGRA~1\AutoIt3\Include\WindowsConstants.au3(65,34) : ERROR: $WM_GETTEXT previously declared as a 'Const'

Global Const $WM_GETTEXT = 0x000D

Same thing happened to me. I commented it in SysTray_UDF.au3 cos I didn't need it.

Link to comment
Share on other sites

  • Moderators

If combined with GUIConstants.au3 it gives me an error:

C:\PROGRA~1\AutoIt3\Include\WindowsConstants.au3(65,34) : ERROR: $WM_GETTEXT previously declared as a 'Const'

Global Const $WM_GETTEXT = 0x000D

Same thing happened to me. I commented it in SysTray_UDF.au3 cos I didn't need it.

At the time this UDF was made, more than likely, these Constants where not defined.

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.

Link to comment
Share on other sites

The function _SysTrayIconPids() needs to be changed, so it will return a correct order of indexes in case that we have more then one similar process names:

Func _SysTrayIconPids()
    Local $i
    Local $titles = _SysTrayIconTitles()
    Local $processes[UBound($titles)]
    Local $ret
    
    For $i = 0 to Ubound($titles)-1
        $ret = DLLCall("user32.dll","int","GetWindowThreadProcessId", "int", _SysTrayIconHandle($i), "int_ptr", -1)
        If Not @error Then $processes[$i] = $ret[2]
    Next
    Return $processes
EndFunc

Thanks to amel27 for the correction in this func.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 4 weeks later...

Please help! Perhaps I'm being extraordinarily thick headed but I can't wrap my mind around this UDF. I run a few progs constantly on my home and work system and want to get something put together to clear these icons out of the tray.

#include "SysTray_UDF.au3"
MsgBox(0, "", WinGetProcess("Hamachi"))
MsgBox(0, "", WinGetHandle("Hamachi"))
MsgBox(0, "", _SysTrayIconIndex (WinGetProcess("Hamachi")))
MsgBox(0, "", _SysTrayIconIndex (WinGetHandle("Hamachi")))

The first two MsgBox()s return what you would assume they should (944 and 0x004C054A respectively) however MsgBox() 3 and 4 return -1. What am I doing wrong? The UDF seems to say that a PID or a Handle would work here. I assume if I get over this hump I can get _SysTrayIconRemove() to work and archive me goal. Thanks!

AutoIt changed my life.

Link to comment
Share on other sites

Something like...

;===============================================================================
;
; Function Name:    _SysTrayIconIndex($name, $mode=0)
; Description:    Get list of all processes id's that have systray icon
; Parameter(s):  $name = process name / window title text
;                   $mode 0 = get index by process name (default)
;                         1 = get index by window title
; Requirement(s):   AutoIt3 Beta
; Return Value(s):  On Success - Returns index of found icon
;                  On Failure - Returns -1 if icon for given process/wintitle
;                                was not found.
;                              - Sets error to 1 and returns -1 in case of bad
;                                arguments
; Author(s):        Tuape
;
;===============================================================================

#include "SysTray_UDF.au3"
MsgBox(0, "", WinGetProcess("Hamachi"))
MsgBox(0, "", WinGetProcess("Hamachi"))
MsgBox(0, "", _SysTrayIconIndex (WinGetProcess("Hamachi"), 0))
MsgBox(0, "", @error)
MsgBox(0, "", _SysTrayIconIndex (WinGetProcess("Hamachi"), 0))
MsgBox(0, "", @error)

What is the @error?

Link to comment
Share on other sites

  • 5 weeks later...

Due to the new update (v3.2.10.0), the following pieces of code are invalid.

Changed: DllCall(): short_ptr, long_ptr, int_ptr types deprecated. Use short*, long* and int* respectively.

Just making you aware so that the script can work for the new comers.

----

Even after replacing all instances, the script is not preforming correctly.

Edited by kjcdude
Link to comment
Share on other sites

  • 4 weeks later...

hello, the link contains the following:

Parent Directory -

SciTEUser.properties 28-Apr-2007 08:12 1.6K

autoit-v3.2.10.0-rc-setup.exe 24-Nov-2007 10:11 6.6M

autoit-v3.2.9.14-beta-setup.exe 21-Nov-2007 04:20 6.2M

autoit-v3.2.9.14.exe 21-Nov-2007 04:20 6.5M

docs/ 25-Jun-2006 11:34 -

pcrepattern-7.3.html 28-Aug-2007 04:34 89K

pcrepattern-7.4.html 23-Sep-2007 01:26 91K

pcretest-7.3.exe 17-Sep-2007 12:49 174K

pcretest-7.4.exe 25-Sep-2007 00:22 175K

sav/ 23-Nov-2007 06:55 -

undocumented/ 20-Dec-2006 03:41 -

i tried the autoit-v3.2.9.14-beta-setup.exe 21-Nov-2007 04:20 6.2M but it gives me errors, do i need a diferent scite or other file

thanks

Link to comment
Share on other sites

Hi,

I guess systray.au3 needs an update.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

Unfortunately I had completely missed this in VirtualFreeEx documentation in MSDN:

"dwSize The size of the region of memory to free, in bytes.

If the dwFreeType parameter is MEM_RELEASE, dwSize must be 0 (zero). The function frees the entire region that is reserved in the initial allocation call to VirtualAllocEx."

This was causing a huge memory leak when running these functions in a loop.

Corrected UDF in the first post.

Link to comment
Share on other sites

kinda have a problem with this UDF in a function

yes, i included the SysTray_UDF.au3

i wanted to double click a tray icon so i made this simple func using 2 funcs from the UDF:

Func clickfunc()
    $index = _SysTrayIconIndex("process.exe", 0)
    $pos = _SysTrayIconPos($index)
    
    MouseClick("left", $pos[0], $pos[1], 2)
EndFunc

when i tested this independently, it worked

but in the script, the scite console gives me these errors:

C:\Programas\AutoIt3\Include\SysTray_UDF.au3(37,50) : ERROR: $WM_GETTEXT previously declared as a 'Const'

Const $WM_GETTEXT = 13 ; Included in GUIConstants

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Programas\AutoIt3\Include\SysTray_UDF.au3(38,36) : ERROR: $PROCESS_ALL_ACCESS previously declared as a 'Const'

Const $PROCESS_ALL_ACCESS = 2035711

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Utilizador\Ambiente de trabalho\folder\script.au3 - 2 error(s), 0 warning(s)

i have prod autoit 3.2.10.0.

Edited by Lord Freshy
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...