kryder Posted November 4, 2012 Posted November 4, 2012 Hi, M23Big thx. I've added a "Sleep(2500)" and deleted the box that came and where i should click "ok"Code now : expandcollapse popup#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 EndFuncPicture of what it does now :But I can not get it to go up and click on "Show", where should I put my commands in ?- Kryder
Moderators Melba23 Posted November 4, 2012 Moderators Posted November 4, 2012 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 4, 2012 Posted November 4, 2012 Hi, M23 No, the easy way do not work (s or Alt-s) 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 Melba23 Posted November 5, 2012 Moderators Posted November 5, 2012 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 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 Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 kryder, If you right-click the menu manually, can you select the menu option any way other then with the mouse? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 Hi, M23 No, the arrow keys does not work either. It is the only mouse that can do it. -Kryder
Moderators Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 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)) ExitNow 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 M23,It writes an error : ERROR: syntax error on the line with: MouseClick("left", $aMpos[0], $aMpos[1] - 100))-kryder
Moderators Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 kryder, Just remove the final parenthesis. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 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 Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 kryder,You have $aMPos[2] - I had $aMpos[0]. Change that and see what happens. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 M23, Thx... It works, it move the mouse up to "Show" But it should move slightly to the right, how do I get it to do that? - Kryder
Moderators Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kryder Posted November 6, 2012 Posted November 6, 2012 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. Here is the full script, if there are others who can use it. expandcollapse popup#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
Moderators Melba23 Posted November 6, 2012 Moderators Posted November 6, 2012 kryder, Glad I could assist. Now start reading that Help file. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now