Jump to content

Recommended Posts

Posted

Hi, M23

Big thx. I've added a "Sleep(2500)" and deleted the box that came and where i should click "ok"

Code now :

#Include 

Global $hSysTray_Handle = Get_SysTray_Handle()

; Get initial count
$iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSysTray_ButCount = 0 Then
MsgBox(16, "", "No items found in system tray")
Exit
EndIf

; Read current tooltip parameter
Global $aInitial_Array[$iSysTray_ButCount + 1] = [$iSysTray_ButCount]
For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
$aInitial_Array[$iSysTray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSysTray_ButtonNumber)
Next

; Now start the app and wait until the icon appears
Run("C:Programmer3G Modem Connect3GModemConnect.exe")
Do
Sleep(10)
Until $iSysTray_ButCount <> _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Reset the count
$iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Read new tooltip parameters
Global $aFinal_Array[$iSysTray_ButCount + 1] = [$iSysTray_ButCount]
For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
$aFinal_Array[$iSysTray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSysTray_ButtonNumber)
Next

; Now check which icon is new
For $i = $aFinal_Array[0] To 1 Step -1; Start with the newest because that is probably the one we want
For $j = 1 To $aInitial_Array[0]
ConsoleWrite($aFinal_Array[$i] & " - " & $aInitial_Array[$j] & @CRLF)
If $aFinal_Array[$i] = $aInitial_Array[$j] Then
ExitLoop
EndIf
; This parameter not found
Sleep(2500)
; And a check to see if it is correct
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right")

Exit

Next
Next

Func Get_SysTray_Handle()

$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Exit
Else
Return $hSysTray_Handle
EndIf

EndFunc

Picture of what it does now :

Posted Image

But I can not get it to go up and click on "Show", where should I put my commands in ?

- Kryder

  • Moderators
Posted

kryder,

Forst I would check to see if you can use any key shortcuts - like "s" or "Alt-s" - to action that item. If so then a simple Send of that shortcut should suffice. If not, then you will have to Send some {UP}s and an {ENTER}. ;)

As to where you do this, normally just after the _GUICtrlTooBar_ClickButton line - but you may need some Sleep(250) lines in there to allow the previous action to complete. :)

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

 

Posted

Hi, M23

No, the easy way do not work (s or Alt-s) :ermm:

I have try to add some "Send" and {UP)'s, but it not working...

; And a check to see if it is correct
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right")
Sleep(250)
Send("{UP}{UP}{ENTER}")
Exit

It will not run with it, they it is not blue marker ?

- Kryder

  • Moderators
Posted

kryder,

Basically you need to do whatever you have to do manually to get the highlight in the right place. Try something like this: ;)

; And a check to see if it is correct
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right")
Sleep(500)
Send("{UP}{UP}")
Sleep(250)
Send("{ENTER}")
Sleep(250)
Exit

Something like that works fine for me on some of my tray icon menus. :)

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

 

Posted

Hi, M23

No, it does not work. (works fine with other programs)

I have searched and searched the forum, and I have not found any that work. Is there a script that can find a name on the screen?

- Kryder

  • Moderators
Posted

kryder,

If you right-click the menu manually, can you select the menu option any way other then with the mouse? :huh:

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

 

  • Moderators
Posted

kryder,

We will have to brute force it - much as I hate the idea. :(

Try something like this:

; And a check to see if it is correct
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right", True, 1, 0)
$aMpos = MouseGetPos()
Sleep(500)
MouseClick("left", $aMpos[0], $aMpos[1] - 100))
Exit

Now we move the mouse to the icon when we right-click it and then left-click slightly higher on the screen to action the item itself. You will have to play with the MouseClick coordinates to get the correct position. ;)

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

 

  • Moderators
Posted

kryder,

Just remove the final parenthesis. :)

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

 

Posted

M23,

Now writes this i SciTE:

C:Documents and SettingsAdministratorSkrivebord333.au3 (49) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
MouseClick("left", $aMpos[2], $aMpos[1] - 100)
MouseClick("left", ^ ERROR
->18:50:29 AutoIT3.exe ended.rc:1

I can get it to run with the mouse, how much they need do you think?

$aMpos[?], $aMpos[?]

-kryder

  • Moderators
Posted

kryder,

You have $aMPos[2] - I had $aMpos[0]. Change that and see what happens. ;)

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

 

  • Moderators
Posted

kryder,

how do I get it to do that?

Perhaps by opening the Help file and starting to learn a bit for yourself? ;)

Try:

MouseClick("left", $aMpos[0] + 20, $aMpos[1] - 100)

The 2 $aMpos are the old position (where it right clicked the icon) adjusted to move to the "Show" item. Adding 20 to the first moves the mouse a little to the right; subtracting 100 from the second moves it up the screen. That is why I mentioned above that you might need to adjust them to get the corerct place. :)

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

 

Posted

kryder,

Perhaps by opening the Help file and starting to learn a bit for yourself? ;)

M23, you are a good person. A big thanks for all your help. I want to start learning all of the bottom to make script for AutoIt. and again thanks for help. :party:

Here is the full script, if there are others who can use it.

#Include 

Global $hSysTray_Handle = Get_SysTray_Handle()

; Get initial count
$iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSysTray_ButCount = 0 Then
MsgBox(16, "", "No items found in system tray")
Exit
EndIf

; Read current tooltip parameter
Global $aInitial_Array[$iSysTray_ButCount + 1] = [$iSysTray_ButCount]
For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
$aInitial_Array[$iSysTray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSysTray_ButtonNumber)
Next

; Now start the app and wait until the icon appears
Run("C:Programmer3G Modem Connect3GModemConnect.exe")
Do
Sleep(10)
Until $iSysTray_ButCount <> _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Reset the count
$iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Read new tooltip parameters
Global $aFinal_Array[$iSysTray_ButCount + 1] = [$iSysTray_ButCount]
For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
$aFinal_Array[$iSysTray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSysTray_ButtonNumber)
Next

; Now check which icon is new
For $i = $aFinal_Array[0] To 1 Step -1; Start with the newest because that is probably the one we want
For $j = 1 To $aInitial_Array[0]
ConsoleWrite($aFinal_Array[$i] & " - " & $aInitial_Array[$j] & @CRLF)
If $aFinal_Array[$i] = $aInitial_Array[$j] Then
ExitLoop
EndIf
; This parameter not found
Sleep(2500)
; And a check to see if it is correct
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right", True, 1, 0)
$aMpos = MouseGetPos()
Sleep(2500)
MouseClick("left", $aMpos[0] + 20, $aMpos[1] - 100)
Sleep(500)
MouseClick("left", $aMpos[0] + 35, $aMpos[1] - 225 - 100)
Exit
Next
Next

Func Get_SysTray_Handle()

$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Exit
Else
Return $hSysTray_Handle
EndIf

EndFunc

- Kryder :idiot:

  • Moderators
Posted

kryder,

Glad I could assist. :)

Now start reading that Help file. ;)

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

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...