PleasantNotify() - Beautiful popup msg, tooltip

Post your working scripts, libraries and tools for AHK v1.1 and older
ivanpronet

Re: PleasantNotify() - Beautiful popup msg, tooltip

09 Jan 2017, 22:48

This is great! But how do I exit the app after it's faden out? I tried putting "ExitApp" all around, but it won't work properly. Any ideas?
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: PleasantNotify() - Beautiful popup msg, tooltip

10 Jan 2017, 20:20

Show us your usage. version number, system version, etc
Some code?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
mjh

Re: PleasantNotify() - Beautiful popup msg, tooltip

03 Mar 2017, 06:36

Hi

I am trying to use the original code (with the OK button added). Basically I would like the gui to be displayed, with either an ok button or close button, which when pressed would destroy the gui
timoshina
Posts: 67
Joined: 06 Jun 2017, 12:45

Re: PleasantNotify() - Beautiful popup msg, tooltip

10 Jun 2017, 03:39

Hello! Thanks for such an awesome script! I have just one question. I have a sequence/series of mouse clicks and if I use PleasantNotify() (to shows what's currently selected), mouse actions have slight delay between them and can't be switched instantaneously. I believe it's because of a fade-in effect, I tried to play with different numbers, even set it to highest but still can't get it to work fast. Is there a way around or can fade-in effect be turned off?

here is the script

Code: Select all

^=::
SnapGrid++
MouseGetPos CurX, CurY

if(SnapGrid>=6)
{
SnapGrid:=1
}
if (SnapGrid=1)               ;beat
{
PleasantNotify("   OHH, SNAP!", "     beat" , 200, 120, "b hc", "0.7")
click, 960, 100
click, 960, 400
MouseMove %CurX%, %CurY%, 0
}

else if(SnapGrid=2)          ;1/2 beat
{
PleasantNotify("   OHH, SNAP!", "  1/2 beat" , 200, 120, "b hc", "0.7")
click, 960, 100
Click, 960, 377
MouseMove %CurX%, %CurY%, 0
}
else if(SnapGrid=3)          ;1/4 beat
{
PleasantNotify("   OHH, SNAP!", "  1/4 beat" , 200, 120, "b hc", "0.7")
click, 960, 100
Click, 960, 333
MouseMove %CurX%, %CurY%, 0
}
else if (SnapGrid=4)         ;1/2 step
{
PleasantNotify("   OHH, SNAP!", "  1/2 step" , 200, 120, "b hc", "0.7")
click, 960, 100
Click, 960, 268
MouseMove %CurX%, %CurY%, 0
}
else if(SnapGrid=5)           ;1/4 step
{
PleasantNotify("   OHH, SNAP!", "  1/4 step" , 200, 120, "b hc", "0.7")
Click, 960, 100
Click, 960, 225
MouseMove %CurX%, %CurY%, 0
}	
return




PleasantNotify(title, message, pnW=700, pnH=300, position="b r", time=10) {
    global pn_title, pn_msg, PN_hwnd, w, h
	Notify_Destroy()
	Gui, Notify: +AlwaysOnTop +ToolWindow -SysMenu -Caption +LastFound
	PN_hwnd := WinExist()
	WinSet, ExStyle, +0x200  ; change to +0x20 if don't like white lines 
	WinSet, Transparent, 0
	Gui, Notify: Color, 0x596066    										 ;window color 
	Gui, Notify: Font, c0xBlack s17 wLight, Segoe UI Light                                    ;title color/size/font type
	Gui, Notify: Add, Text, % " x" 20 " y" 12 " w" pnW-20 " vpn_title", % title
	Gui, Notify: Font, c0xefcb7a s25 wBold, Segoe UI                                           ;message color/size/font type
	Gui, Notify: Add, Text, % " x" 20 " y" 56 " w" pnW-20 " h" pnH-56 " vpn_msg", % message
	RealW := pnW + 50                                                                          ;notification position X
	RealH := pnH + 250                                                                         ;notification position Y
	Gui, Notify: Show, W%RealW% H%RealH% NoActivate
	WinMove(PN_hwnd, position)
	if A_ScreenDPI = 96
		WinSet, Region,0-0 w%pnW% h%pnH% R40-40,%A_ScriptName%
	/* For Screen text size 125%
	if A_ScreenDPI = 120
		WinSet, Region, 0-0 w800 h230 R40-40, %A_ScriptName%
	*/
	
	winfade("ahk_id " PN_hwnd, 210, 10000000)                    ; window transperency level 0-211","FADE-IN time 50+" 
	if (time <> "P")
	{
		Closetick := time*1000                                    ;time window is on 0-1000 or maybe more
		SetTimer, ByeNotify, % Closetick
	}
}

 Notify_Destroy() {
	global PN_hwnd
	ByeNotify:
	SetTimer, ByeNotify, Off
    winfade("ahk_id " PN_hwnd,0,40)                           ; fade-out effect 								
    Gui, Notify: Destroy
	return
}

pn_mod_title(title) {
	global pn_title
	GuiControl, Notify: Text,pn_title, % title
}

pn_mod_msg(message) {
	global pn_msg
	GuiControl, Notify: Text,pn_msg, % message
}

WinMove(hwnd,position) {
   SysGet, Mon, MonitorWorkArea
   WinGetPos,ix,iy,w,h, ahk_id %hwnd%
   x := InStr(position,"l") ? MonLeft : InStr(position,"hc") ?  (MonRight-w)/2 : InStr(position,"r") ? MonRight - w : ix
   y := InStr(position,"t") ? MonTop : InStr(position,"vc") ?  (MonBottom-h)/2 : InStr(position,"b") ? MonBottom - h : iy
   WinMove, ahk_id %hwnd%,,x,y
}

winfade(w:="",t:=128,i:=1,d:=10) {
    w:=(w="")?("ahk_id " WinActive("A")):w
    t:=(t>255)?255:(t<0)?0:t     ;(t>255)?255:(t<0)?0:t
    WinGet,s,Transparent,%w%
    s:=(s="")?255:s ;prevent trans unset bug 255
    WinSet,Transparent,%s%,%w%
    i:=(s<t)?abs(i):-1*abs(i)
    while(k:=(i<0)?(s>t):(s<t)&&WinExist(w)) {
        WinGet,s,Transparent,%w%
        s+=i
        WinSet,Transparent,%s%,%w%
        sleep %d%
    }
}
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: PleasantNotify() - Beautiful popup msg, tooltip

12 Jun 2017, 01:11

Well, you could modify Winfade()
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Johnny 270964
Posts: 5
Joined: 22 Jan 2017, 09:41

Re: PleasantNotify() - Beautiful popup msg, tooltip

05 Feb 2018, 11:22

I,m new to AHK, Can message box display a variable if so where do I place it , thanks

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: KruschenZ and 59 guests