Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/03/2012 in all areas

  1. water

    Error stop script

    if $oLinks.href == '' then exitloopis wrong because $oLinks is a collection of link objects. You need to access $oLinkBefore accessing the property of an object you could test if it's an object: If Not IsObj($oLink) Then ExitLoop ; Or whatever you want to do
    1 point
  2. Look at the IE functions because the information iyou've provided s pretty limited and generic, what data are you trying to extract? What is the website? etc...
    1 point
  3. CreatoX, Would sir like fries with that? You can thank rover for this - all I have done is play around with his code to get a "simple" function to do what you want: #include <WindowsConstants.au3> #include <GUIToolbar.au3> #include <WinAPI.au3> #Include <GuiMenu.au3> Opt("WinTitleMatchMode", 2) Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; Add the text of your tray icon here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Is the App running?") Exit Else Sleep(250) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") Sleep(250) Send("{UP}") ; Move your cursor around on the menu here <<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite(GetPopUpSelText() & @CRLF) ; This will read the currently selected item <<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf Func Get_Systray_Index($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 = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) 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) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Func GetPopUpSelText() Local $aPopUp_List = _WinAPI_EnumWindowsPopup() Local $hWnd = $aPopUp_List[1][0] Local $sClass = $aPopUp_List[1][1] If $sClass = "#32768" Then ; This is a "standard" Windows API popup menu $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0) If _GUICtrlMenu_IsMenu($hMenu) Then $iCount = _GUICtrlMenu_GetItemCount($hMenu) For $j = 0 To $iCount - 1 If _GUICtrlMenu_GetItemHighlighted($hMenu, $j) Then Return _GUICtrlMenu_GetItemText($hMenu, $j) EndIf Next EndIf EndIf Return "" EndFuncThis code only works on "standard" Windows API popup menus - one of the apps in my tray does not respond to this code as it uses owner-drawn elements which cannot be read. I hope your app is one of the well-behaved ones. M23
    1 point
  4. CreatoX, This code will right click on an icon containing a given text - I have found that Send("{UP}/{DOWN}{ENTER}") works well from then on if you add a Sleep(100) between multiple commands to allow them time to have effect. #Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($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 = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) 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) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFuncYou may find that there are accelerator keys within the menu and just Send("a") will work, although I see no sign of them in that image - worth a try though! M23
    1 point
  5. Tstudent

    Close program in icon tray

    I have a windows application that when i click on "minimize" is reduced to icon tray (lower right corner). What i want is to close that program. But i want to close it normally (the same as click on X button), not brutally kill process. Is it possible with AutoIt? I could code a double left mouse click on the program's icon in the tray and after use winclose(title). The problem is that the position of the icon (in the icon tray) isn't always the same. Is there a more elegant and effective solution? Thank you
    1 point
  6. Tstudent, This code will right-click on an icon in the systray (notification area) if you add a part of the tooltip text for the specific app: #Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($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 = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) 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) > 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc It should not be too hard to adapt for your needs. I hope it helps. M23
    1 point
  7. Ah... terminology... InetGet doesn't open a new browser, but it opens a new connection to the webserver -- this is your trouble right? Dale
    1 point
×
×
  • Create New...