anixon Posted January 31, 2010 Posted January 31, 2010 I am using this code to create a window in the place of a Notification Area ToolTip which does not allow you to set the background or text colors. Is there a way that when this window is launched its Icon does not appear on the Windows Taskbar 'That is the Windows Control which allows you to Minimize. Restore or Close the Window'. Ant.. expandcollapse popup;//Call the Message Box _StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED) ;//Display Startup Warning and Information Messages Func _StartUpMenu($dWidth, $dHeight, $dXaxis, $dYaxis, $dDuration, $dMessage, $dBGColor, $dTextColor, $dStyle) While 1 ;//Exit Menu After nn Minutes Nil Activity $MenuCycle = _TimeToTicks(@HOUR, @MIN, @SEC) $MenuEndCycle = $MenuCycle + $EndMenuTimer * $dDuration Local $sExit, $msg ;//Setup Window Pane GUICreate($Title, $dWidth, $dHeight, $dXaxis, $dYaxis, $dStyle) GUISetState(@SW_HIDE ) GUISetBkColor($dBGColor) GUICtrlCreateLabel($dMessage, 0, 5, $dWidth, 15, $SS_CENTER) GUICtrlSetColor(-1, $dTextColor) ;$sExit = GUICtrlCreatePic($sDisplay, 0, 0, $dWidth, $dHeight) GUISetState() ;//Menu Processor: While 1 ;//Exit after nn Minutes If _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then GUIDelete() ExitLoop (2) EndIf ;//Read the Input Message $msg = GUIGetMsg() ;//Check for User Input Select ;//Exit the Application Case $msg = $GUI_EVENT_CLOSE; Or $msg = $sExit GUIDelete() ExitLoop (2) EndSelect WEnd WEnd EndFunc ;==>_StartUpMenu
montymintypie Posted January 31, 2010 Posted January 31, 2010 Have you tried using the $WS_EX_TOOLWINDOW option?
anixon Posted January 31, 2010 Author Posted January 31, 2010 Have you tried using the $WS_EX_TOOLWINDOW option?Thanks for that but it does not produce the requested result Ant..;//Call the Message Box_StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED + $WS_EX_TOOLWINDOW)
Moderators Melba23 Posted January 31, 2010 Moderators Posted January 31, 2010 anixon,If you want to avoid the TaskBar button, just set the parent parameter when you create the GUI. Remember that if you do not have a parent to hand, you can always use the hidden AutoIt window. Try running this short script:#include <GUIConstantsEx.au3> $hGUI = GUICreate("TaskBar Button Test", 500, 500) GUISetState() GUICreate("I have a button!", 200, 100, 100, 100) GUISetState() GUICreate("I do not!", 200, 100, 100, 300, -1, -1, $hGUI) GUISetState() GUICreate("Nor me!", 200, 100, 100, 500, -1, -1, WinGetHandle(AutoitWinGetTitle())) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI hope that is what you wanted. 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 Â
AdmiralAlkex Posted January 31, 2010 Posted January 31, 2010 (edited) _StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED + $WS_EX_TOOLWINDOW)You are doing that wrong, you don't combine styles like that Edited January 31, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
GEOSoft Posted January 31, 2010 Posted January 31, 2010 Just create a popup window ($WS_POPUPWINDOW) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
anixon Posted January 31, 2010 Author Posted January 31, 2010 (edited) anixon, If you want to avoid the TaskBar button, just set the parent parameter when you create the GUI. Remember that if you do not have a parent to hand, you can always use the hidden AutoIt window. Try running this short script: #include <guiconstantsex.au3> $hGUI = GUICreate("TaskBar Button Test", 500, 500) GUISetState() GUICreate("I have a button!", 200, 100, 100, 100) GUISetState() GUICreate("I do not!", 200, 100, 100, 300, -1, -1, $hGUI) GUISetState() GUICreate("Nor me!", 200, 100, 100, 500, -1, -1, WinGetHandle(AutoitWinGetTitle())) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I hope that is what you wanted. M23 Very clever and thank you very much that is exactly what I wanted to achieve what can I say other than thanks again.. Ant. Having done the testing there is no Window opened by the compiled and running script in order to create the buttonless child so the issue is how to suppress the parent popup style window that is opened and closed by the script from appearing as a button on the taskbar. AutoIT is not running so I cannot use its hidden parent is there another hidden windows window that can be used? Ant..</guiconstantsex.au3> Edited January 31, 2010 by anixon
anixon Posted January 31, 2010 Author Posted January 31, 2010 Just create a popup window ($WS_POPUPWINDOW)I am using $WS_POPUPWINDOW which gives me the right type of window box and text like a tooltip but it also puts a button on the taskbar which I am trying to avoid and in myenvironment $WS_EX_TOOLWINDOW Creates a Window with controls and in my environment still puts a button on the taskbar Ant..
Moderators Melba23 Posted February 1, 2010 Moderators Posted February 1, 2010 anixon,AutoIT is not running so I cannot use its hidden parentWhen you run a compiled AutoIt script, the hidden AutoIt window is still present so you can still use it to act as a parent to your GUIs. I do this in many of my scripts to avoid a taskbar button. 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 Â
anixon Posted February 1, 2010 Author Posted February 1, 2010 anixon,When you run a compiled AutoIt script, the hidden AutoIt window is still present so you can still use it to act as a parent to your GUIs. I do this in many of my scripts to avoid a taskbar button. M23Thanks for that information sorry for the silly question but will this still work on a system which does not have AutoIt installed that runs the compiled script and how do you apply the process to a $WS_POPUPWINDOW stype window? Ant..
Moderators Melba23 Posted February 1, 2010 Moderators Posted February 1, 2010 anixon. As far as I know (because all my systems have AutoIt installed ) the window will be created by the interpreter which is the major part of the compiled exe. I believe that it needs this GUI to intercept the various Windows messages flying around (but do not quote me on that! ). As to applying this to a $WS_POPUP window, the styles of a GUI have nothing to do with the parent. Look at the syntax for GUICreate: GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) You can see that the style and exStyle parameters are independent of the parent parameter we use to prevent the TaskBar button. So to remove the Taskbar button from a $WS_POPUP style GUI, you do the exactly the same - use the parent parameter. Do not apologise for asking - that is why we are here! M23 P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read.  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 Â
anixon Posted February 1, 2010 Author Posted February 1, 2010 M23 You are a GENIUS the following works exactly as required. Given my age so much to learn so little time. I have just downloaded the latest version of AutoIT so I am now looking forward to the next round of what the............ Thanks again M23 Ant.. And the magic: GUICreate("Nor me!", 200, 100, -1, -1, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoitWinGetTitle()))
Moderators Melba23 Posted February 1, 2010 Moderators Posted February 1, 2010 anixon,Given my age so much to learn so little timeAnd what makes you think we are all young.....some of us may have been even be older than you when we started with AutoIt .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 Â
anixon Posted February 1, 2010 Author Posted February 1, 2010 Well for me it was either AutoIT or aged care.....
anixon Posted February 3, 2010 Author Posted February 3, 2010 (edited) And this is the work in progress. The initial question was can you set the color of the text for a TrayTip message Short Answer 'NO' . The following code is simply a Message Display Handler offering the user [3] display options [1] Standard Tray Tip, [2] Custom Tray Tip and [3] Splash Message Box. The function call variables controls which Display to Pop. There will be an additional Custom Box Option developed so that a Box style Pop-up can display colored background and text. For my purpose the value of colored text is to enhance the 'Good = Green, Bad = Red and Black = Normal' weight of the Message. A special thanks to those especially Melba23 who help me solve the Toolbar Button and x y display position issues for the Custom Traytip without the help I could not have achieved the required outcome.Ant.. expandcollapse popup;#cs #include <array.au3> ;//Array Processing #include <Date.au3> ;//Date Time Processing #include <EditConstants.au3> ;//Input Box Centering #include <File.au3> ;//Write to File #include <GUIConstants.au3> ;///GUI Interface #include <GUIConstantsEx.au3> ;//GUI Interface #include <GUIToolBar.au3>;//Cleanup the TaskBar Icon when performing an ProcessClose #include <StaticConstants.au3> ;//Static Constants #include <WindowsConstants.au3> ;//Windows Constants Global $hSysTray_Handle, $iSystray_ButtonNumber, $xAxisNTB, $xAxisIcon, $dXAxis, $dyaxis, $hSysTray_Handle, $iSystray_ButtonNumber, $sToolTipTitle = "Skype", _ $bGColor = 0xFcFcFe, $TextColorR = 0xFF0000, $TextColorG = 0x008040, $TextColorB = 0x000000, $message, $Title = "Process", _ $sToolTipTitle, $sMsgDuration, $sMsgDurationX = 1000, $sMessageStyle, $spare1, $spare2, $Font = "sans-serif", $FontSize = 10, $FontWeight = 600, _ $sMessageHeight = 50, $iMessageHeight = 25, $sMsgTextJust = 32 ;//Demo Variables $sToolTipTitle = "Skype" $message = "This is the Message" $dStyle = 1 $TextColor = $TextColorG $sMsgDuration = 4 $sMessageStyle = 1 ;//Message Display Call _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message) ;//Message Display Processor [Can be Switched On/Off with Duration Value] Func _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message) While 1 ;//Messaging Switched OFF If $sMsgDuration = 0 Then ExitLoop ;//Standard ToolTip Style Pop-Up If $dStyle = 1 And $sMessageStyle = 0 Then ;//Display Pop-Up TrayTip("", $message, 5) Sleep($sMsgDuration * $sMsgDurationX) TrayTip("Clear Previous TrayTip", "", 0) EndIf ;//Coloured Status ToolTip Style Pop-Up If $dStyle = 1 And $sMessageStyle = 1 Then $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle) ;//'X' Axis [0] 'Y" Axis [2] Windows Notification Bar $xAxisNTB = WinGetPos($hSysTray_Handle) ;//'X' Axis Icon on Notification Bar $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber) ;//Calculate Message Box Width [Sans-serif 10 600] $dWidth = (StringLen($message) * 6.34) + 15 ;//Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon $dXAxis = $xAxisNTB[0] + $xAxisIcon[0] ;//Display Left of Icon [DestopWidth Exceeded] If $xAxisNTB[0] + $dWidth + 35 > @DesktopWidth Then $dXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - $dWidth ;//Calculate the Y Position of the Message Box [+ 5 = Gap between Desktop and Notification Toolbar] $dyaxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5) While 1 ;//Set the Message Delay Exit Timer $MenuCycle = _TimeToTicks(@HOUR, @MIN, @SEC) $MenuEndCycle = $MenuCycle + ($sMsgDuration * $sMsgDurationX) ;//Display the Pop-UP [WinGetHandle Suppresses the Taskbar Button for this Window] GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle())) GUISetBkColor($bGColor) GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER) ;//Black Green or Red GUICtrlSetColor(-1, $TextColor) GUISetState() ;//Exit Message Processor While 1 ;//Exit after nn Minutes If _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then GUIDelete() ExitLoop (2) EndIf WEnd WEnd EndIf ;//Splash Message Box Style If $dStyle = 2 Then ;//Set Window Width based on Number of Chrs in First Line of the Message $dMessage = StringSplit($message, @CRLF) ;//Calculate the Message Box Width $MsgWidth = Round(StringLen($dMessage[1]) * $FontSize - 2, -1) ;//Set the Default Message Width If $MsgWidth < 250 Then $MsgWidth = 250 ;//Display the Message Box SplashTextOn($Title, $message, $MsgWidth, $sMessageHeight, -1, -1, $sMsgTextJust, $Font, $FontSize, $FontWeight) ;//Length of display in Milliseconds Sleep($sMsgDuration * $sMsgDurationX) SplashOff() EndIf ;//Exit the Message Display Routine ExitLoop WEnd EndFunc ;==>_MessageDisplay 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) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc ;==>_Get_Systray_Index ;#ce Edited February 3, 2010 by anixon
Moderators Melba23 Posted February 3, 2010 Moderators Posted February 3, 2010 anoxon,I am sure you wil take this in the spirit in which it is sent.... Here is a modified version of your script. There was nothing wrong with what you had - I have a different style and I thought that another view might be of interest.A few major points to begin with:1. You should have as few Global variables as you can get away with. There are 2 reasons for this: First, Global variables use memory - Local variables are destroyed when you no longer need them. Second, there is less risk of having a naming conflict and so overwriting something that you should not! If you have time, read Valik's posts in this topic - most enlightening.2. Switch structures are nearly always faster - and certainly easier to maintain - than multiple If structures.3, Use TimerInit and TimerDiff for short term timers - _TicksToTime and _TimeToTicks are better suited to longer running events.So here my version - if you want to look: expandcollapse popup;#cs #include <array.au3> ; Array Processing #include <Date.au3> ; Date Time Processing #include <EditConstants.au3> ; Input Box Centering #include <File.au3> ; Write to File #include <GUIConstants.au3> ; /GUI Interface #include <GUIConstantsEx.au3> ; GUI Interface #include <GUIToolBar.au3>; Cleanup the TaskBar Icon when performing an ProcessClose #include <StaticConstants.au3> ; Static Constants #include <WindowsConstants.au3> ; Windows Constants Global $hSysTray_Handle ;Global $iSystray_ButtonNumber ;Global $xAxisNTB ;Global $xAxisIcon ;Global $dXAxis ;Global $dyaxis ;Global $hSysTray_Handle ;Global $iSystray_ButtonNumber Global $sToolTipTitle = "Skype" Global $bGColor = 0xFcFcFe Global $TextColorR = 0xFF0000 Global $TextColorG = 0x008040 Global $TextColorB = 0x000000 Global $message Global $Title = "Process" Global $sToolTipTitle Global $sMsgDuration Global $sMsgDurationX = 1000 Global $sMessageStyle ;Global $spare1 ;Global $spare2 Global $Font = "sans-serif" Global $FontSize = 10 Global $FontWeight = 600 Global $sMessageHeight = 50 Global $iMessageHeight = 25 Global $sMsgTextJust = 32 ; Demo Variables $sToolTipTitle = "Skype" $message = "This is the Message" $dStyle = 1 $TextColor = $TextColorG $sMsgDuration = 4 $sMessageStyle = 1 TrayTip("Test", $message, 5) ; Message Display Call _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message) ; Message Display Processor [Can be Switched On/Off with Duration Value] Func _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message) While 1 ; Messaging Switched OFF If $sMsgDuration = 0 Then ExitLoop Switch $dStyle ; Standard ToolTip Style Pop-Up Case 1 Switch $sMessageStyle ; Display Pop-Up Case 0 TrayTip("Test", $message, 5) Sleep($sMsgDuration * $sMsgDurationX) TrayTip("Clear Previous TrayTip", "", 0) ; Coloured Status ToolTip Style Pop-Up Case 1 Local $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle) ; 'X' Axis [0] 'Y" Axis [2] Windows Notification Bar Local $xAxisNTB = WinGetPos($hSysTray_Handle) ; 'X' Axis Icon on Notification Bar Local $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber) ; Calculate Message Box Width [Sans-serif 10 600] Local $dWidth = (StringLen($message) * 6.34) + 15 ; Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon Local $dXAxis = $xAxisNTB[0] + $xAxisIcon[0] ; Display Left of Icon [DestopWidth Exceeded] If $xAxisNTB[0] + $dWidth + 35 > @DesktopWidth Then $dXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - $dWidth ; Calculate the Y Position of the Message Box [+ 5 = Gap between Desktop and Notification Toolbar] Local $dyaxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5) While 1 ; Set the Message Delay Exit Timer Local $MenuCycle = TimerInit() ; _TimeToTicks(@HOUR, @MIN, @SEC) Local $MenuEndCycle = $sMsgDuration * $sMsgDurationX ; $MenuCycle + ($sMsgDuration * $sMsgDurationX) ; Display the Pop-UP [WinGetHandle Suppresses the Taskbar Button for this Window] Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle())) GUISetBkColor($bGColor) GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER) ; Black Green or Red GUICtrlSetColor(-1, $TextColor) GUISetState() ; Exit Message Processor While 1 ; Exit after nn Minutes If TimerDiff($MenuCycle) >= $MenuEndCycle Then ; _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then GUIDelete($hGUI_Message) ExitLoop (2) EndIf WEnd WEnd EndSwitch ; Splash Message Box Style Case 2 ; Set Window Width based on Number of Chrs in First Line of the Message $dMessage = StringSplit($message, @CRLF) ; Calculate the Message Box Width Local $MsgWidth = Round(StringLen($dMessage[1]) * $FontSize - 2, -1) ; Set the Default Message Width If $MsgWidth < 250 Then $MsgWidth = 250 ; Display the Message Box SplashTextOn($Title, $message, $MsgWidth, $sMessageHeight, -1, -1, $sMsgTextJust, $Font, $FontSize, $FontWeight) ; Length of display in Milliseconds Sleep($sMsgDuration * $sMsgDurationX) SplashOff() EndSwitch ; Exit the Message Display Routine ExitLoop WEnd EndFunc ;==>_MessageDisplay 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) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc ;==>_Get_Systray_Index ;#cePlease ask if anyting is unclear - or if you violently disagree! Remember what I said: there was nothing wrong with what you wrote - it passed the acid test of working correctly - and this is just another view of how it might be done. 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 Â
anixon Posted February 16, 2010 Author Posted February 16, 2010 (edited) I am having an issue with the code [either mine or the Melba23 version] and that is whilst it is running it is taking away the focus from any other window that is open. For example if I am composing a message in Outlook whilst the script is running as soon as the script calls the tool tip routine 'func' I loose focus and can only get it back when I have to click the Outlook window.I am guess now that this is associated with this Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle())) and the WinGetHandle statement which is required to eliminate the Taskbar button. Any ideas? Ant.. Bump Edited February 21, 2010 by anixon
Moderators Melba23 Posted February 22, 2010 Moderators Posted February 22, 2010 anixon,Sorry, missed this last time round.You need to show, but not activate, the pop-up window - fortunately that is easy to do. This should work and prevent the message grabbing the focus:Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle())) GUISetBkColor($bGColor) GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER) ; Black Green or Red GUICtrlSetColor(-1, $TextColor) GUISetState(@SW_SHOWNOACTIVATE, $hGUI_Message) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< !!!!Does that solve it?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 Â
anixon Posted February 23, 2010 Author Posted February 23, 2010 (edited) Thank you Melba23 for your assistance which is very much appreciated. The Pop-Up code now works perfectly. I have made a further modification to the code which better calculates the width of the Pop-up based on the string length and the font sans-serif 9 400 $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle) ;//'X' Axis [0] 'Y" Axis [2] Windows Notification Bar $xAxisNTB = WinGetPos($hSysTray_Handle) ;//'X' Axis Icon on Notification Bar $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber) ;//Calculate Message Box Width [Sans-serif 9 400] $FontValue = $xFontSize - (0.040 * (StringLen($message) - 10)) ;//Set Box Width $xWidth = StringLen($message) * $FontValue ;//Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon $xXAxis = $xAxisNTB[0] + $xAxisIcon[0] ;//Display Right or Left of Icon [Desktop Width Exceeded] If $xAxisNTB[0] + $xWidth + $xMaxWidth > @DesktopWidth Then $xXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - ($xWidth + 5) ;//Calculate the Y Position of the Message Box [+ 5 = Gap between Desktop and Notification Toolbar] $xYAxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5) Edited February 23, 2010 by anixon
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