jben Posted April 18, 2008 Posted April 18, 2008 Hey, got a quick question. I'm looking at adding some code to the end of the project that will display a pop up in the bottom right corner stating that something has been succesful. The user can then close this popup. An idea of what i'm trying to achieve is the type of pop up that appears when someone signs on to msn messenger. any ideas?....thanks
PsaltyDS Posted April 18, 2008 Posted April 18, 2008 TrayTip() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jben Posted April 18, 2008 Author Posted April 18, 2008 Brilliant stuff....The only issue I have is the tray tip automatically closes itself..I need it to stay open until the user decided to close it... any ideas? thanks
someone Posted April 18, 2008 Posted April 18, 2008 Hey jben... I think you mean something like this by eltorro or this by GioVitOr take the easier route and go traytip While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
jben Posted April 18, 2008 Author Posted April 18, 2008 I like the idea of tray tip to be honest...But it dissapears automatically after several seconds. Could I just get it to stay open until the user closes the tray tip?. thanks
jben Posted April 18, 2008 Author Posted April 18, 2008 This is what i've got #include <date.au3> TrayTip("ARC Charts extracted to C:\OUTPUT", "Extracted on "& @MDAY & "-" & @MON & "-" & @YEAR & " @ " & @HOUR & ":" & @MIN, 30, 1) Sleep(5000)
zorphnog Posted April 18, 2008 Posted April 18, 2008 (edited) I like the idea of tray tip to be honest...But it dissapears automatically after several seconds. Could I just get it to stay open until the user closes the tray tip?. thanksUsing part of Squirrely's post here, you could do something like this: expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Global Const $WINANI_HIDE = 0x10000, _ $WINANI_LEFTTORIGHT = 0x40001, _ $WINANI_RIGHTTOLEFT = 0x40002, _ $WINANI_TOPTOBOTTOM = 0x40004, _ $WINANI_BOTTOMTOTOP = 0x40008, _ $WINANI_ALPHA = 0x80000 Opt('MustDeclareVars', 1) Opt('WinTitleMatchMode', 4) _UserNotification_Display("ARC Charts extracted to C:\OUTPUT", "Extracted on "& @MDAY & "-" & @MON & "-" & @YEAR & " @ " & @HOUR & ":" & @MIN) ;=============================================================================== ;Syntax: _AnimateWindow( $vTitle [, $sText = '' [, $iTime = 1000 [, $iMethod = 0x80000 [, $vUser32Dll = 'user32.dll' ] ] ] ] ) ;Parameter: $sTitle : Title or handle to window. ; $sText : Text of window (optional). ;Return Value: A two-item array: ; [0] = Width offset ; [1] = Height offset ;Author: Rob Saunders (admin@therks.com) ;User Calltip: _AnimateWindow($vTitle, $sText = '', $iTime, $iMethod, $vUser32Dll) ;Example: _AnimateWindow('Untitled - Notepad', '', 1000, BitOR($WINANI_HIDE, $WINANI_LEFTTORIGHT, $WINANI_TOPTOBOTTOM), $hUser32Dll) ;=============================================================================== Func _UserNotification_AnimateWindow($vTitle, $sText = '', $iTime = 1000, $iMethod = 0x80000, $vUser32Dll = 'user32.dll') Local $hWnd If IsHWnd($vTitle) Then $hWnd = $vTitle Else $hWnd = WinGetHandle($vTitle, $sText) EndIf DllCall($vUser32Dll, 'int', 'AnimateWindow', 'hwnd', $hWnd, 'int', $iTime, 'long', $iMethod) EndFunc ;==>_AnimateWindow Func _UserNotification_Display($sTitle, $sMsg, $iWinWidth = Default, $iWinHeight = Default, $bExit = Default, $iTimeout = Default) If IsKeyword($iWinWidth) Or $iWinWidth = -1 Then $iWinWidth = 225 If IsKeyword($iWinHeight) Or $iWinHeight= -1 Then $iWinHeight = 50 If IsKeyword($bExit) Or $bExit = -1 Then $bExit = True If IsKeyword($iTimeout) Then $iTimeout = -1 Local $iWinX, $iWinY, $iWinAniHide, $iWinAniShow Local $hTaskbar, $aTaskbarPos, $sTaskbarPos Local $gUserNotification, $lbExit Local $iTimer, $iTimerDiff, $nMsg Local $iWinPadding = 5, $iMsgPadding = 10 $hTaskbar = WinGetHandle('classname=Shell_TrayWnd') If @error Then ConsoleWrite("Error getting taskbar handle" & @LF) $iWinX = @DesktopWidth - $iWinWidth $iWinY = @DesktopHeight - $iWinHeight Else $sTaskbarPos = _UserNotification_TaskbarGetPos($hTaskbar, 1) $aTaskbarPos = WinGetPos($hTaskbar) Switch $sTaskbarPos Case 'top' $iWinX = @DesktopWidth - $iWinWidth $iWinY = $aTaskbarPos[1] + $aTaskbarPos[3] $iWinAniShow = $WINANI_TOPTOBOTTOM $iWinAniHide = BitOR($WINANI_BOTTOMTOTOP, $WINANI_HIDE) Case 'bottom' $iWinX = @DesktopWidth - $iWinWidth $iWinY = $aTaskbarPos[1] - $iWinHeight $iWinAniShow = $WINANI_BOTTOMTOTOP $iWinAniHide = BitOR($WINANI_TOPTOBOTTOM, $WINANI_HIDE) Case 'left' $iWinX = $aTaskbarPos[0] + $aTaskbarPos[2] $iWinY = @DesktopHeight - $iWinHeight $iWinAniShow = $WINANI_LEFTTORIGHT $iWinAniHide = BitOR($WINANI_RIGHTTOLEFT, $WINANI_HIDE) Case 'right' $iWinX = $aTaskbarPos[0] - $iWinWidth $iWinY = @DesktopHeight - $iWinHeight $iWinAniShow = $WINANI_RIGHTTOLEFT $iWinAniHide = BitOR($WINANI_LEFTTORIGHT, $WINANI_HIDE) EndSwitch EndIf $gUserNotification = GUICreate('UserNotification', $iWinWidth, $iWinHeight, _ $iWinX - $iWinPadding, $iWinY - $iWinPadding, _ BitOR($WS_POPUP,$WS_BORDER), BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) If $bExit Then GUICtrlCreateLabel(" " & $sTitle, 0, 0, $iWinWidth-17, 17) GUICtrlSetFont(-1, 9, 800) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x0000FF) $lbExit = GUICtrlCreateLabel("X", $iWinWidth - 17, 0, 17, 17, $SS_CENTER) GUICtrlSetFont(-1, 9, 800) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0xFF0000) Else GUICtrlCreateLabel(" " & $sTitle, 0, 0, $iWinWidth, 17) GUICtrlSetFont(-1, 9, 800) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x0000FF) EndIf GUICtrlCreateLabel($sMsg, $iMsgPadding, 17 + $iMsgPadding, $iWinWidth - (2 * $iMsgPadding), _ $iWinHeight - 17 - (2 * $iMsgPadding), $SS_CENTER) _UserNotification_AnimateWindow($gUserNotification, '', 300, $iWinAniShow) GUISetState() If $iTimeout <> -1 Then $iTimer = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $lbExit If $bExit Then _UserNotification_AnimateWindow($gUserNotification, '', 500, $WINANI_HIDE) ExitLoop EndIf EndSwitch If $iTimeout <> -1 Then $iTimerDiff = TimerDiff($iTimer) If $iTimerDiff >= $iTimeout Then _UserNotification_AnimateWindow($gUserNotification, '', 500, $iWinAniHide) ExitLoop EndIf EndIf WEnd GUIDelete($gUserNotification) EndFunc ;==>_UserNotification_Display ;=============================================================================== ; ; Description: _TaskbarGetPos - Returns the position the user has placed their taskbar (top, left, right, or bottom) ; Syntax: _TaskbarGetPos ( $h_Taskbar [, $i_ReturnType = 0 ] ) ; Parameter(s): $h_Taskbar - Handle of taskbar window. ; $b_ReturnString - If False (default) returns number. If True returns string. ; Return Value(s): Position of taskbar, as follows: ; 0, 'top' ; 1, 'bottom' ; 2, 'left' ; 3, 'right' ; Author(s): Rob Saunders (admin@therks.com) ; ;=============================================================================== Func _UserNotification_TaskbarGetPos($h_Taskbar, $b_ReturnString = False) Local $s_TaskbarPos, $i_TaskbarPos, $a_TaskbarPos $a_TaskbarPos = WinGetPos($h_Taskbar) If $a_TaskbarPos[2] >= @DesktopWidth Then If $a_TaskbarPos[1] < @DesktopHeight / 2 Then $s_TaskbarPos = 'top' $i_TaskbarPos = 0 Else $s_TaskbarPos = 'bottom' $i_TaskbarPos = 1 EndIf Else If $a_TaskbarPos[0] < @DesktopWidth / 2 Then $s_TaskbarPos = 'left' $i_TaskbarPos = 2 Else $s_TaskbarPos = 'right' $i_TaskbarPos = 3 EndIf EndIf If $b_ReturnString Then Return $s_TaskbarPos Else Return $i_TaskbarPos EndIf EndFunc ;==>_TaskbarGetPos Edited April 18, 2008 by zorphnog
jben Posted April 18, 2008 Author Posted April 18, 2008 wow thats cool... The code seems very long though...Is it possible to just stick this in a .au3 folder and include it within my project..... thanks
jben Posted April 18, 2008 Author Posted April 18, 2008 Just had a little play with the code...I put the code in my autoit include folder and just used this: #include <MyExtras\NotificationBar.au3> ;this is a notification bar I put that code in my code at the point I wanted the notification popup to display and it seems to work fine, is this ok to go about it this way??... Just wondering if its fine to go about it this way.Thanks
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