Jump to content

more seemingly random questions


Recommended Posts

I'm working on a bunch of projects simultaniously now.

1) What i want is to detect a certain tray icon that doesn't always show "on top". What i mean is that you have to click the little arrow slightly left to the language square. I use winXP, so i don't know about the existence of said arrow in other windows's, but i doubt i'll change my os soon.

After a few minutes of prodding the help file, i found the "Tray managment" folder. HOWEVER! It seems that i always need to create said trays first.

Is there a way to get the name (handle?) of an already existing tray?

If there is, try to explain it please? At the moment i'm trying to capture what seems to be "Local area connection 2". At least that's what it says when i move the mouse over it and the tooltip thingy pops up.

2) This one is more about the Registry then autoit, but still.

In my earlier posts, someone suggested i should poke the registry to do my bidding. I want to run MY OWN program before explorer.exe and have IT run explorer.exe on demand. Now, while i CAN do it, i'm deathly afraid of screwing up. The reasons are many. Last time i poked the registry following a someone's instruction, i lost a machine. It died to the point of no return. The technichian guy couldn't find the problem. So yeah...

From the little i understand about registry, to make the program work, i need to shove the thing into a windows folder, the one with explorer.exe in it. point is... i dun wanna! can i give it a full path instead of file name? (ie: D:\Autoit work\myprog\myprog.exe <-that's... literally the path! i'm not very creative with my names.)

these two seem to be all of my problems for the next 4-6 hours.

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

I can help with the first part. This is how to operate a systray icon. All you need is the content of the tooltip to identify it. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

I would prefer to not use UDFs. As in, the stock ones that come with autoit

Then all you have to do is go through the GUIToolBar, WinAPI and SendMessage UDFs (and that is just on a quick look!) and convert all the commands needed from them back into basic DLLCall lines - something which I am certainly not prepared to do for you. :huggles:

If you do decide to go with the UDFs, then this code returns True/False when asked if a tray icon containing a given text exists:

#Include <GuiToolBar.au3>

Global $sTrayIconText = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here

$iTrayIconExists = _TrayIconExists($sTrayIconText)

MsgBox(0, "TrayIcon", "TrayIconExists: " & $iTrayIconExists)

Exit

;............

Func _TrayIconExists($sToolTipTitle)

    ; Find systray handle
    $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 =  _SendMessage($hSysTray_Handle, $TB_BUTTONCOUNT)
    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) = 1 Then ExitLoop
    Next

    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return False ; Not found
    Else
        Return True ; Found
    EndIf

EndFunc

Your script - your choice. :D

M23

Edit: Wrong UDF quoted.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

GodForsakenSoul,

_TrayIconExists is a function I created, not a built-in command :D . To use it you will need to include the following standard include files:

#include "GUIToolBar.au3"

#include "ToolbarConstants.au3"

#include "StructureConstants.au3"

#include "FileConstants.au3"

#include "MemoryConstants.au3"

#include "ProcessConstants.au3"

#include "Memory.au3"

#include "WinAPI.au3"

#include "WinAPIError.au3"

#include "SendMessage.au3"

#include "UDFGlobalID.au3"

#include "Security.au3"

which is a long way from

I would prefer to not use UDFs. As in, the stock ones that come with autoit

But as I said:

Your script - your choice

:huggles:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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