nitekram Posted March 22, 2014 Posted March 22, 2014 (edited) So far I am just testing, as I had been using TrayTip, and now I am checking for the OS, and if win_7 use your code. As far as the text being displayed, it is only this long GCARS#D-9H5SRV-DD8, so do not think that is the issue? I took out the code _Toast_Hide(), and I am able to replicate the "bug". I did create a new script and just used this code, and it worked just fine. I have no clue. #include "Toast.au3" _Toast_Set(1) _Toast_Show(0, 'Ticket Number', 'GCARS#D-9H5SRV-DD8', 3) ;_Toast_Hide() ; commented out, and with just this code, it works fine Here is the whole function I am using that does 'NOT' work as described, but not sure what might be hanging it up. EDIT spelling, I am still having issues with code boxes, not leaving enough room at the bottom to put cursor in to get another line, so had to add the edit here expandcollapse popupFunc GetTicketNumber() ;MsgBox('','','Called GetTicketNumber') Local $sAlertInfo, $count = 0 ClipPut('') Do $count += 1 _SendEx('^c') Sleep(200) $sAlertInfo = ClipGet() If $sAlertInfo = '' Then $sAlertInfo = 'NOTHING' ConsoleWrite($count & ' ' & $sAlertInfo & @CRLF) $sAlertInfo = '' ContinueLoop EndIf ConsoleWrite($count & ' ') Until $sAlertInfo <> '' Or $count = 20 If $count = 20 Then MsgBox('', 'ERROR', 'PLEASE RESTART SMARTS - check to see if you can highlight and copy and paste to notepad - also check Java Version 1.6.0_37 should be only one running') ; #cs If @error Then MsgBox('','@error',@error) Else MsgBox('','ClipGet()',ClipGet()) EndIf #ce ; ClipPut('') Sleep(200) ;MsgBox('', '$sAlertInfo', $sAlertInfo) Local $aAlertInfo = StringSplit($sAlertInfo, @TAB) ;_ArrayDisplay($aAlertInfo, UBound($aAlertInfo)) If UBound($aAlertInfo) = 16 Then ; NEW ;If ClipGet() <> '' Then MsgBox('', '', '') If @OSVersion = "WIN_XP" Then TrayTip('Ticket Number', $aAlertInfo[2], 3) ElseIf @OSVersion = "WIN_7" Then _Toast_Set(1) _Toast_Show(0, 'Ticket Number', $aAlertInfo[2], 3) _Toast_Hide() Else MsgBox($cONTOP, 'ERROR OS NOT SUPPORTED', 'Only XP and Windows 7 are supported for Balloon type tips') EndIf $aAlertInfo[2] = RemoveSpace($aAlertInfo[2]) $aAlertInfo[2] = GetClipBoard($aAlertInfo[2]) ClipPut($aAlertInfo[2]) ClipPut($aAlertInfo[2]) ElseIf UBound($aAlertInfo) = 15 Then ; In Progs If ClipGet() <> '' Then MsgBox('', '', '') If @OSVersion = "WIN_XP" Then TrayTip('Ticket Number', $aAlertInfo[2], 3) ElseIf @OSVersion = "WIN_7" Then _Toast_Set(1) _Toast_Show(0, 'Ticket Number', $aAlertInfo[2], 3) ;_Toast_Hide() Else MsgBox($cONTOP, 'ERROR OS NOT SUPPORTED', 'Only XP and Windows 7 are supported for Balloon type tips') EndIf ;MsgBox('', '$aAlertInfo[2]', $aAlertInfo[2]) $aAlertInfo[2] = RemoveSpace($aAlertInfo[2]) $aAlertInfo[2] = GetClipBoard($aAlertInfo[2]) ;MsgBox('', '$aAlertInfo[2]', $aAlertInfo[2]) ClipPut($aAlertInfo[2]) ClipPut($aAlertInfo[2]) ElseIf UBound($aAlertInfo) = 8 Then ; Parked ;If ClipGet() <> '' Then MsgBox('', '', '') If @OSVersion = "WIN_XP" Then TrayTip('Ticket Number', $aAlertInfo[4], 3) ElseIf @OSVersion = "WIN_7" Then _Toast_Set(1) _Toast_Show(0, 'Ticket Number', $aAlertInfo[4], 3) _Toast_Hide() Else MsgBox($cONTOP, 'ERROR OS NOT SUPPORTED', 'Only XP and Windows 7 are supported for Balloon type tips') EndIf $aAlertInfo[4] = RemoveSpace($aAlertInfo[4]) $aAlertInfo[4] = GetClipBoard($aAlertInfo[4]) ClipPut($aAlertInfo[4]) ClipPut($aAlertInfo[4]) ElseIf UBound($aAlertInfo) = 6 Then ; suppressed ;If ClipGet() <> '' Then MsgBox('', '', '') If @OSVersion = "WIN_XP" Then TrayTip('Ticket Number', $aAlertInfo[2], 3) ElseIf @OSVersion = "WIN_7" Then _Toast_Set(1) _Toast_Show(0, 'Ticket Number', $aAlertInfo[2], 3) _Toast_Hide() Else MsgBox($cONTOP, 'ERROR OS NOT SUPPORTED', 'Only XP and Windows 7 are supported for Balloon type tips') EndIf $aAlertInfo[2] = RemoveSpace($aAlertInfo[2]) $aAlertInfo[2] = GetClipBoard($aAlertInfo[2]) ClipPut($aAlertInfo[2]) ClipPut($aAlertInfo[2]) Else MsgBox($cONTOP, 'ERROR on amount of fields', 'Smarts might not be correct. Check that you have all the columns, and make sure they match coworkers') EndIf ;MsgBox('','$aAlertInfo[2]',$aAlertInfo[2]) EndFunc ;==>GetTicketNumber Edited March 22, 2014 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 24, 2014 Author Moderators Posted March 24, 2014 nitekram,Sorry, I got caught up in a lot of other things yesterday (including flying twice ) and forgot about this. Can you run this script and let me know what appears in the SciTE console.; Screen size ConsoleWrite("Screen: " & @DesktopWidth & " - " & @DesktopHeight & @CRLF) $aVirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) ; $SM_VIRTUALWIDTH $aVirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) ; $SM_VIRTUALHEIGHT ConsoleWrite("Virtual: " & $aVirtualDesktopWidth[0] & " - " & $aVirtualDesktopHeight[0] & @CRLF) Global $tWorkArea ; Determine which struct syntax to use to use If @AutoItVersion < "3.3.8.0" Then $tWorkArea = DllStructCreate("long Left;long Top;long Right;long Bottom") Else $tWorkArea = DllStructCreate("struct;long Left;long Top;long Right;long Bottom;endstruct") EndIf ; Check if Taskbar is hidden Global $aRet = DllCall("shell32.dll", "uint", "SHAppBarMessage", "dword", 0x00000004, "ptr*", 0) ; $ABM_GETSTATE If BitAND($aRet[0], 0x01) Then ; Find hidden taskbar Global $iPrevMode = Opt("WinTitleMatchMode", 4) Global $aTray_Pos = WinGetPos("[CLASS:Shell_TrayWnd]") Opt("WinTitleMatchMode", $iPrevMode) ConsoleWrite("Hidden: " & $aTray_Pos[0] & " - " & $aTray_Pos[1] & " - " & $aTray_Pos[2] & " - " & $aTray_Pos[3] & @CRLF) Else ; Determine available work area ; $SPI_GETWORKAREA = 48 DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", 48, "uint", 0, "ptr", DllStructGetPtr($tWorkArea), "uint", 0) Global $aWorkArea[4] = [DllStructGetData($tWorkArea, "Left"), DllStructGetData($tWorkArea, "Top"), _ DllStructGetData($tWorkArea, "Right"), DllStructGetData($tWorkArea, "Bottom")] ConsoleWrite("Visible: " & $aWorkArea[0] & " - " & $aWorkArea[1] & " - " & $aWorkArea[2] & " - " & $aWorkArea[3] & @CRLF) EndIfLooking at the "problem" function you posted now. 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
nitekram Posted March 24, 2014 Posted March 24, 2014 I have to wait for my next day of work - Wednesday, thanks 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
nitekram Posted March 26, 2014 Posted March 26, 2014 nitekram, Can you run this script and let me know what appears in the SciTE console. Screen: 1280 - 1024 Virtual: 2560 - 1056 Visible: 0 - 0 - 1280 - 1024 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 nitekram,Thanks. I can see why the Toast appears in the wrong place on the wrong screen - the code thinks the taskbar is at 0,0 and so at the top of the left screen, hence the location of the Toast.The next question is how you got your taskbar to appear at the bottom of the right screen? Does it just appear there automatically when you have a second screen or do you have to tell it to go there? If the lattter, how do you do 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
nitekram Posted March 26, 2014 Posted March 26, 2014 (edited) The taskbar can be moved anywhere. In my setup, there are 4 sides and 2 monitors, so a total of 8 places it can be moved to. You have to unlock it first, then just click and drag it to any side of the screen you want. EDIT Mine is set on the secondary monitor on the bottom Edited March 26, 2014 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 nitekram,Thanks again. Time to go and put my thinking cap on. 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
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 (edited) nitekram,Can you run this and let me have the result please: Opt("WinTitleMatchMode", 4) Local $aTray_Pos = WinGetPos("[CLASS:Shell_TrayWnd]") ConsoleWrite($aTray_Pos[0] & " - " & $aTray_Pos[1] & " - " & $aTray_Pos[2] & " - " & $aTray_Pos[3] & @CRLF)M23 Edited March 26, 2014 by Melba23 Typo 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
nitekram Posted March 26, 2014 Posted March 26, 2014 nitekram, Can you run this and let me have the result please: 1280 - 974 - 1280 - 82 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 nitekram,Excellent - I can see how to get the Toast in the right place. Although the solution might cause problems for MilesAhead with his RocketDock add-on - I will have to work out how to get both options to work together. 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
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 (edited) nitekram,Try this version of the UDF and see if the Toasts now appear in the "correct" place for you: <code removed>If it does I can start work on getting to play nicely with docked toolbars. M23 Edited March 26, 2014 by Melba23 Code removed 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
nitekram Posted March 26, 2014 Posted March 26, 2014 (edited) It does appear, yet it is now on the bottom right of the primary screen, as compared to the top left of the primary screen. We are trying to get it to go to the secondary screen, in about the same location Secondary monitor is on the left, Primary monitor on the right. Edited March 26, 2014 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 (edited) nitekram,And now this version, please: <code removed>M23 Edited March 26, 2014 by Melba23 Code removed 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
nitekram Posted March 26, 2014 Posted March 26, 2014 If it is showing, it is not visable. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 (edited) nitekram,And the next one please. Please post the console data: <code removed>M23 Edited March 26, 2014 by Melba23 Code removed 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
nitekram Posted March 26, 2014 Posted March 26, 2014 Taskbar: -1280 - 974 - 1280 - 82 Virtual Destop: 2560 - 1056 Toast: 2400 - 916 - 150 - 56 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 nitekram,The problem is arising because you have the secondary monitor to the left - so it has negative ccordinates. I will revisit the maths. Sorry about all the testing - perhaps if you offered to buy me a second card and monitor..... 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
nitekram Posted March 26, 2014 Posted March 26, 2014 Sorry about all the testing - perhaps if you offered to buy me a second card and monitor..... M23 I will get on that. I thank you for your help...!!! 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Moderators Melba23 Posted March 26, 2014 Author Moderators Posted March 26, 2014 nitekram,I have added a new parameter to tell the UDF if the taskbar is located on a secondary monitor and where that monitor is placed (right/below/left/above) in relation to the main monitor as it became too complex to work it out from the various measurements. So you will need to add a _Toast_Set line like this at the top of the script:Func _Toast_Set(Default, Default, Default, Default, Default, Default, Default, 3)to tell the UDF that you have the taskbar on a secondary monitor to the left of the main monitor. If you need to replace any of the Default parameters then please do so - the important bit is the 3 at the end. Then use this version to test - it gives the correct results when I run it with the data you gave me, but the real test is when you try it: expandcollapse popup#include-once ; #INDEX# ============================================================================================================ ; Title .........: Toast ; AutoIt Version : 3.3.8.0 ; Language ......: English ; Description ...: Show and hides slice messages from the systray in user defined colours and fonts ; Author(s) .....: Melba23 - using some code from guinness and MilesAhead in _Toast_Locate ; ==================================================================================================================== ;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #INCLUDES# ========================================================================================================= #include <StringSize.au3> #include <GDIPlus.au3> ; #GLOBAL VARIABLES# ================================================================================================= Global $iDef_Toast_Font_Size = _Toast_GetDefFont(0) Global $sDef_Toast_Font_Name = _Toast_GetDefFont(1) Global $hToast_Handle = 0 Global $hToast_Close_X = 9999 Global $iToast_Move = 0 Global $iToast_Style = 1 ; $SS_CENTER Global $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8 Global $iToast_Header_BkCol = $aRet[0] $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5 Global $iToast_Header_Col = $aRet[0] Global $iToast_Header_Bold = 0 Global $iToast_Message_BkCol = $iToast_Header_Col Global $iToast_Message_Col = $iToast_Header_BkCol Global $iToast_Font_Size = $iDef_Toast_Font_Size Global $sToast_Font_Name = $sDef_Toast_Font_Name Global $iToast_Taskbar = 0 Global $iToast_Timer = 0 Global $iToast_Start = 0 Global $fToast_Close = False ; #CURRENT# ========================================================================================================== ; _Toast_Set: Sets text justification and optionally colours and font, for _Toast_Show function calls ; _Toast_Show: Shows a slice message from the systray ; _Toast_Hide: Hides a slice message from the systray ; ==================================================================================================================== ; #INTERNAL_USE_ONLY#================================================================================================= ; _Toast_Locate: Find Systray and determine Toast start position and movement direction ; _Toast_Timer_Check: Checks whether Toast has timed out or closure [X] clicked ; _Toast_WM_EVENTS: Message handler to check if closure [X] clicked ; _Toast_GetDefFont: Determine system default MsgBox font and size ; _Toast_ShowPNG: Set PNG as image ; _Toast_BitmapCreateDIB: Create bitmap ; ==================================================================================================================== ; #FUNCTION# ========================================================================================================= ; Name...........: _Toast_Set ; Description ...: Sets text justification and optionally colours and font, for _Toast_Show function calls ; Syntax.........: _Toast_Set($vJust, [$iHdr_BkCol, [$iHdr_Col, [$iMsg_BkCol, [$iMsg_Col, [$sFont_Size, [$iFont_Name, [$iTaskbar]]]]]]]) ; Parameters ....: $vJust - 0 = Left justified, 1 = Centred (Default), 2 = Right justified ; Can use $SS_LEFT, $SS_CENTER, $SS_RIGHT ; + 4 = Header text in bold ; >>>>> Setting this parameter to' Default' will reset ALL parameters to default values <<<<< ; >>>>> All optional parameters default to system MsgBox default values <<<<< ; $iHdr_BkCol - [Optional] The colour for the title bar background ; $iHdr_Col - [Optional] The colour for the title bar text ; $iMsg_BkCol - [Optional] The colour for the message background ; $iMsg_Col - [Optional] The colour for the message text ; Omitting a colour parameter or setting it to -1 leaves it unchanged ; Setting a colour parameter to Default resets the system colour ; $iFont_Size - [Optional] The font size in points to use for the Toast ; $sFont_Name - [Optional] The font to use for the Toast ; >>>>> Omitting a font parameter, setting size to -1 or name to "" leaves it unchanged <<<<< ; >>>>> Setting a font parameter to Default resets the system message box font or size <<<<< ; $iTaskbar - [Optional] 0 - Taskbar on main monitor (default) ; 1 - Taskbar on secondary monitor to right ; 2 - Taskbar on secondary monitor below ; 3 - Taskbar on secondary monitor to left ; 4 - Taskbar on secondary monitor above ; +8 - Toolbar docked to taskbar ; Requirement(s).: v3.3.2.0 or higher - AdlibRegister/Unregister used in _Toast_Show ; Return values .: Success - Returns 1 ; Failure - Returns 0 and sets @error to 1 with @extended set to parameter index number ; Author ........: Melba23 ; Example........; Yes ;===================================================================================================================== Func _Toast_Set($vJust, $iHdr_BkCol = -1, $iHdr_Col = -1, $iMsg_BkCol = -1, $iMsg_Col = -1, $iFont_Size = -1, $sFont_Name = "", $iTaskbar = 0) ; Set parameters Switch $vJust Case Default $iToast_Style = 1; $SS_CENTER $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8 $iToast_Header_BkCol = $aRet[0] $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5 $iToast_Header_Col = $aRet[0] $iToast_Message_BkCol = $iToast_Header_Col $iToast_Message_Col = $iToast_Header_BkCol $sToast_Font_Name = $sDef_Toast_Font_Name $iToast_Font_Size = $iDef_Toast_Font_Size $iToast_Taskbar = 0 Return Case 0, 1, 2, 4, 5, 6 $iToast_Style = $vJust Case -1 ; Do nothing Case Else Return SetError(1, 1, 0) EndSwitch Switch $iHdr_BkCol Case Default $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8 $iToast_Header_BkCol = $aRet[0] Case 0 To 0xFFFFFF $iToast_Header_BkCol = Int($iHdr_BkCol) Case -1 ; Do nothing Case Else Return SetError(1, 2, 0) EndSwitch Switch $iHdr_Col Case Default $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5 $iToast_Header_Col = $aRet[0] Case 0 To 0xFFFFFF $iToast_Header_Col = Int($iHdr_Col) Case -1 ; Do nothing Case Else Return SetError(1, 3, 0) EndSwitch Switch $iMsg_BkCol Case Default $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5 $iToast_Message_BkCol = $aRet[0] Case 0 To 0xFFFFFF $iToast_Message_BkCol = Int($iMsg_BkCol) Case -1 ; Do nothing Case Else Return SetError(1, 4, 0) EndSwitch Switch $iMsg_Col Case Default $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8 $iToast_Message_Col = $aRet[0] Case 0 To 0xFFFFFF $iToast_Message_Col = Int($iMsg_Col) Case -1 ; Do nothing Case Else Return SetError(1, 5, 0) EndSwitch Switch $iFont_Size Case Default $iToast_Font_Size = $iDef_Toast_Font_Size Case 8 To 72 $iToast_Font_Size = Int($iFont_Size) Case -1 ; Do nothing Case Else Return SetError(1, 6, 0) EndSwitch Switch $sFont_Name Case Default $sToast_Font_Name = $sDef_Toast_Font_Name Case "" ; Do nothing Case Else If IsString($sFont_Name) Then $sToast_Font_Name = $sFont_Name Else Return SetError(1, 7, 0) EndIf EndSwitch Switch $iTaskbar Case Default $iToast_Taskbar = 0 Case 0 To 4, 8 To 12 If IsInt($iTaskbar) Then $iToast_Taskbar = $iTaskbar Else $iToast_Taskbar = 0 EndIf EndSwitch Return 1 EndFunc ;==>_Toast_Set ; #FUNCTION# ========================================================================================================= ; Name...........: _Toast_Show ; Description ...: Shows a slice message from the systray ; Syntax.........: _Toast_Show($vIcon, $sTitle, $sMessage, [$iDelay [, $fWait [, $fRaw]]]) ; Parameters ....: $vIcon - 0 - No icon, 8 - UAC, 16 - Stop, 32 - Query, 48 - Exclamation, 64 - Information ; The $MB_ICON constant can also be used for the last 4 above ; If set to the name of an exe, the main icon of that exe will be displayed ; If set to the name of an image file, that image will be displayed ; Any other value returns -1, error 1 ; $sTitle - Text to display on Title bar ; $sMessage - Text to display in Toast body ; $iDelay - The delay in seconds before the Toast retracts or script continues (Default = 0) ; If negative, an [X] is added to the title bar. Clicking [X] retracts/continues immediately ; $fWait - True - Script waits for delay time before continuing and Toast remains visible ; False - Script continues and Toast retracts automatically after delay time ; $fRaw - True - Message is not wrapped and Toast expands to show full width ; - False - Message is wrapped if over max preset Toast width ; Requirement(s).: v3.3.1.5 or higher - AdlibRegister/Unregister used in _Toast_Show ; Return values .: Success: Returns 2-element array: [Toast width, Toast height] ; Failure: Returns -1 and sets @error as follows: ; 1 = Toast GUI creation failed ; 2 = Taskbar not found ; 4 = When using Raw, the Toast is too wide for the display ; 3 = StringSize error ; Author ........: Melba23, based on some original code by GioVit for the Toast ; Notes .........; Any visible Toast is retracted by a subsequent _Toast_Hide or _Toast_Show, or clicking a visible [X] ; Example........; Yes ;===================================================================================================================== Func _Toast_Show($vIcon, $sTitle, $sMessage, $iDelay = 0, $fWait = True, $fRaw = False) ; Store current GUI mode and set Message mode Local $nOldOpt = Opt('GUIOnEventMode', 0) ; Retract any Toast already in place If $hToast_Handle <> 0 Then _Toast_Hide() ; Reset non-reacting Close [X] ControlID $hToast_Close_X = 9999 ; Set default auto-sizing Toast widths Local $iToast_Width_max = 500 Local $iToast_Width_min = 150 ; Check for icon Local $iIcon_Style = 0 Local $iIcon_Reduction = 36 Local $sDLL = "user32.dll" Local $sImg = "" If StringIsDigit($vIcon) Then Switch $vIcon Case 0 $iIcon_Reduction = 0 Case 8 $sDLL = "imageres.dll" $iIcon_Style = 78 Case 16 ; Stop $iIcon_Style = -4 Case 32 ; Query $iIcon_Style = -3 Case 48 ; Exclam $iIcon_Style = -2 Case 64 ; Info $iIcon_Style = -5 Case Else Return SetError(1, 0, -1) EndSwitch Else Switch StringLower(StringRight($vIcon, 3)) Case "exe", "ico" $sDLL = $vIcon $iIcon_Style = 0 Case "bmp", "jpg", "gif", "png" $sImg = $vIcon EndSwitch EndIf ; Determine max message width Local $iMax_Label_Width = $iToast_Width_max - 20 - $iIcon_Reduction If $fRaw = True Then $iMax_Label_Width = 0 ; Get message label size Local $aLabel_Pos = _StringSize($sMessage, $iToast_Font_Size, Default, Default, $sToast_Font_Name, $iMax_Label_Width) If @error Then $nOldOpt = Opt('GUIOnEventMode', $nOldOpt) Return SetError(3, 0, -1) EndIf ; Reset text to match rectangle $sMessage = $aLabel_Pos[0] ;Set line height for this font Local $iLine_Height = $aLabel_Pos[1] ; Set label size Local $iLabelwidth = $aLabel_Pos[2] Local $iLabelheight = $aLabel_Pos[3] ; Set Toast size Local $iToast_Width = $iLabelwidth + 20 + $iIcon_Reduction ; Check if Toast will fit on screen If $iToast_Width > @DesktopWidth - 20 Then $nOldOpt = Opt('GUIOnEventMode', $nOldOpt) Return SetError(4, 0, -1) EndIf ; Increase if below min size If $iToast_Width < $iToast_Width_min + $iIcon_Reduction Then $iToast_Width = $iToast_Width_min + $iIcon_Reduction $iLabelwidth = $iToast_Width_min - 20 EndIf ; Set title bar height - with minimum for [X] Local $iTitle_Height = 0 If $sTitle = "" Then If $iDelay < 0 Then $iTitle_Height = 6 Else $iTitle_Height = $iLine_Height + 2 If $iDelay < 0 Then If $iTitle_Height < 17 Then $iTitle_Height = 17 EndIf EndIf ; Set Toast height as label height + title bar + bottom margin Local $iToast_Height = $iLabelheight + $iTitle_Height + 20 ; Ensure enough room for icon if displayed If $iIcon_Reduction Then If $iToast_Height < $iTitle_Height + 42 Then $iToast_Height = $iTitle_Height + 47 EndIf ; Get Toast starting position and direction Local $aToast_Data = _Toast_Locate($iToast_Width, $iToast_Height) ; Create Toast slice with $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW style and $WS_EX_TOPMOST extended style $hToast_Handle = GUICreate("", $iToast_Width, $iToast_Height, $aToast_Data[0], $aToast_Data[1], 0x80880000, BitOR(0x00000080, 0x00000008)) If @error Then $nOldOpt = Opt('GUIOnEventMode', $nOldOpt) Return SetError(1, 0, -1) EndIf GUISetFont($iToast_Font_Size, Default, Default, $sToast_Font_Name) GUISetBkColor($iToast_Message_BkCol) ; Set centring parameter Local $iLabel_Style = 0 ; $SS_LEFT If BitAND($iToast_Style, 1) = 1 Then $iLabel_Style = 1 ; $SS_CENTER ElseIf BitAND($iToast_Style, 2) = 2 Then $iLabel_Style = 2 ; $SS_RIGHT EndIf ; Check installed fonts Local $sX_Font = "WingDings" Local $sX_Char = "x" Local $i = 1 While 1 Local $sInstalled_Font = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", $i) If @error Then ExitLoop If StringInStr($sInstalled_Font, "WingDings 2") Then $sX_Font = "WingDings 2" $sX_Char = "T" EndIf $i += 1 WEnd ; Create title bar if required If $sTitle <> "" Then ; Create disabled background strip GUICtrlCreateLabel("", 0, 0, $iToast_Width, $iTitle_Height) GUICtrlSetBkColor(-1, $iToast_Header_BkCol) GUICtrlSetState(-1, 128) ; $GUI_DISABLE ; Set title bar width to offset text Local $iTitle_Width = $iToast_Width - 10 ; Create closure [X] if needed If $iDelay < 0 Then ; Create [X] Local $iX_YCoord = Int(($iTitle_Height - 17) / 2) $hToast_Close_X = GUICtrlCreateLabel($sX_Char, $iToast_Width - 18, $iX_YCoord, 17, 17) GUICtrlSetFont(-1, 14, Default, Default, $sX_Font) GUICtrlSetBkColor(-1, -2) ; $GUI_BKCOLOR_TRANSPARENT GUICtrlSetColor(-1, $iToast_Header_Col) ; Reduce title bar width to allow [X] to activate $iTitle_Width -= 18 EndIf ; Create Title label with bold text, centred vertically in case bar is higher than line GUICtrlCreateLabel($sTitle, 10, 0, $iTitle_Width, $iTitle_Height, 0x0200) ; $SS_CENTERIMAGE GUICtrlSetBkColor(-1, $iToast_Header_BkCol) GUICtrlSetColor(-1, $iToast_Header_Col) If BitAND($iToast_Style, 4) = 4 Then GUICtrlSetFont(-1, $iToast_Font_Size, 600) Else If $iDelay < 0 Then ; Only need [X] $hToast_Close_X = GUICtrlCreateLabel($sX_Char, $iToast_Width - 18, 0, 17, 17) GUICtrlSetFont(-1, 14, Default, Default, $sX_Font) GUICtrlSetBkColor(-1, -2) ; $GUI_BKCOLOR_TRANSPARENT GUICtrlSetColor(-1, $iToast_Message_Col) EndIf EndIf ; Create icon If $iIcon_Reduction Then Switch StringLower(StringRight($sImg, 3)) Case "bmp", "jpg", "gif" GUICtrlCreatePic($sImg, 10, 10 + $iTitle_Height, 32, 32) Case "png" _Toast_ShowPNG($sImg, $iTitle_Height) Case Else GUICtrlCreateIcon($sDLL, $iIcon_Style, 10, 10 + $iTitle_Height) EndSwitch EndIf ; Create Message label GUICtrlCreateLabel($sMessage, 10 + $iIcon_Reduction, 10 + $iTitle_Height, $iLabelwidth, $iLabelheight) GUICtrlSetStyle(-1, $iLabel_Style) If $iToast_Message_Col <> Default Then GUICtrlSetColor(-1, $iToast_Message_Col) ; Slide Toast Slice into view from behind systray and activate DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hToast_Handle, "int", 1000, "long", $aToast_Data[2]) ; Activate Toast without stealing focus GUISetState(@SW_SHOWNOACTIVATE, $hToast_Handle) ; If script is to pause If $fWait = True Then ; Clear message queue Do Until GUIGetMsg() = 0 ; Begin timeout counter Local $iTimeout_Begin = TimerInit() ; Wait for timeout or closure While 1 If GUIGetMsg() = $hToast_Close_X Or TimerDiff($iTimeout_Begin) / 1000 >= Abs($iDelay) Then ExitLoop WEnd ; If script is to continue and delay has been set ElseIf Abs($iDelay) > 0 Then ; Store timer info $iToast_Timer = Abs($iDelay * 1000) $iToast_Start = TimerInit() ; Register Adlib function to run timer AdlibRegister("_Toast_Timer_Check", 100) ; Register message handler to check for [X] click GUIRegisterMsg(0x0021, "_Toast_WM_EVENTS") ; $WM_MOUSEACTIVATE EndIf ; Reset original mode $nOldOpt = Opt('GUIOnEventMode', $nOldOpt) ; Create array to return Toast dimensions Local $aToast_Data[3] = [$iToast_Width, $iToast_Height, $iLine_Height] Return $aToast_Data EndFunc ;==>_Toast_Show ; #FUNCTION# ======================================================================================================== ; Name...........: _Toast_Hide ; Description ...: Hides a slice message from the systray ; Syntax.........: _Toast_Hide() ; Requirement(s).: v3.3.1.5 or higher - AdlibRegister used in _Toast_Show ; Return values .: Success: Returns 0 ; Failure: If Toast does not exist returns -1 and sets @error to 1 ; Author ........: Melba23 ; Example........; Yes ;===================================================================================================================== Func _Toast_Hide() ; If no Toast to hide, return If $hToast_Handle = 0 Then Return SetError(1, 0, -1) ; Slide Toast back behind systray DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hToast_Handle, "int", 500, "long", $iToast_Move) ; Delete Toast slice GUIDelete($hToast_Handle) ; Set flag for "no Toast" $hToast_Handle = 0 ; Unregister a possible message handler GUIRegisterMsg(0x0021, "") ; $WM_MOUSEACTIVATE ; Unregister a possible Adlib function AdlibUnRegister("_Toast_Timer_Check") ; Clear possible flag $fToast_Close = False EndFunc ;==>_Toast_Hide ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_Locate ; Description ...: Find Systray and determine Toast start position and movement direction ; Syntax ........: _Toast_Locate($iToast_Width, $iToast_Height) ; Parameters ....: $iToast_Width - required width of slice ; $iToast_Height - required height of slice ; Author ........: Melba23 - using some code from guinness and MilesAhead ; Modified.......: ; Remarks .......: This function is used internally by _Toast_Show ; =============================================================================================================================== Func _Toast_Locate($iToast_Width, $iToast_Height) ; Define return array Local $aToast_Data[3] ; Create struct ;Local $tWorkArea = DllStructCreate("struct;long Left;long Top;long Right;long Bottom;endstruct") If BitAND($iToast_Taskbar, 8) Then ; Docked toolbar $iToast_Taskbar -= 8 #cs ; Get monitor info Local $aMonitors = _WinAPI_EnumDisplayMonitors() $aData = _WinAPI_GetMonitorInfo($aMonitors[$iToast_Taskbar][0]) Local $aScreenSize = Local $aWorkArea[4] = [DllStructGetData($aData[1], 1), _ DllStructGetData($aData[1], 2), _ DllStructGetData($aData[1], 3), _ DllStructGetData($aData[1], 4)] ; Determine direction of Toast motion and starting position If $aWorkArea[3] <> @DesktopHeight Then $iToast_Move = 0x00050004 ; $AW_SLIDE_OUT_BOTTOM $aToast_Data[0] = @DesktopWidth - $iToast_Width - 10 $aToast_Data[1] = $aWorkArea[3] - $iToast_Height - 2 $aToast_Data[2] = 0x00040008 ; $AW_SLIDE_IN_BOTTOM ElseIf $aWorkArea[2] <> @DesktopWidth Then $iToast_Move = 0x00050001 ; $AW_SLIDE_OUT_RIGHT $aToast_Data[0] = $aWorkArea[2] - $iToast_Width - 2 $aToast_Data[1] = @DesktopHeight - $iToast_Height - 10 $aToast_Data[2] = 0x00040002 ; $AW_SLIDE_IN_RIGHT ElseIf $aWorkArea[1] <> 0 Then $iToast_Move = 0x00050008 ; $AW_SLIDE_OUT_TOP $aToast_Data[0] = @DesktopWidth - $iToast_Width - 10 $aToast_Data[1] = $aWorkArea[1] $aToast_Data[2] = 0x00040004 ; $AW_SLIDE_IN_TOP ElseIf $aWorkArea[0] <> 0 Then $iToast_Move = 0x00050002 ; $AW_SLIDE_OUT_LEFT $aToast_Data[0] = $aWorkArea[0] $aToast_Data[1] = @DesktopHeight - $iToast_Height - 10 $aToast_Data[2] = 0x00040001 ; $AW_SLIDE_IN_LEFT EndIf #ce Else ; Find taskbar Local $iPrevMode = Opt("WinTitleMatchMode", 4) Local $aTray_Pos = WinGetPos("[CLASS:Shell_TrayWnd]") Opt("WinTitleMatchMode", $iPrevMode) ; If error in finding systray If Not IsArray($aTray_Pos) Then Return SetError(2, 0, -1) ConsoleWrite("Taskbar: " & $aTray_Pos[0] & " - " & $aTray_Pos[1] & " - " & $aTray_Pos[2] & " - " & $aTray_Pos[3] & @CRLF) ; Get virtual desktop size Local $aRet = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) ; $SM_VIRTUALWIDTH Local $iVirtualDesktopWidth = $aRet[0] $aRet = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) ; $SM_VIRTUALHEIGHT Local $iVirtualDesktopHeight = $aRet[0] ConsoleWrite("Virtual Destop: " & $iVirtualDesktopWidth & " - " & $iVirtualDesktopHeight & @CRLF) ; Default values for single monitor Local $iLeft = 0, $iRight = @DesktopWidth, $iTop = 0, $iBottom = @DesktopHeight Switch $iToast_Taskbar Case 1 ; Secondary monitor to right $iLeft = @DesktopWidth $iRight = $iVirtualDesktopWidth Case 2 ; Secondary monitor below $iTop = @DesktopHeight $iBottom = $iVirtualDesktopHeight Case 3 ; Secondary monitor to left $iLeft = @DesktopWidth - $iVirtualDesktopWidth $iRight = 0 ConsoleWrite("L/R: " & $iLeft & " - " & $iRight & @CRLF) Case 4 ; Secondary monitor above $iTop = @DesktopHeight - $iVirtualDesktopHeight $iBottom = 0 EndSwitch ; Determine direction of Toast motion and starting position If $aTray_Pos[1] > $iTop Then $iToast_Move = 0x00050004 ; $AW_SLIDE_OUT_BOTTOM $aToast_Data[0] = $iRight - $iToast_Width - 10 $aToast_Data[1] = $aTray_Pos[1] - $iToast_Height - 2 $aToast_Data[2] = 0x00040008 ; $AW_SLIDE_IN_BOTTOM ElseIf $aTray_Pos[0] > $iLeft Then $iToast_Move = 0x00050001 ; $AW_SLIDE_OUT_RIGHT $aToast_Data[0] = $aTray_Pos[0] - $iToast_Width - 2 $aToast_Data[1] = $iBottom - $iToast_Height - 10 $aToast_Data[2] = 0x00040002 ; $AW_SLIDE_IN_RIGHT ElseIf $aTray_Pos[2] > $iRight - 70 Then $iToast_Move = 0x00050008 ; $AW_SLIDE_OUT_TOP $aToast_Data[0] = $iRight - $iToast_Width - 10 $aToast_Data[1] = $aTray_Pos[1] + $aTray_Pos[3] $aToast_Data[2] = 0x00040004 ; $AW_SLIDE_IN_TOP ElseIf $aTray_Pos[3] >= $iBottom Then $iToast_Move = 0x00050002 ; $AW_SLIDE_OUT_LEFT $aToast_Data[0] = $aTray_Pos[0] + $aTray_Pos[2] $aToast_Data[1] = $iBottom - $iToast_Height - 10 $aToast_Data[2] = 0x00040001 ; $AW_SLIDE_IN_LEFT EndIf ConsoleWrite("Toast: " & $aToast_Data[0] & " - " & $aToast_Data[1] & " - " & $iToast_Width & " - " & $iToast_Height & @CRLF) EndIf Return $aToast_Data EndFunc ;==>_Toast_Locate ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_Timer_Check ; Description ...: Checks whether Toast has timed out or closure [X] clicked ; Syntax ........: _Toast_Timer_Check() ; Author ........: Melba23 ; Modified.......: ; Remarks .......: This function is used internally by _Toast_Show if the Wait parameter is set to False ; =============================================================================================================================== Func _Toast_Timer_Check() ; Return if timeout not elapsed and [X] not clicked If TimerDiff($iToast_Start) < $iToast_Timer And $fToast_Close = False Then Return ; Retract slice _Toast_Hide() EndFunc ;==>_Toast_Timer_Check ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_WM_EVENTS ; Description ...: Message handler to check if closure [X] clicked ; Author ........: Melba23 ; Modified.......: ; Remarks .......: This function is used internally by _Toast_Show if the Wait parameter is set to False ; =============================================================================================================================== Func _Toast_WM_EVENTS($hWnd, $Msg, $wParam, $lParam) #forceref $wParam, $lParam If $hWnd = $hToast_Handle Then If $Msg = 0x0021 Then ; $WM_MOUSEACTIVATE ; Check mouse position Local $aPos = GUIGetCursorInfo($hToast_Handle) If $aPos[4] = $hToast_Close_X Then $fToast_Close = True EndIf EndIf Return 'GUI_RUNDEFMSG' EndFunc ;==>_Toast_WM_EVENTS ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_GetDefFont ; Description ...: Determine system default MsgBox font and size ; Syntax ........: _Toast_GetDefFont($iData) ; Parameters ....: $iData - 0 = Font point size, 1 = Font name ; Author ........: Melba23 ; Modified.......: ; Remarks .......: This function is used internally by _Toast functions ; =============================================================================================================================== Func _Toast_GetDefFont($iData) ; Get default system font data Local $tNONCLIENTMETRICS = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]") DllStructSetData($tNONCLIENTMETRICS, 1, DllStructGetSize($tNONCLIENTMETRICS)) DllCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($tNONCLIENTMETRICS), "ptr", DllStructGetPtr($tNONCLIENTMETRICS), "int", 0) ; Read font data for MsgBox font Local $tLOGFONT = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($tNONCLIENTMETRICS, 15)) Switch $iData Case 0 ; Font size as integer Return Int((Abs(DllStructGetData($tLOGFONT, 1)) + 1) * .75) Case 1 ; Font name Return DllStructGetData($tLOGFONT, 14) EndSwitch EndFunc ;==>_Toast_GetDefFont ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_ShowPNG ; Description ...: Set PNG as image ; Syntax ........: _Toast_ShowPNG($sImg) ; Parameters ....: $sImg - Path of image file ; Author ........: UEZ ; Modified.......: Melba23 ; Remarks .......: ; =============================================================================================================================== Func _Toast_ShowPNG($sImg, $iTitle_Height) _GDIPlus_Startup() Local $hPic = GUICtrlCreatePic("", 10, 10 + $iTitle_Height, 32, 32) Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sImg) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", 32, "int", 32, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap_Resized = $aResult[6] Local $hBMP_Ctxt = _GDIPlus_ImageGetGraphicsContext($hBitmap_Resized) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hBMP_Ctxt, "int", 7) _GDIPlus_GraphicsDrawImageRect($hBMP_Ctxt, $hBitmap, 0, 0, 32, 32) Local $hHBitmap = _Toast_BitmapCreateDIB($hBitmap_Resized) _WinAPI_DeleteObject(GUICtrlSendMsg($hPic, 0x0172, 0, $hHBitmap)) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hBitmap_Resized) _GDIPlus_GraphicsDispose($hBMP_Ctxt) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_Shutdown() EndFunc ;==>_Toast_ShowPNG ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: _Toast_BitmapCreateDIB ; Description ...: Create bitmap ; Syntax ........: _Toast_BitmapCreateDIB($hBitmap) ; Parameters ....: $hBitmap - Handle of bitmap ; Author ........: UEZ ; Modified.......: ; Remarks .......: ; =============================================================================================================================== Func _Toast_BitmapCreateDIB($hBitmap) Local $hRet = 0 Local $aRet1 = DllCall($ghGDIPDll, "uint", "GdipGetImageDimension", "ptr", $hBitmap, "float*", 0, "float*", 0) If (@error) Or ($aRet1[0]) Then Return 0 Local $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet1[2], $aRet1[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local $pBits = DllStructGetData($tData, "Scan0") If Not $pBits Then Return 0 Local $tBIHDR = DllStructCreate("dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword") DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 2, $aRet1[2]) DllStructSetData($tBIHDR, 3, $aRet1[3]) DllStructSetData($tBIHDR, 4, 1) DllStructSetData($tBIHDR, 5, 32) DllStructSetData($tBIHDR, 6, 0) Local $aRet2 = DllCall("gdi32.dll", "ptr", "CreateDIBSection", "hwnd", 0, "ptr", DllStructGetPtr($tBIHDR), "uint", 0, "ptr*", 0, "ptr", 0, "dword", 0) If (Not @error) And ($aRet2[0]) Then DllCall("gdi32.dll", "dword", "SetBitmapBits", "ptr", $aRet2[0], "dword", $aRet1[2] * $aRet1[3] * 4, "ptr", DllStructGetData($tData, "Scan0")) $hRet = $aRet2[0] EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hRet EndFunc ;==>_Toast_BitmapCreateDIBPlease let me have the console data as usual. I am keeping my fingers firmly crossed! M23 MONaH-Rasta 1 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
nitekram Posted March 26, 2014 Posted March 26, 2014 (edited) Ok, something strange is going on. Your first parameter seems to be doing something unexpected. When I use the word Default, it puts the toast on the bottom right of the primary monitor. When I use the number 1 (which from your UDF is also the default for centred justified), then it puts it in the the secondary monitor, where is should be, bottom right next to where the time is located. So, I think you are very close, just not sure why the 1 or default keyword would make the difference? EDIT Also thanks so much for your time on this Edited March 26, 2014 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
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