Jump to content
Sign in to follow this  
Barboss

split of from wrong forum post

Recommended Posts

Barboss

Hello friends.

I'm not a programmer.

Help me to solve a similar problem.

I need without the click, but with the help of hot keys to open programs, which are in the system tray.

Thanks in advance.

Share this post


Link to post
Share on other sites
picea892

Wrong forum

HotKeySet("q","runit")

func runit
    WinActivate("[CLASS:Notepad]", "")
EndFunc

Share this post


Link to post
Share on other sites
Barboss

Wrong forum

HotKeySet("q","runit")

func runit
    WinActivate("[CLASS:Notepad]", "")
EndFunc

Thank you.

As I said, I'm not a programmer.

Could you explain me how to use it?

How to make a script and how to program a specific hot key combination, which would correspond the program name in the system tray?

Share this post


Link to post
Share on other sites
wraithdu

Go away. This isn't rent-a-coder.

Share this post


Link to post
Share on other sites
E1M1

Use run or shellexecute. Autoit help is written so that even I could understand it (which means it's well written and it's dumb friendly :mellow: ). if you bother to read you can do what you want.


edited

Share this post


Link to post
Share on other sites
Melba23

Barboss,

Here is something I produced quickly to get you started. It produces an array holding the traytip text of the icons, the required HotKey letter and the selected modifiers:

#include <GUIConstantsEx.au3>
#Include <GuiToolBar.au3>
#include <EditConstants.au3>

#include <Array.au3>

; Get list of icon text
Global $aToolTip = Get_Systray_IconText()

$iSize = UBound($aToolTip)

; Declare array to hold control IDs
Global $aInputs[$iSize][4]

; Create GUI
$hGUI = GUICreate("Tray Icon Hotkeys", 300, 60 + (20 * $iSize))

; Place Ctrl Alt Shft labels
GUICtrlCreateLabel("C", 12, 0, 15, 15)
GUICtrlCreateLabel("A", 27, 0, 15, 15)
GUICtrlCreateLabel("S", 42, 0, 15, 15)

; Create user input area
For $i = 0 To $iSize - 1

    $aInputs[$i][0] = GUICtrlCreateCheckbox("", 10, 13 + (20 * $i), 15, 15)
    $aInputs[$i][1] = GUICtrlCreateCheckbox("", 25, 13 + (20 * $i), 15, 15)
    $aInputs[$i][2] = GUICtrlCreateCheckbox("", 40, 13 + (20 * $i), 15, 15)
    $aInputs[$i][3] = GUICtrlCreateInput("", 60, 10 + (20 * $i), 20, 20, $ES_UPPERCASE)
    GUICtrlSetLimit(-1, 1)
    GUICtrlCreateLabel($aToolTip[$i][0], 100, 13 + (20 * $i), 200, 15)

Next

$hButton = GUICtrlCreateButton("Set", 110, 20 + (20 * $i), 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            Set_HotKeys()
    EndSwitch

    ; Force hotkeys to be letters only (optional)
    For $i = 0 To $iSize - 1
        If StringRegExp(GUICtrlRead($aInputs[$i][3]), "[[:alpha:]]") <> 1 Then GUICtrlSetData($aInputs[$i][3], "")
    Next

WEnd

Exit

Func Set_HotKeys()

    ; Loop through the inputs and put the modifiers and hotkeys in the array
    For $i = 0 To $iSize - 1
        If GUICtrlRead($aInputs[$i][0]) = 1 Then $aToolTip[$i][1] = 1
        If GUICtrlRead($aInputs[$i][1]) = 1 Then $aToolTip[$i][2] = 1
        If GUICtrlRead($aInputs[$i][2]) = 1 Then $aToolTip[$i][3] = 1
        $aToolTip[$i][4] = StringLower(GUICtrlRead($aInputs[$i][3]))
    Next

    ; here is the array with the icon text, chosen hotkey letter and modifier key selection
    _ArrayDisplay($aToolTip)

EndFunc

Func Get_Systray_IconText()

    $hSystray_Handle = Get_SysTray_Handle()

    $iSystray_ButCount = Get_Systray_Icon_Count($hSystray_Handle)

    Local $aArray[$iSystray_ButCount][5]

    ; Get text from tooltips
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        Local $sText = _GUICtrlToolbar_GetButtonText($hSystray_Handle, $iSystray_ButtonNumber)
        $sText = StringReplace($sText, @CRLF, " - ")
        $aArray[$iSystray_ButtonNumber][0] = $sText
    Next

    Return($aArray)

EndFunc

Func Get_SysTray_Handle()

    ; 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

    Return $hSystray_Handle

EndFunc

Func Get_Systray_Icon_Count($hSystray_Handle)

    ; 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

    Return $iSystray_ButCount

EndFunc

Over to you to code the next bit - actually creating the HotKeys and getting them to click the correct icon. :P

You know where we are if you have problems. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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  

×