Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/04/2013 in all areas

  1. Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox? Would you like to have coloured backgrounds and text? To choose the justification and font? Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen? What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout? Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar? If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you! [NEW VERSION] 16 Feb 24 Changed: Some additional functionality added to the "TimeOut" parameter of _ExtMsgBox: - A positive integer sets the EMB timeout as before. - A negative integer will double the size of the countdown timer if it is used. - A colon-delimited string (eg: "10:5") will set the normal EMB timeout (first integer) and will also initially disable the EMB buttons for the required period (second integer). New UDF and examples in the zip. Older version changes: ChangeLog.txt As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with all my UDFs (which you can find in my sig below) I am trying to prevent the need for any other include files. The UDF and examples (plus StringSize) in zip format: ExtMsgBox.zip Courteous comments and constructive criticisms welcome - guess which I prefer! M23
    1 point
  2. Ok, here is what i came up with after 3-4 hours of scripting well ok, it has been long time since then, so... after an year or so of hard scripting/testing!!! (inspired by this topic)... GUICtrlSetOnHover UDF... Syntax: _GUICtrl_OnHoverRegister(ControlID [, OnHoverFunc [, OnLeaveHoverFunc [, PrimaryDownFunc [, PrimaryUpFunc [, KeepCall_PrDn_Func [, KeepCall_Hover_Func]]]]]]) ControlID can be -1 as in Build-In functions! Example: #include "GUICtrlOnHover.au3" Opt("GUIOnEventMode", 1) $Btn_Color = 0x7A9DD8 $Hover_Color = 0xFF0000 ;0x7AC5D8 $GUIMain = GUICreate("Letters Hovering Example", 570, 200) GUISetOnEvent(-3, "Quit") _CreateLetters_Proc(10, 60, 18, 20) GUICtrlCreateButton("Close", 30, 120, 100, 30) GUICtrlSetOnEvent(-1, "Quit") GUICtrlSetFont(GUICtrlCreateLabel("Letter: ", 35, 170, 200, 20), 9, 800) $Status_Label = GUICtrlCreateLabel("", 80, 171, 200, 20) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetFont(-1, 8.5, 800) GUISetState() While 1 Sleep(100) WEnd Func _CreateLetters_Proc($iLeft, $Top, $Width=15, $Height=15) Local $iLeft_Begin = $iLeft Local $iAsc_Char = 64 For $i = 0 To 25 $iLeft_Begin += 20 $iAsc_Char += 1 GUICtrlCreateButton(Chr($iAsc_Char), $iLeft_Begin, $Top, $Width, $Height) _GUICtrl_OnHoverRegister(-1, "_Hover_Func", "_Leave_Hover_Func") GUICtrlSetOnEvent(-1, "_Letter_Events") GUICtrlSetBkColor(-1, $Btn_Color) GUICtrlSetFont(-1, 6) Next EndFunc Func _Letter_Events() MsgBox(64, "Pressed", "Letter = " & GUICtrlRead(@GUI_CtrlId)) EndFunc Func _Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Hover_Color) GUICtrlSetData($Status_Label, GUICtrlRead($iCtrlID)) Beep(1000, 20) EndFunc Func _Leave_Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Btn_Color) GUICtrlSetData($Status_Label, "") EndFunc Func Quit() Exit EndFunc Attachments: [The archive include few nice examples, and the UDF itself of course .] * New (v2.1) (Redirection to Zip-file, 159 kb) _GUICtrlSetOnHover.html GUICtrlSetOnHover.zip GUICtrlSetOnHover_UDF.au3 GuiCtrlSetOnHover.zip GUICtrlSetOnHover_UDF_For_3.2.10.0.au3 Old Beta - GUICtrlSetOnHover_UDF_beta.zip Enjoy! P.S Thanks to piccaso for the greatest CallBack tool! Without it, this UDF would never been created! ============================================ History version:
    1 point
  3. wraithdu

    _SysTray UDF

    Here is my highly modified version of Tuape's UDF. The example shows how to get different info and how to remove dead icons (no mouse move required). I've included support for the Windows 7 NotifyIconOverflowWindow icons as well, however I recommend using my _OsVersionInfo UDF to determine the OS instead of @OSVersion. This should work on Win2000+, but some testers on XP and Vista would be appreciated. _SysTray #include-once ; ---------------------------------------------------------------------------- ; ; Author: Tuape ; Modified: Erik Pilsits ; ; Script Function: ; Systray UDF - Functions for reading icon info from system tray / removing ; any icon. ; ; Last Update: 5/13/2013 ; ; ---------------------------------------------------------------------------- ;=============================================================================== ; ; Function Name: _SysTrayIconCount($iWin = 1) ; Description: Returns number of icons on systray ; Note: Hidden icons are also reported ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns number of icons found ; On Failure - Returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconCount($iWin = 1) Local Const $TB_BUTTONCOUNT = 1048 Local $hWnd = _FindTrayToolbarWindow($iWin) If $hWnd = -1 Then Return -1 Local $count = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $TB_BUTTONCOUNT, "wparam", 0, "lparam", 0) If @error Then Return -1 Return $count[0] EndFunc ;==>_SysTrayIconCount ;=============================================================================== ; ; Function Name: _SysTrayIconTitles($iWin = 1) ; Description: Get list of all window titles that have systray icon ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; Requirement(s): ; Return Value(s): On Success - Returns an array with all window titles ; On Failure - Returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconTitles($iWin = 1) Local $count = _SysTrayIconCount($iWin) If $count <= 0 Then Return -1 Local $titles[$count] ; Get icon owner window"s title For $i = 0 To $count - 1 $titles[$i] = WinGetTitle(_SysTrayIconHandle($i, $iWin)) Next Return $titles EndFunc ;==>_SysTrayIconTitles ;=============================================================================== ; ; Function Name: _SysTrayIconPids($iWin = 1) ; Description: Get list of all processes id's that have systray icon ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; Requirement(s): ; Return Value(s): On Success - Returns an array with all process id's ; On Failure - Returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconPids($iWin = 1) Local $count = _SysTrayIconCount($iWin) If $count <= 0 Then Return -1 Local $processes[$count] For $i = 0 To $count - 1 $processes[$i] = WinGetProcess(_SysTrayIconHandle($i, $iWin)) Next Return $processes EndFunc ;==>_SysTrayIconPids ;=============================================================================== ; ; Function Name: _SysTrayIconProcesses($iWin = 1) ; Description: Get list of all processes that have systray icon ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; Requirement(s): ; Return Value(s): On Success - Returns an array with all process names ; On Failure - Returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconProcesses($iWin = 1) Local $pids = _SysTrayIconPids($iWin) If Not IsArray($pids) Then Return -1 Local $processes[UBound($pids)] ; List all processes Local $list = ProcessList() For $i = 0 To UBound($pids) - 1 For $j = 1 To $list[0][0] If $pids[$i] = $list[$j][1] Then $processes[$i] = $list[$j][0] ExitLoop EndIf Next Next Return $processes EndFunc ;==>_SysTrayIconProcesses ;=============================================================================== ; ; Function Name: _SysTrayIconIndex($test, $mode = 0, $iWin = 1) ; Description: Get list of all processes id"s that have systray icon ; Parameter(s): $test - process name / window title text / process PID ; $mode ; | 0 - get index by process name (default) ; | 1 - get index by window title ; | 2 - get index by process PID ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; Requirement(s): ; Return Value(s): On Success - Returns index of found icon ; On Failure - Returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconIndex($test, $mode = 0, $iWin = 1) Local $ret = -1, $compare = -1 If $mode < 0 Or $mode > 2 Or Not IsInt($mode) Then Return -1 Switch $mode Case 0 $compare = _SysTrayIconProcesses($iWin) Case 1 $compare = _SysTrayIconTitles($iWin) Case 2 $compare = _SysTrayIconPids($iWin) EndSwitch If Not IsArray($compare) Then Return -1 For $i = 0 To UBound($compare) - 1 If $compare[$i] = $test Then $ret = $i ExitLoop EndIf Next Return $ret EndFunc ;==>_SysTrayIconIndex ; INTERNAL ===================================================================== ; ; Function Name: _SysTrayGetButtonInfo($iIndex, $iWin = 1, $iInfo = 0) ; Description: Gets Tray Button Info ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; $iInfo - Info to return ; | 1 - TBBUTTON structure ; | 2 - TRAYDATA structure ; | 3 - tooltip ; | 4 - icon position ; Requirement(s): ; Return Value(s): On Success - Returns requested info ; On Failure - Sets @error and returns -1 ; | 1 - Failed to find tray window ; | 2 - Failed to get tray window PID ; | 3 - Failed to open process ; | 4 - Failed to allocate memory ; | 5 - Failed to get TBBUTTON info ; ; Author(s): Erik Pilsits, Tuape ; ;=============================================================================== Func _SysTrayGetButtonInfo($iIndex, $iWin = 1, $iInfo = 1) Local Const $TB_GETBUTTON = 1047 ;~ Local Const $TB_GETBUTTONTEXT = 1099 ;~ Local Const $TB_GETBUTTONINFO = 1089 Local Const $TB_GETITEMRECT = 1053 Local Const $ACCESS = BitOR(0x0008, 0x0010, 0x0400) ; VM_OPERATION, VM_READ, QUERY_INFORMATION Local $TBBUTTON If @OSArch = "X86" Then $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[2];dword dwData;int iString") Else ; X64 $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[6];uint64 dwData;int64 iString") EndIf Local $TRAYDATA If @OSArch = "X86" Then $TRAYDATA = DllStructCreate("hwnd hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];handle hIcon") Else $TRAYDATA = DllStructCreate("uint64 hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];uint64 hIcon") EndIf Local $trayHwnd = _FindTrayToolbarWindow($iWin) If $trayHwnd = -1 Then Return SetError(1, 0, -1) Local $return, $err = 0 Local $ret = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $trayHwnd, "dword*", 0) If @error Or Not $ret[2] Then SetError(2, 0, -1) Local $pId = $ret[2] Local $procHandle = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $ACCESS, "bool", False, "dword", $pId) If @error Or Not $procHandle[0] Then Return SetError(3, 0, -1) Local $lpData = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $procHandle[0], "ptr", 0, "ulong", DllStructGetSize($TBBUTTON), "dword", 0x1000, "dword", 0x04) If Not @error And $lpData[0] Then $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETBUTTON, "wparam", $iIndex, "lparam", $lpData[0]) If Not @error And $ret[0] Then DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $TBBUTTON, "ulong", DllStructGetSize($TBBUTTON), "ulong*", 0) Switch $iInfo Case 2 ; TRAYDATA structure DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 6), "struct*", $TRAYDATA, "ulong", DllStructGetSize($TRAYDATA), "ulong*", 0) $return = $TRAYDATA Case 3 ; tooltip $return = "" If BitShift(DllStructGetData($TBBUTTON, 7), 16) <> 0 Then Local $intTip = DllStructCreate("wchar[1024]") ; we have a pointer to a string, otherwise it is an internal resource identifier DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 7), "struct*", $intTip, "ulong", DllStructGetSize($intTip), "ulong*", 0) $return = DllStructGetData($intTip, 1) ;else internal resource EndIf Case 4 ; icon position If Not BitAND(DllStructGetData($TBBUTTON, 3), 8) Then ; 8 = TBSTATE_HIDDEN Local $pos[2], $RECT = DllStructCreate("int;int;int;int") DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETITEMRECT, "wparam", $iIndex, "lparam", $lpData[0]) DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $RECT, "ulong", DllStructGetSize($RECT), "ulong*", 0) $ret = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $trayHwnd, "ptr", 0, "struct*", $RECT, "uint", 2) $pos[0] = DllStructGetData($RECT, 1) $pos[1] = DllStructGetData($RECT, 2) $return = $pos Else $return = -1 EndIf Case Else ; TBBUTTON $return = $TBBUTTON EndSwitch Else $err = 5 EndIf DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $procHandle[0], "ptr", $lpData[0], "ulong", 0, "dword", 0x8000) Else $err = 4 EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $procHandle[0]) If $err Then Return SetError($err, 0, -1) Else Return $return EndIf EndFunc ;==>_SysTrayGetButtonInfo ;=============================================================================== ; ; Function Name: _SysTrayIconHandle($iIndex, $iWin = 1) ; Description: Gets hwnd of window associated with systray icon of given index ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns hwnd of found icon ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconHandle($iIndex, $iWin = 1) Local $TRAYDATA = _SysTrayGetButtonInfo($iIndex, $iWin, 2) If @error Then Return SetError(@error, 0, -1) Else Return Ptr(DllStructGetData($TRAYDATA, 1)) EndIf EndFunc ;==>_SysTrayIconHandle ;=============================================================================== ; ; Function Name: _SysTrayIconTooltip($iIndex, $iWin = 1) ; Description: Gets the tooltip text of systray icon of given index ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns tooltip text of icon ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconTooltip($iIndex, $iWin = 1) Local $ret = _SysTrayGetButtonInfo($iIndex, $iWin, 3) If @error Then Return SetError(@error, 0, -1) Else Return $ret EndIf EndFunc ;==>_SysTrayIconTooltip ;=============================================================================== ; ; Function Name: _SysTrayIconPos($iIndex, $iWin = 1) ; Description: Gets x & y position of systray icon ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns array, x [0] and y [1] position of icon ; On Failure - Sets @error and returns -1 ; | -1 - Icon is hidden (Autohide on XP, etc) ; | See _SysTrayGetButtonInfo for additional @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconPos($iIndex, $iWin = 1) Local $ret = _SysTrayGetButtonInfo($iIndex, $iWin, 4) If @error Then Return SetError(@error, 0, -1) Else If $ret = -1 Then Return SetError(-1, 0, -1) Else Return $ret EndIf EndIf EndFunc ;==>_SysTrayIconPos ;=============================================================================== ; ; Function Name: _SysTrayIconVisible($iIndex, $iWin = 1) ; Description: Gets the visibility of a systray icon ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns True (visible) or False (hidden) ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconVisible($iIndex, $iWin = 1) Local $TBBUTTON = _SysTrayGetButtonInfo($iIndex, $iWin, 1) If @error Then Return SetError(@error, 0, -1) Else Return Not BitAND(DllStructGetData($TBBUTTON, 3), 8) ;TBSTATE_HIDDEN EndIf EndFunc ;==>_SysTrayIconVisible ;=============================================================================== ; ; Function Name: _SysTrayIconHide($index, $iFlag, $iWin = 1) ; Description: Hides / unhides any icon on systray ; ; Parameter(s): $index - icon index. Can be queried with _SysTrayIconIndex() ; $iFlag - hide (1) or show (0) icon ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns 1 if operation was successfull or 0 if ; icon was already hidden/unhidden ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconHide($index, $iFlag, $iWin = 1) ;~ Local Const $TB_HIDEBUTTON = 0x0404 ; WM_USER + 4 Local $TBBUTTON = _SysTrayGetButtonInfo($index, $iWin, 1) If @error Then Return SetError(@error, 0, -1) Local $visible = Not BitAND(DllStructGetData($TBBUTTON, 3), 8) ;TBSTATE_HIDDEN If ($iFlag And Not $visible) Or (Not $iFlag And $visible) Then Return 0 Else Local $TRAYDATA = _SysTrayGetButtonInfo($index, $iWin, 2) If @error Then Return SetError(@error, 0, -1) Local $NOTIFYICONDATA = DllStructCreate("dword cbSize;hwnd hWnd;uint uID;uint uFlags;uint uCallbackMessage;handle hIcon;wchar szTip[128];" _ & "dword dwState;dword dwStateMask;wchar szInfo[256];uint uVersion;wchar szInfoTitle[64];dword dwInfoFlags;" _ & "STRUCT;ulong;ushort;ushort;byte[8];ENDSTRUCT;handle hBalloonIcon") DllStructSetData($NOTIFYICONDATA, 1, DllStructGetSize($NOTIFYICONDATA)) DllStructSetData($NOTIFYICONDATA, 2, Ptr(DllStructGetData($TRAYDATA, 1))) DllStructSetData($NOTIFYICONDATA, 3, DllStructGetData($TRAYDATA, 2)) DllStructSetData($NOTIFYICONDATA, 4, 8) ; NIF_STATE DllStructSetData($NOTIFYICONDATA, 8, $iFlag) ; dw_State, 0 or 1 = NIS_HIDDEN DllStructSetData($NOTIFYICONDATA, 9, 1) ; dwStateMask Local $ret = DllCall("shell32.dll", "bool", "Shell_NotifyIconW", "dword", 0x1, "struct*", $NOTIFYICONDATA) ; NIM_MODIFY DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", WinGetHandle("[CLASS:Shell_TrayWnd]"), "uint", 0x001A, "wparam", 0, "lparam", 0) ; WM_SETTINGCHANGE If IsArray($ret) And $ret[0] Then Return 1 Else Return 0 EndIf ;~ $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_HIDEBUTTON, "wparam", DllStructGetData($TBBUTTON, 2), "lparam", $iHide) ;~ If @error Or Not $ret[0] Then ;~ $return = -1 ;~ Else ;~ $return = $ret[0] ;~ EndIf EndIf EndFunc ;==>_SysTrayIconHide ;=============================================================================== ; ; Function Name: _SysTrayIconMove($curPos, $newPos, $iWin = 1) ; Description: Moves systray icon ; ; Parameter(s): $curPos - icon's current index (0 based) ; $newPos - icon's new position ; ($curPos+1 = one step to right, $curPos-1 = one step to left) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): AutoIt3 Beta ; Return Value(s): On Success - Returns 1 if operation was successfull, 0 if not ; On Failure - Sets @error and returns -1 ; | 1 - Bad parameters ; | 2 - Failed to find tray window ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconMove($curPos, $newPos, $iWin = 1) Local Const $TB_MOVEBUTTON = 0x0452 ; WM_USER + 82 Local $iconCount = _SysTrayIconCount($iWin) If $curPos < 0 Or $newPos < 0 Or $curPos > $iconCount - 1 Or $newPos > $iconCount - 1 Or Not IsInt($curPos) Or Not IsInt($newPos) Then Return SetError(1, 0, -1) Local $hWnd = _FindTrayToolbarWindow($iWin) If $hWnd = -1 Then Return SetError(2, 0, -1) Local $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $TB_MOVEBUTTON, "wparam", $curPos, "lparam", $newPos) If @error Or Not $ret[0] Then Return 0 Else Return 1 EndIf EndFunc ;==>_SysTrayIconMove ;=============================================================================== ; ; Function Name: _SysTrayIconRemove($index, $iWin = 1) ; Description: Removes systray icon completely. ; ; Parameter(s): $index - Icon index (first icon is 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Return Value(s): On Success - Returns 1 if icon successfully removed, 0 if not ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconRemove($index, $iWin = 1) Local Const $TB_DELETEBUTTON = 1046 Local $TRAYDATA = _SysTrayGetButtonInfo($index, $iWin, 2) If @error Then Return SetError(@error, 0, -1) Local $NOTIFYICONDATA = DllStructCreate("dword cbSize;hwnd hWnd;uint uID;uint uFlags;uint uCallbackMessage;handle hIcon;wchar szTip[128];" _ & "dword dwState;dword dwStateMask;wchar szInfo[256];uint uVersion;wchar szInfoTitle[64];dword dwInfoFlags;" _ & "STRUCT;ulong;ushort;ushort;byte[8];ENDSTRUCT;handle hBalloonIcon") DllStructSetData($NOTIFYICONDATA, 1, DllStructGetSize($NOTIFYICONDATA)) DllStructSetData($NOTIFYICONDATA, 2, Ptr(DllStructGetData($TRAYDATA, 1))) DllStructSetData($NOTIFYICONDATA, 3, DllStructGetData($TRAYDATA, 2)) Local $ret = DllCall("shell32.dll", "bool", "Shell_NotifyIconW", "dword", 0x2, "struct*", $NOTIFYICONDATA) ; NIM_DELETE DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", WinGetHandle("[CLASS:Shell_TrayWnd]"), "uint", 0x001A, "wparam", 0, "lparam", 0) ; WM_SETTINGCHANGE If IsArray($ret) And $ret[0] Then Return 1 Else Return 0 EndIf ;~ Local $hWnd = _FindTrayToolbarWindow($iWin) ;~ If $hwnd = -1 Then Return -1 ;~ Local $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $TB_DELETEBUTTON, "wparam", $index, "lparam", 0) ;~ If @error Or Not $ret[0] Then Return -1 ;~ Return $ret[0] EndFunc ;==>_SysTrayIconRemove ;=============================================================================== ; ; Function Name: _FindTrayToolbarWindow($iWin = 1) ; Description: Utility function for finding Toolbar window hwnd ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns Toolbar window hwnd ; On Failure - returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _FindTrayToolbarWindow($iWin = 1) Local $hwnd, $ret = -1 If $iWin = 1 Then $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "Shell_TrayWnd", "ptr", 0) If @error Then Return -1 $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "TrayNotifyWnd", "ptr", 0) If @error Then Return -1 If @OSVersion <> "WIN_2000" Then $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "SysPager", "ptr", 0) If @error Then Return -1 EndIf $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0) If @error Then Return -1 $ret = $hwnd[0] ElseIf $iWin = 2 Then ; NotifyIconOverflowWindow for Windows 7 $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "NotifyIconOverflowWindow", "ptr", 0) If @error Then Return -1 $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0) If @error Then Return -1 $ret = $hwnd[0] EndIf Return $ret EndFunc ;==>_FindTrayToolbarWindow Example #NoTrayIcon #include <_SysTray.au3> #include <Process.au3> $count = _SysTrayIconCount() ConsoleWrite("Count visible tray: " & $count & @CRLF) For $i = $count - 1 To 0 Step -1 $handle = _SysTrayIconHandle($i) $visible = _SysTrayIconVisible($i) $pid = WinGetProcess($handle) $name = _ProcessGetName($pid) $title = WinGetTitle($handle) $tooltip = _SysTrayIconTooltip($i) ConsoleWrite("index: " & $i & @TAB & "visible: " & $visible & @TAB & "handle: " & $handle & @TAB & "pid: " & _ $pid & @TAB & "proc: " & $name & @TAB & @TAB & "title: " & $title & @TAB & @TAB & "tooltip: " & $tooltip & @CRLF) If $pid = -1 Then _SysTrayIconRemove($i) Next If _FindTrayToolbarWindow(2) <> -1 Then ConsoleWrite("-====================-" & @CRLF) $countwin7 = _SysTrayIconCount(2) ConsoleWrite("Count overflow area: " & $countwin7 & @CRLF) For $i = $countwin7 - 1 To 0 Step -1 $handle = _SysTrayIconHandle($i, 2) $visible = _SysTrayIconVisible($i, 2) $pid = WinGetProcess($handle) $name = _ProcessGetName($pid) $title = WinGetTitle($handle) $tooltip = _SysTrayIconTooltip($i, 2) ConsoleWrite("index: " & $i & @TAB & "visible: " & $visible & @TAB & "handle: " & $handle & @TAB & "pid: " & _ $pid & @TAB & "proc: " & $name & @TAB & @TAB & "title: " & $title & @TAB & @TAB & "tooltip: " & $tooltip & @CRLF) If $pid = -1 Then _SysTrayIconRemove($i, 2) Next EndIf
    1 point
  4. I was trying to find a good way to read barcodes, but there were not many I could find without going through the pain of recompiling, or spend +$299 for just reading. Makes use of: -WebcamDS_UDF by frank10 -_WinAPI_ClearConsole by rover -FastFind by FastFrench, frank10 Note, this requires java so far, and this script is not yet optimized. It currently supports the following barcodes: -Aztec Code (Full support as far as i can see!) -Code 128 (ISO 15417, seems to only support 12 digits.) -Code 39 (ISO 16388, Seems to be limited to, 0-9, aA-zZ, 5 digits.) -Code 93 (Mostly A-Z, 0-9, Special Characters act odd) -Databar -Data Matrix(ISO 16022, seems to be fully supported) -ITF 14 -PDF417 -QR Code -UPC-A -UPC-E -EAN 14 (Reads as Code 128) Tested with Microsoft HD 5000 Webcam. Used Zint Barcode generator, DL License, Various random other barcodes for testing. Latest Version (2013.06.16): http://www.mediafire.com/download/15ykljpfbsbzfox/BarcodeReader.7z Edit: Updated URL Enjoy
    1 point
  5. Update: 11/14/2012 - Fixed bug in Freespace erase - it was using sector size by mistake (did not cause failure, but slowed the wipe) - Replaced dir move/remove functions with long file name compatible API functions (thanks KaFu) - Added long path and UNC support to the _FileMapping UDF (this change affected portions of the UDF only used to wipe sparse / encrypted / compressed files on NTFS) - Wiping of these special files is now restricted to local volumes - you cannot get the volume handle required from remote volumes - NOTE: When running under UAC full admin permissions are required to use the defrag API to wipe these special files - Various updates to included _FileEx UDF Update: 10/1/12 - _SecureDirectoryDelete is now an iterative function, instead of recursive. - Added ability to overwrite with random data. To activate this feature, you must use the user array format with the array element corresponding to the random pass set to -1. Note this *will* incur a performance penalty since the buffer is filled with new random data each time it is used. - Registered _SD_FreeBuffers() as an on-exit function. - Changed the way buffer recreation is handled - new buffers are automatically created each time you pass a different value or array for $aPatterns. - Some updates to the included _FileEx UDF. Update: 9/11/12 - _SecureDirectoryDelete returns an array of errors for all errors encountered during recursion. This includes the error number, path at which the error was encountered, and the type of path item (file or folder). Update: 9/10/12 - More optimizations, read new header for important info Optimized buffer creation - done once on first call to any function, survives for life of script.$aPatterns parameter now accepts a single integer 0 <= i <= 255 to indicate a single pass using that byte pattern (-1 for default 3-pass DoD_E)Changed final file / dir removal to restore original file / dir name in case of removal failure.- SCRIPT BREAKING - Changed the order of the $fDelete and $aPatterns parameters, moving the more commonly used $aPatterns parameter to a higher priority. Update: 9/7/12 - Code cleanup and some optimizations - Fixed a bug that could slow down wiping of compressed / encrypted / sparse files if using more than one pass (this bug did not affect the actual wiping of these files) - Added callback functions to monitor the progress of the wipe File: Callback receives bytes written and total bytes.Dir: Callback is passed to file delete and receives bytes written and total bytes per file. Total directory size and bytes is not calculated, as the penalty would be too high for these basic functions. If you need total directory size, do this calculation yourself before calling this function, and keep track of the data written.Freespace: Callback is passed bytes written and total free bytes. Under certain circumstances, total bytes written may not equal total free bytes on the last call.Update: 9/5/12- Major rewrite Rewrote delete function, includes a special method to securely erase NTFS compressed, sparse, and EFS encrypted files.Simplified the parameters. Only need to specify if the file should be deleted after being overwritten, and can specify custom delete patterns.Added a directory deletion function to recursively wipe directoriesAdded a freespace wipe function, based on the Sysinternals SDelete utilityReparse points: symlinks and junctions are now handled, they are simply deleted, NOT followed or overwritten.- The archive includes my _FileMapping UDF and _FileEx UDF for support functions. I tested this A LOT, which also accounts for the delay in releasing. I've tested on NTFS and FAT32 drives, and it functions as it should. That said, I take no responsibility for data loss. If there are testers familiar with data recovery, I'd love tests done on the thoroughness of the wiping, especially the free space wipe. NTFS has some real gotchas that normal apps can't deal with safely, so some stuff may slip through. If so, I'd like to know about it. I plan on working on some sort of cluster tip / slack space wipe to add to the freespace function, but I have to figure out how best to handle that. Update: 8/20/10 - Uses unbuffered I/O to overwrite the file - Added fFileTime and fDelete parameters - Code cleanup EDIT: New version. The buffer creation has been optimized. This one optionally renames the file 10 times to a random name, resets the file timestamps to Jan. 1, 1980, 12:01am, and optionally takes a user array of integer values from 0 to 255 (decimal or hex) to use as the erasing patterns. This way the user can control the patterns used to erase the data and the number of passes. If no array is passed, then the default DoD short method (DoD_E) is used. The last parameter lets the user specify the block size to be used, default is 32768 bytes (32 Kb). Just something I felt like whipping up. This script does a secure erase of any file. It uses the DoD short method as described in the script. Currently it writes in 32Kb blocks which seems to give pretty good performance. Depending on the file size, it may increase the erased file's size by up to 32 Kb. You can play with the size if you feel like it. On my computer, it erased a 5.5 MB file (16.5 MB in total written data) in 0.08 seconds. I verified the results with a Hex editor to be sure. Then it will rename the file 10 times using a randomly generated name. This *should* make the file names unrecoverable as well as the data. Enjoy! Example $r = _SecureFileDelete(@ScriptDir & "test.bin", -1, False) ; use default patterns, do not delete ConsoleWrite($r & " : " & @error & @CRLF) Local $array[3] = [0x00,0xFF,0x1C] $r = _SecureFileDelete(@ScriptDir & "test.bin", $array, False) ; use custom patterns, no delete ConsoleWrite($r & " : " & @error & @CRLF) Dim $array[2] = [0,-1] $r = _SecureFileDelete(@ScriptDir & "test.bin", $array, False) ; two passes, last pass random data, no delete ConsoleWrite($r & " : " & @error & @CRLF)SecureDelete.zip
    1 point
  6. UDF Deprecated - 23 Dec 2013 As since the release of v3.3.10.0 the basis of this UDF is now included in the standard AutoIt UDFs as _FileListToArrayRec in File.au3, support will end in this thread and any future bug reports or feature requests should be made via Trac. Note that there are a couple of major changes in the new function compared to this UDF: - You must place the Include|Exclude|Exclude_Folder masks in the single $sMask parameter, delimited by "|". The old syntax with the "exclude" masks at the end of the parameter list will no longer work, unlike this UDF. - The values returned in @extended in the event of an error have been reordered to reflect the above - so you might need to amend your errorchecking. But note that "no files found" still returns 9 in @extended - I am not that cruel! - The sort algorithm has been changed from QuickSort to DualPivot, which is significantly faster for large arrays. I hope you appreciate the faster return times. This zip remians available for those who do not wish to update immediately: RFLTA.zip M23
    1 point
  7. Terenz

    Taskbar problems

    Hi Melba, that is a workaround of the problem, make the folder bigger instead of use maximize on the folder. I don't belive there isn't a way to hide taskbar like Windows do with auto-hide @Danyfirex don't sorry, i'll apprecciate any type of help
    1 point
  8. Mobius

    Autoit anti decompiler

    Yes this is true, but there is nothing wrong with a user writing alternatives to existing solutions.
    1 point
  9. Gallahan, There is no "runscript" anything in AutoIT. There are several ways to invoke a script, see "Running a Script" in the Help file and the "run", "runwait", "shellexecute" and "shellexecutewait" commands. Yes you can run a script at the same time every day. There was a topic about this recently, just search for it. kylomas edit: see >this thread for doing something at a certain time each day
    1 point
  10. Try this Func WMI_ProcessExits($host, $processname, $usr = "", $pass = "") ;coded by UEZ 2011 If $host = "." Or $host = "localhost" Or $host = @IPAddress1 Or $host = @ComputerName Then If ProcessExists($processname) Then Return 1 Return 0 Else Local $ping = Ping($host, 1000) If @error Then Return SetError(1, 0, -1) ; Host not pingable Local $objWMILocator = ObjCreate("WbemScripting.SWbemLocator") Local $objWMIService = $objWMILocator.ConnectServer($host, "\root\cimv2", $usr, $pass, "", "", "&H80") If @error Then Return SetError(3, 0, -1) Local $colItems = $objWMIService.ExecQuery("SELECT Name FROM Win32_Process WHERE Name='" & $processname & "'", "WQL", 0x30) If IsObj($colItems) Then For $objItem In $colItems If $objItem.Name <> "" Then Return 1 Next Else Return SetError(4, 0, -1) EndIf EndIf Return 0 EndFunc ;==>WMI_ProcessExits Func ObjErrorHandler() ConsoleWrite("A COM Error has occured!" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _ "err.windescription:" & @TAB & $oErrorHandler & @CRLF & _ "err.number is: " & @TAB & Hex($oErrorHandler.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _ "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _ "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext & @CRLF _ ) EndFunc ;==>ObjErrorHandler Replace "." with the remote host name. Br, UEZ
    1 point
×
×
  • Create New...