Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Notify() Builder


  • Please log in to reply
7 replies to this topic
JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
This is a designer tool for the Notify() lib written by gwarble

UPDATE: Added predefined styles dropdown under logic tab 6/21/2012 9:45:00 PM

What it does:
This tool is intended to make building Notify() function calls easier by way of a GUI with all the relevant options.
Some standard modifying calls are part of the GUI as well under the 'Logic' tab

What is it for:
This is intended to expose the full functionality of the Notify() lib in an easy to use front end.
It is hoped that this could speed up scripting by reducing the amount of time it takes to write these calls by hand.

Features:
Save and load functionality, files are saved as .ntfy files (based on RFN function)
Visual representation of colors and fonts
Windows based pick font and color dialog
Live testing of a notify string
Basic logic strings for progress and kill functions

Screenshots:
Posted ImagePosted ImagePosted Image
Posted ImagePosted ImagePosted ImagePosted Image

Code:
;Notify builder part dux

GUI_LIST=STYLE|GC|GR|GT|TS|TW|TC|TF|MS|MW|MC|MF|BC|BW|BR|BT|BF|BK|SI|SC|ST|IN|IMAGE|IW|IH|PG|PC|PB|PW|PH|XF|XC|XS|XW|AC|AT|AX|GF|GL
GUI_LIST_FULL=GC|GR|GT|TS|TW|TC|TF|MS|MW|MC|MF|BC|BW|BR|BT|BF|BK|SI|SC|ST|IN|IMAGE|IW|IH|PG|PC|PB|PW|PH|XF|XC|XS|XW|AC|AT|AX|GF|GL|TITLE|MESSAGE|TIMEOUT|P_ID|STYLE
STYLES=Default|Save|Load|ToolTip|BalloonTip|Error|Warning|Info|Question|Progress|Huge
OnExit, MAIN_EXIT

Gui, Add, Text, x12 y300 w230 h20 , Current Output
Gui, Add, Edit, x12 y320 w690 h150 vOUTPUT, Notify()
Gui, Add, Button, x12 y470 w100 h30 gSAVE, Save
Gui, Add, Button, x112 y470 w100 h30 gTEST Default, Test
Gui, Add, Button, x212 y470 w100 h30 gCOPY, Copy
Gui, Add, Button, x312 y470 w100 h30 gLOAD, Load
Gui, Add, Button, x602 y470 w100 h30 gCLEAR, Clear

Gui, Add, Tab2, x2 y0 w710 h30 , Basic|Progress|Logic
Gui, Add, Text, x12 y40 w690 h20 , Title
Gui, Add, Edit, x12 y60 w690 h40 gUPDATE_GUI vTitle, Title

Gui, Add, Text, x12 y110 w690 h20 , Message
Gui, Add, Edit, x12 y130 w690 h60 gUPDATE_GUI vMessage, 

Gui, Add, Text, x12 y200 w110 h20 , Timeout
Gui, Add, Edit, x12 y220 w110 h20 gUPDATE_GUI vTimeout,

Gui, Add, Text, x132 y200 w110 h20 , Roundness
Gui, Add, Edit, x132 y220 w110 h20 gUPDATE_GUI vGR, 

Gui, Add, Text, x252 y200 w110 h20 , Transparancy
Gui, Add, Edit, x252 y220 w110 h20 gUPDATE_GUI vGT, 

Gui, Add, Text, x12 y250 w110 h20 , Speed In
Gui, Add, Edit, x12 y270 w110 h20 gUPDATE_GUI vSI, 

Gui, Add, Text, x132 y250 w110 h20 , Speed Clicked
Gui, Add, Edit, x132 y270 w110 h20 gUPDATE_GUI vSC, 

Gui, Add, Text, x252 y250 w110 h20 , Speed Timeout
Gui, Add, Edit, x252 y270 w110 h20 gUPDATE_GUI vST, 

Gui, Add, Button, x372 y200 w110 h40 gBG_STYLE, Background Styles
Gui, Add, Button, x492 y200 w110 h40 gTITLE_STYLE, Title Styles
Gui, Add, Button, x492 y250 w110 h40 gMESSAGE_STYLE, Message Styles
Gui, Add, Button, x372 y250 w110 h40 gIMAGE_STYLE, Icon Styles

Gui, Add, ListView, x612 y200 w90 h90 ReadOnly 0x4000 +Background999999 vGC_DISPLAY
Gui, Add, Picture, x618 y208 w76 h76 Icon50 vIMAGE_DISPLAY, %A_WinDir%\system32\shell32.dll

Gui, Tab, Progress
Gui, Add, Text, x12 y40 w130 h20 , Bar Color
Gui, Add, ListView, x142 y40 h20 w20 ReadOnly 0x4000 +Background000000 vPC_DISPLAY
Gui, Add, Edit, x12 y60 w130 h20 vPC gUPDATE_GUI,
Gui, Add, Button, x142 y60 w20 h20 gGET_BAR_COLOR, +

Gui, Add, Text, x172 y40 w130 h20 , Bar Background Color
Gui, Add, Edit, x172 y60 w130 h20 vPB gUPDATE_GUI, 
Gui, Add, ListView, x302 y40 h20 w20 ReadOnly 0x4000 +Background000000 vPB_DISPLAY
Gui, Add, Button, x302 y60 w20 h20 gGET_BAR_BG_COLOR, +

Gui, Add, Text, x12 y90 w150 h20 , Bar Width
Gui, Add, Edit, x12 y110 w150 h20 gUPDATE_GUI vPW, 

Gui, Add, Text, x172 y90 w150 h20 , Bar Height
Gui, Add, Edit, x172 y110 w150 h20 gUPDATE_GUI vPH, 

Gui, Add, Text, x12 y140 w150 h20 , Bar Max Value
Gui, Add, Edit, x12 y160 w150 h20 gUPDATE_GUI vPG, 

Gui, Add, Text, x172 y140 w150 h20 , ID Name
Gui, Add, Edit, x172 y160 w150 h20 gUPDATE_GUI_P vP_ID, 

Gui, Tab, Logic
Gui, Add, CheckBox, x12 y40 w150 h20 gUPDATE_GUI vKILLER, Add Killer
Gui, Add, CheckBox, x12 y70 w150 h20 gUPDATE_GUI vPROG_LOOP, Progress Loop
;~ Gui, Add, CheckBox, x12 y100 w150 h20 , Update Title
;~ Gui, Add, CheckBox, x12 y130 w150 h20 , Update Message
Gui, Add, CheckBox, x12 y160 w150 h20 gUPDATE_GUI vAX, X Button

Gui, Add, Text, x172 y40 w180 h20 , Label Jump For Clicked Event
Gui, Add, Edit, x172 y60 w180 h20 gUPDATE_GUI vAC, 

Gui, Add, Text, x172 y90 w180 h20 , Label Jump For Timeout Event
Gui, Add, Edit, x172 y110 w180 h20 gUPDATE_GUI vAT, 

Gui, Add, Text, x172 y140 w180 h20 , Predefined Style
Gui, Add, ComboBox, x172 y160 w180 h200 gUPDATE_GUI vSTYLE, %STYLES%

Gui, Add, Text, x12 y180 w40 h20 , Size
Gui, Add, Edit, x52 y180 w110 h20 gUPDATE_GUI vXS, 
Gui, Add, Text, x12 y200 w40 h20 , Weight
Gui, Add, Edit, x52 y200 w110 h20 gUPDATE_GUI vXW, 

Gui, Add, Text, x12 y220 w40 h20 , Color
Gui, Add, Edit, x52 y220 w70 h20 vXC gUPDATE_GUI, 
Gui, Add, ListView, x122 y220 h20 w20 ReadOnly 0x4000 +Background000000 vXC_DISPLAY
Gui, Add, Button, x142 y220 w20 h20 gGET_X_COLOR, +

Gui, Add, Text, x12 y240 w40 h20 , Font
Gui, Add, Edit, x52 y240 w90 h20 gUPDATE_GUI vXF,
Gui, Add, Button, x142 y240 w20 h20 gGET_X_FONT, +

Gui, Add, Text, x362 y40 w70 h20 , First GUI
Gui, Add, Edit, x362 y60 w70 h20 gUPDATE_GUI vGF, 

Gui, Add, Text, x362 y90 w70 h20 , Last GUI
Gui, Add, Edit, x362 y110 w70 h20 gUPDATE_GUI vGL,

Gui, Add, Text, x442 y40 w260 h20 , New Title
Gui, Add, Edit, x442 y60 w260 h60 gUPDATE_GUI vNEW_TITLE, 

Gui, Add, Text, x442 y130 w260 h20 , New Message
Gui, Add, Edit, x442 y150 w260 h110 gUPDATE_GUI vNEW_MESSAGE, 

Gui, Add, Text, x172 y220 w180 h20 , ID Name
Gui, Add, Edit, x172 y240 w180 h20 gUPDATE_GUI_X vX_ID,

Gui, Show, w716 h508, Notify Builder Dux

; load last ntfy back in (in case of crash or w/e)
READ_FROM_NTFY("LAST_NTFY.ntfy")
   Loop, parse, STYLES, |
      %A_loopfield%:=A_Index
   
   Guicontrol,1:,Style,|%Styles%
   if(STYLE)
   This:=%Style%
   Guicontrol,1:Choose,Style,%THIS%

Loop, parse, GUI_LIST_FULL, |
   {
   This:=%A_LoopField%
   Guicontrol,,%A_LoopField%,%This%
   }
Guicontrol,1:,Style,|%Styles%
Guicontrol,1:Choose,Style,%THIS%
   gosub UPDATE_GUI   
return

BG_STYLE:
Gui, 2:destroy
Gui, 2:Add, Text, x5 y7 w180 h20 , Background Color
Gui, 2:Add, Edit, x5 y27 w160 h20 gUPDATE_GUI vGC, %GC%
Gui, 2:Add, Button, x166 y27 w20 h20 gGET_GC_COLOR, +
Gui, 2:Add, ListView, x186 y7 w40 h40 ReadOnly 0x4000 +Background000000 vGC_DISPLAY_1

Gui, 2:Add, Text, x5 y57 w180 h20 , Border Color
Gui, 2:Add, Edit, x5 y77 w160 h20 gUPDATE_GUI vBC, %BC%
Gui, 2:Add, Button, x166 y77 w20 h20 gGET_BC_COLOR, +
Gui, 2:Add, ListView, x186 y57 w40 h40 ReadOnly 0x4000 +Background000000 vBC_DISPLAY_1

Gui, 2:Add, Text, x5 y107 w180 h20 , Border Flash Color
Gui, 2:Add, Edit, x5 y127 w160 h20 gUPDATE_GUI vBK, %BK%
Gui, 2:Add, Button, x166 y127 w20 h20 gGET_BK_COLOR, +
Gui, 2:Add, ListView, x186 y107 w40 h40 ReadOnly 0x4000 +Background000000 vBK_DISPLAY_1

Gui, 2:Add, Text, x246 y7 w100 h20 , Colors preview
Gui, 2:Add, ListView, x246 y27 w100 h95 ReadOnly 0x4000 +Background000000 vBC_DISPLAY_2
Gui, 2:Add, ListView, x346 y27 w100 h95 ReadOnly 0x4000 +Background000000 vBK_DISPLAY_2
Gui, 2:Add, ListView, x256 y37 w180 h75 ReadOnly 0x4000 +Background000000 vGC_DISPLAY_2

Gui, 2:Add, Text, x5 y157 w110 h20 , Border Roundness
Gui, 2:Add, Edit, x5 y177 w110 h20 gUPDATE_GUI vBR, %BR%
Gui, 2:Add, Text, x115 y157 w110 h20 , Border Thickness
Gui, 2:Add, Edit, x115 y177 w110 h20 gUPDATE_GUI vBW, %BW%
Gui, 2:Add, Text, x225 y157 w110 h20 , Border Flash Rate
Gui, 2:Add, Edit, x225 y177 w110 h20 gUPDATE_GUI vBF, %BF%
Gui, 2:Add, Text, x335 y157 w110 h20 , Border Trans
Gui, 2:Add, Edit, x335 y177 w110 h20 gUPDATE_GUI vBT, %BT%

Gui, 2:Add, Button, x6 y207 w100 h30 g2GuiClose, OK
Gui, 2:Add, Button, x116 y207 w100 h30 gTEST Default, Test
;~ Gui, 2:Add, Button, x336 y207 w100 h30 g2GuiClose, Cancel
; Generated using SmartGUI Creator for SciTE
Gui, 2:Show, w449 h248, Background Styles
return

IMAGE_STYLE:
Gui, 3:destroy
Gui, 3:Add, Picture, x6 y7 w60 h60 Icon50 vIMAGE_DISPLAY_2, %A_WinDir%\system32\shell32.dll
Gui, 3:Add, ComboBox, x66 y27 w400 h340 gUPDATE_GUI vIMAGE, %A_WinDir%\system32\shell32.dll|%A_WinDir%\system32\moricons.dll
Gui, 3:Add, Text, x66 y7 w370 h20 , Image path or resource
Gui, 3:Add, Button, x436 y7 w30 h20 gOPEN_IMAGE, ...
Gui, 3:Add, Text, x6 y67 w60 h20 , Icon#
Gui, 3:Add, Edit, x6 y87 w60 h20 gUPDATE_GUI vIN, %IN%
Gui, 3:Add, Button, x76 y77 w180 h30 gTEST Default, Test
Gui, 3:Add, Button, x266 y77 w180 h30 g3GuiClose, OK
Gui, 3:Add, Text, x66 y47 w80 h20 , Image Height
Gui, 3:Add, Text, x256 y47 w80 h20 , Image Width
Gui, 3:Add, Edit, x146 y47 w110 h20 gUPDATE_GUI vIH, %IW%
Gui, 3:Add, Edit, x336 y47 w110 h20 gUPDATE_GUI vIW, %IH%
; Generated using SmartGUI Creator for SciTE
Gui, 3:Show, w477 h115, Image Styles
return

TITLE_STYLE:
Gui, 4:destroy
Gui, 4:color, %GC%
Gui, 4:Add, Text, x6 y7 w470 h90 vTITLE_DISPLAY, The quick brown fox jumped over the event horizon!

Gui, 4:Add, Text, x6 y107 w230 h20 , Font
Gui, 4:Add, Edit, x6 y127 w210 h20 gUPDATE_GUI vTF, %TF%
Gui, 4:Add, Button, x216 y127 w20 h20 gGET_TITLE_FONT, +

Gui, 4:Add, Text, x246 y107 w230 h20 , Text Size
Gui, 4:Add, Edit, x246 y127 w230 h20 gUPDATE_GUI vTS, %TS%

Gui, 4:Add, Text, x6 y157 w210 h20 , Text Color
Gui, 4:Add, Edit, x6 y177 w210 h20 gUPDATE_GUI vTC, %TC%
Gui, 4:Add, Button, x216 y177 w20 h20 gGET_TC_COLOR, +
Gui, 4:Add, ListView, x216 y157 w20 h20 ReadOnly 0x4000 +Background000000 vTC_DISPLAY_1

Gui, 4:Add, Text, x246 y157 w230 h20 , Text Weight
Gui, 4:Add, Edit, x246 y177 w230 h20 gUPDATE_GUI vTW, %TW%

Gui, 4:Add, Button, x6 y207 w230 h30 gTEST Default, Test
Gui, 4:Add, Button, x246 y207 w230 h30 g4GuiClose, OK
; Generated using SmartGUI Creator for SciTE
Gui, 4:Show, w485 h249, Title Style
return

MESSAGE_STYLE:
Gui, 5:destroy
Gui, 5:color, %GC%
Gui, 5:Add, Text, x6 y7 w470 h90 vMESSAGE_DISPLAY , The quick brown fox jumped over the event horizon!

Gui, 5:Add, Text, x6 y107 w230 h20 , Font
Gui, 5:Add, Edit, x6 y127 w210 h20 gUPDATE_GUI vMF, %MF%
Gui, 5:Add, Button, x216 y127 w20 h20 gGET_MESSAGE_FONT, +

Gui, 5:Add, Text, x246 y107 w230 h20 , Text Size
Gui, 5:Add, Edit, x246 y127 w230 h20 gUPDATE_GUI vMS, %MS%

Gui, 5:Add, Text, x6 y157 w210 h20 , Text Color
Gui, 5:Add, Edit, x6 y177 w210 h20 gUPDATE_GUI vMC, %MC%
Gui, 5:Add, Button, x216 y177 w20 h20 gGET_MC_COLOR, +
Gui, 5:Add, ListView, x216 y157 w20 h20 ReadOnly 0x4000 +Background000000 vMC_DISPLAY_1

Gui, 5:Add, Text, x246 y157 w230 h20 , Text Weight
Gui, 5:Add, Edit, x246 y177 w230 h20 gUPDATE_GUI vMW, %MW%

Gui, 5:Add, Button, x6 y207 w230 h30 gTEST Default, Test
Gui, 5:Add, Button, x246 y207 w230 h30 g5GuiClose, OK
; Generated using SmartGUI Creator for SciTE
Gui, 5:Show, w485 h249, Message Style
return

CLEAR:
NOTHING=
Loop, parse, GUI_LIST_FULL, |
   {
      %A_LoopField%:=NOTHING
   Guicontrol,1:,%A_LoopField%,%NOTHING%
   Guicontrol,2:,%A_LoopField%,%NOTHING%
   Guicontrol,3:,%A_LoopField%,%NOTHING%
   Guicontrol,4:,%A_LoopField%,%NOTHING%
   Guicontrol,5:,%A_LoopField%,%NOTHING%
   }

   GuiControl,,AX,X Button
   GuiControl,,AX,0
   Guicontrol,1:,Style,|%Styles%
         Sleep 100
   Guicontrol,,TIMEOUT,%TIMEOUT%
return

5GuiClose:
Gui, 5:destroy
return

4GuiClose:
Gui, 4:destroy
return

3GuiClose:
Gui, 3:destroy
return

2GuiClose:
Gui, 2:destroy
return

GuiClose:
MAIN_EXIT:
   IfExist, LAST_NTFY.ntfy
      FileDelete, LAST_NTFY.ntfy
OUTPUT_TO_NTFY(GUI_LIST_FULL, "LAST_NTFY.ntfy")
ExitApp
return

SAVE:
FILE=
FileSelectFile,FILE,S,%A_SCRIPTDIR%,Save this Notify() to file,Notify save files (*.ntfy)
if(FILE)
{
   FILE.=".ntfy"
   StringReplace,FILE,FILE,.ntfy.ntfy,.ntfy,ALL
   IfExist, %FILE%
      FileDelete, %FILE%
OUTPUT_TO_NTFY(GUI_LIST_FULL, FILE)
}
return

LOAD:
FILE=
FileSelectFile,FILE,S,%A_SCRIPTDIR%,Load a Notify() file,Notify save files (*.ntfy)
if(FILE)
{
   FILE.=".ntfy"
   StringReplace,FILE,FILE,.ntfy.ntfy,.ntfy,ALL
READ_FROM_NTFY(FILE)
   Loop, parse, STYLES, |
      %A_loopfield%:=A_Index
   
   Guicontrol,1:,Style,|%Styles%
   if(STYLE)
   This:=%Style%
   Guicontrol,1:Choose,Style,%THIS%

Loop, parse, GUI_LIST_FULL, |
   {
   This:=%A_LoopField%
   Guicontrol,1:,%A_LoopField%,%This%
   }
Guicontrol,1:,Style,|%Styles%
Guicontrol,1:Choose,Style,%THIS%
   Sleep 100
      gosub UPDATE_GUI
}
return

TEST:
TEST_TIMEOUT := Abs(Timeout) ; so you don't lose your progress ;)
StringReplace,Title,Title,`",,ALL
StringReplace,Message,Message,`",,ALL
StringReplace,TEST_TIMEOUT,TEST_TIMEOUT,`",,ALL
StringReplace,OPTIONS,OPTIONS,`",,ALL
TEST_TIMEOUT := Abs(Timeout) ; so you don't lose your progress ;)
Notify(Title, Message, TEST_TIMEOUT, OPTIONS)
return

OPEN_IMAGE:
OPEN_IMAGE=
FileSelectFile, OPEN_IMAGE, 3, , Select an image, Images (*.gif; *.png; *.jpg; *.bmp)
if(OPEN_IMAGE)
{
   GuiControl,,IMAGE,%OPEN_IMAGE%||
   Gosub UPDATE_GUI
}
return

UPDATE_GUI_P:
Gui, submit, nohide
If(X_ID<>P_ID)
GuiControl,,X_ID,%P_ID%
gosub UPDATE_GUI
return

UPDATE_GUI_X:
Gui, submit, nohide
If(X_ID<>P_ID)
GuiControl,,P_ID,%X_ID%
gosub UPDATE_GUI
return

UPDATE_GUI:
Gui, 5:submit, nohide
Gui, 4:submit, nohide
Gui, 3:submit, nohide
Gui, 2:submit, nohide
;~ Gui, 1:default
Gui, 1:submit, nohide

   Gui, 4:Font, s%TS% c%TC%, %TF%
   GuiControl,4:Font, TITLE_DISPLAY
   Gui, 4:Font
   GuiControl, 4:+Background%TC%, TC_DISPLAY_1
   
   Gui, 5:Font, s%MS% c%MC%, %MF%
   GuiControl,5:Font, MESSAGE_DISPLAY
   Gui, 5:Font
   GuiControl, 5:+Background%MC%, MC_DISPLAY_1
   
OPTIONS=
if(!AX)
   AX=
if(IN)
{
   GuiControl,1:, IMAGE_DISPLAY, *icon%IN% %IMAGE%
   GuiControl,3:, IMAGE_DISPLAY_2, *icon%IN% %IMAGE%
}
else
{
   GuiControl,1:, IMAGE_DISPLAY, %IMAGE%
   GuiControl,3:, IMAGE_DISPLAY_2, *icon%IN% %IMAGE%
}
Loop, parse, GUI_LIST, |
{
   This:=%A_LoopField%
   If strlen(This)
      OPTIONS .= A_LoopField . "=" . This . " "
}
StringTrimRight,OPTIONS,OPTIONS,1 ; kill the last space
If Title
   Title= "%Title%"
If Message
   Message= "%Message%"
If Timeout
   Timeout= %Timeout%
If OPTIONS
   OPTIONS= "%OPTIONS%"

GuiControl,1:,OUTPUT,Notify(%Title%, %Message%, %Timeout%, %OPTIONS%)

Gui, 1:submit, nohide
; Other MODs
If(P_ID)
   GuiControl,1:,OUTPUT,%P_ID% := %OUTPUT%
Gui, 1:submit, nohide
if(NEW_TITLE OR NEW_MESSAGE)
   GuiControl,1:,OUTPUT,%OUTPUT%`nNotify("%NEW_TITLE%","%NEW_MESSAGE%",,"UPDATE=" %P_ID%)
Gui, 1:submit, nohide
If(Prog_Loop)
   GuiControl,1:,OUTPUT,%OUTPUT%`nLoop %PG%`n{`np+=1`nNotify("","",p, "Update=" %P_ID%)`n}
Gui, 1:submit, nohide
If(KILLER)
   GuiControl,1:,OUTPUT,%OUTPUT%`nNotify(,,0.01,"WAIT=" %P_ID%)
Gui, 1:submit, nohide
return

Copy:
gui,1:submit,nohide
Clipboard:=OUTPUT
Notify("Notify(!)", "Notify string was copied to the clipboard!", "8", "IMAGE=2 IW=48 IH=48 GC=Green GR=20 SI=500 IN=108 IMAGE=C:\Windows\system32\moricons.dll ")
return

; Colors!
GET_BAR_COLOR:
Gui, 1:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,PC, % NEW_COLOR
GuiControl, +Background%NEW_COLOR%, PC_DISPLAY
return

GET_BAR_BG_COLOR:
Gui, 1:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,PB, % NEW_COLOR
GuiControl, +Background%NEW_COLOR%, PB_DISPLAY
return

GET_X_COLOR:
Gui, 1:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,XC, % NEW_COLOR
GuiControl, +Background%NEW_COLOR%, XC_DISPLAY
return

GET_GC_COLOR:
Gui, 2:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,GC, % NEW_COLOR
GuiControl, 1:+Background%NEW_COLOR%, GC_DISPLAY
GuiControl, 2:+Background%NEW_COLOR%, GC_DISPLAY_1
GuiControl, 2:+Background%NEW_COLOR%, GC_DISPLAY_2
return

GET_BC_COLOR:
Gui, 2:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,BC, % NEW_COLOR
GuiControl, 2:+Background%NEW_COLOR%, BC_DISPLAY_1
GuiControl, 2:+Background%NEW_COLOR%, BC_DISPLAY_2
GuiControl, 2:+Background%GC%, GC_DISPLAY_2
return

GET_BK_COLOR:
Gui, 2:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,BK, % NEW_COLOR
GuiControl, 2:+Background%NEW_COLOR%, BK_DISPLAY_1
GuiControl, 2:+Background%NEW_COLOR%, BK_DISPLAY_2
GuiControl, 2:+Background%GC%, GC_DISPLAY_2
return

GET_TC_COLOR:
Gui, 4:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,TC, % NEW_COLOR
GuiControl, 4:+Background%NEW_COLOR%, TC_DISPLAY_1
return

GET_MC_COLOR:
Gui, 5:submit, nohide
NEW_COLOR := ChooseColorH()
GuiControl,,MC, % NEW_COLOR
GuiControl, 5:+Background%NEW_COLOR%, MC_DISPLAY_1
return

GET_TITLE_FONT:
GET_Font(TF, TS, TC_PRE)
StringReplace,TC_PRE,TC_PRE,0x
if(TC_PRE)
   TC:=TC_PRE
GuiControl,4:,TF,%TF%
GuiControl,4:,TC,%TC%
GuiControl,4:,TS,%TS%
return

GET_MESSAGE_FONT:
GET_Font(MF, MS, MC_PRE)
StringReplace,MC_PRE,MC_PRE,0x
if(MC_PRE)
   MC:=MC_PRE
GuiControl,5:,MF,%MF%
GuiControl,5:,MC,%MC%
GuiControl,5:,MS,%MS%
return

GET_X_FONT:
GET_Font(XF, XS, XC_PRE)
StringReplace,XC_PRE,XC_PRE,0x
if(XC_PRE)
   XC:=XC_PRE
GuiControl,1:,XF,%XF%
GuiControl,1:,XC,%XC%
GuiControl,1:,XS,%XS%
return

/*
=========================THE FUNC=========================
*/

; THANKS SKAN!
ChooseColorH( Color=0x0, hWnd=0x0, Flags=0x2 )  { ; CC_FULLOPEN := 0x2
 VarSetCapacity(CC,36+64,0), NumPut(36,CC), NumPut(hWnd,CC,4), NumPut(Color,CC,12)
 NumPut(&CC+36,CC,16), NumPut(Flags,CC,20), DllCall( "comdlg32\ChooseColorA", Str,CC ) 
 Hex:="123456789ABCDEF0",   RGB:=&CC+11 
 Loop 3  
  HexColorCode .=  SubStr(Hex, (*++RGB >> 4), 1) . SubStr(Hex, (*RGB & 15), 1) 
Return HexColorCode  
}

GET_Font(ByRef Name, ByRef Style, ByRef Color, Effects=true, hGui=0) {

   LogPixels := DllCall("GetDeviceCaps", "uint", DllCall("GetDC", "uint", hGui), "uint", 90)   ;LOGPIXELSY
   VarSetCapacity(LOGFONT, 128, 0)

   Effects := 0x041 + (Effects ? 0x100 : 0)  ;CF_EFFECTS = 0x100, CF_SCREENFONTS=1, CF_INITTOLOGFONTSTRUCT = 0x40

   ;set initial name
   DllCall("RtlMoveMemory", "uint", &LOGFONT+28, "Uint", &Name, "Uint", 64)

   ;convert from rgb
   clr := ((Color & 0xFF) << 16) + (Color & 0xFF00) + ((Color >> 16) & 0xFF)

   ;set intial data
   if InStr(Style, "bold")
      NumPut(700, LOGFONT, 16)

   if InStr(Style, "italic")
      NumPut(255, LOGFONT, 20, 1)

   if InStr(Style, "underline")
      NumPut(1, LOGFONT, 21, 1)

   if InStr(Style, "strikeout")
      NumPut(1, LOGFONT, 22, 1)

   if RegExMatch(Style, "s[1-9][0-9]*", s){
      StringTrimLeft, s, s, 1
      s := -DllCall("MulDiv", "int", s, "int", LogPixels, "int", 72)
      NumPut(s, LOGFONT, 0, "Int")         ; set size
   }
   else  NumPut(16, LOGFONT, 0)         ; set default size

   VarSetCapacity(CHOOSEFONT, 60, 0)
    ,NumPut(60,       CHOOSEFONT, 0)      ; DWORD lStructSize
    ,NumPut(hGui,    CHOOSEFONT, 4)      ; HWND hwndOwner (makes dialog "modal").
    ,NumPut(&LOGFONT,CHOOSEFONT, 12)   ; LPLOGFONT lpLogFont
    ,NumPut(Effects, CHOOSEFONT, 20)
    ,NumPut(clr,    CHOOSEFONT, 24)   ; rgbColors

    r := DllCall("comdlg32\ChooseFont" (A_IsUnicode ? "W" : "A"), "uint", &CHOOSEFONT)  ; Display the dialog.
    ifEqual, r, 0, return false

  ;font name
   VarSetCapacity(Name, 64)
   DllCall("RtlMoveMemory", "str", Name, "Uint", &LOGFONT + 28, "Uint", 64)
   VarSetCapacity(Name, -1)

  ;color
   old := A_FormatInteger
   SetFormat, integer, hex                      ; Show RGB color extracted below in hex format.
   Color := NumGet(CHOOSEFONT, 24)
   SetFormat, integer, %old%

  ;styles
   style:=VarSetCapacity(s, 3)
   DllCall("RtlMoveMemory", "Astr", s, "Uint", &LOGFONT + 20, "Uint", 3)

   ;~ if NumGet(LOGFONT, 16) >= 700
     ;~ Style .= "bold "

   ;~ if NumGet(LOGFONT, 20, "UChar")
      ;~ Style .= "italic "

   ;~ if NumGet(LOGFONT, 21, "UChar")
      ;~ Style .= "underline "

   ;~ if NumGet(LOGFONT, 22, "UChar")
      ;~ Style .= "strikeout "

   s := NumGet(LOGFONT, 0, "Int")
   Style .= Abs(DllCall("MulDiv", "int", abs(s), "int", 72, "int", LogPixels))

   ;convert to rgb
   oldFormat := A_FormatInteger
   SetFormat, integer, hex  ; Show RGB color extracted below in hex format.

   Color := (Color & 0xff00) + ((Color & 0xff0000) >> 16) + ((Color & 0xff) << 16)
   StringTrimLeft, Color, Color, 2
   StringTrimLeft, Style, Style, 1
   loop, % 6-strlen(Color)
   Color=0%Color%
   Color=0x%Color%
   SetFormat, integer, %oldFormat%
   return 1
   } ;http://www.autohotkey.com/community/viewtopic.php?p=323696#323696 (butchered for notify builder)
   
/*
OUTPUT_TO_NTFY(LIST_OF_FIELDS, FILE_NAME, ARCHIVE_FOLDER="")
LIST_OF_FIELDS: Pipe delimited list of variables to store
FILE_NAME: File name to store to
ARCHIVE_FOLDER: Name of folder to store archived file if it already exists(optional, archives will not be kept if omited)

*/
OUTPUT_TO_NTFY(LIST_OF_VARS, FILE_NAME, ARCHIVE_FOLDER="", SHOW_POP=1){
NTFY_DEL= % chr(5)
CONTAINER= ; init the container
	Loop, parse,LIST_OF_VARS, "|" ; build the field value relationship dynamiclly, store in LEGACY_NOTES_FILE
	{
		CONTAINER.=A_LoopField . NTFY_DEL . %A_LoopField% . NTFY_DEL
	}
	StringTrimRight, CONTAINER,CONTAINER,1 ; trimm off the last delimiter
	
	;check for the archive folder
If(ARCHIVE_FOLDER)
	IfNotExist,%ARCHIVE_FOLDER%
		FileCreateDir, %ARCHIVE_FOLDER%
		
; check to see if the file exists before write and archive if requested
IfExist, %FILE_NAME%
{
	SplitPath,FILE_NAME,,,FILE_NAME_EXT,FILE_NAME_NOEXT
	If(ARCHIVE_FOLDER) ; only archive if requested
	{
		FileMove,%FILE_NAME%, %ARCHIVE_FOLDER%\%FILE_NAME_NOEXT%_ARCHIVE_%A_MM%-%A_DD%-%A_YYYY%_at_%A_Hour%%A_Min%-%A_Sec%.%FILE_NAME_EXT%
			ACHIVED_TRUE:=1
	}
	FileDelete, %FILE_NAME%
}
FileAppend,%CONTAINER%, %FILE_NAME%,UTF-8 ; UTF-8 seems to work best for this for some reason
if(SHOW_POP)
{
if(ACHIVE_TRUE)
	Notify("Notify was saved and archived", FILE_NAME, "2", "GC=AAAAAA TS=12 TC=006600 MS=8 MC=006600 SI=200 SC=600 ST=600 IMAGE=148 IW=40 IH=40 ")
else
	Notify("Notify was saved", FILE_NAME, "2", "GC=AAAAAA TS=12 TC=006600 MS=8 MC=006600 SI=200 SC=600 ST=600 IMAGE=148 IW=40 IH=40 ")
}
}return

/*
READ_FROM_NTFY(FILE_NAME)
FILE_NAME: File name to read back into variables

*/
READ_FROM_NTFY(FILE_NAME){
local a := 1 ; used to push the dynamic global vars below (see: http://www.autohotkey.com/forum/topic19641.html) Thanks Lexikos! 
FileRead, CONTAINER, %FILE_NAME% ;Read the file into memory

	Loop, parse,CONTAINER, % chr(5) ; parse out the variable names and values expected(var names = odd numbers, var values = even numbers)
	{		
		;~ msgbox % A_Index A_LoopField
		; odd or even logic
	if Mod(A_Index,2) ; this is an odd number, assumed to be a variable name
		{
			LAST_VAR_NAME:=A_LoopField ; keep the name for value asignment
		}
	else ; this is an even number, assumed to be the value of the previous entry
		{
			%LAST_VAR_NAME%:=A_LoopField ; assign the value back into the variable set global above
		}
	}
}return

NOTES
Tested with AHK_L v1.1.07.03(unicode)
Tested on WinXP SP3, WIN7 Ult64
Dependencies:
Notify() lib (assumed to be in standard lib folder, else include is required to run)
All other functions are included in the script
I'm sure there are still some bugs, I think I got most of them, but post here if you find any :)
First version of this can be found HERE
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

CodeEater
  • Members
  • 83 posts
  • Last active: Jun 06 2013 03:42 PM
  • Joined: 17 Jun 2012
Nice! Now, it's easier to use Notify() . Thank you very much!
btw, In "Logic" tab,How to use "New Title" and "New Message" ?

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
Just put something in either or both fields and something in the ID Name field. It will generate an update call under the first Notify()
Add killer and Progress loop work much the same, just some additional logic to make them do stuff.
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
Updated
Added predefined styles to the logic tab.
These presets are saved and loaded as other fields.

Explanation:

Logic presets:
Default - Sets to default settings, cleaning the statics in the function
Save/Load - Call save preset to save the settings, call the Load style to load those presets

Graphical presets:
ToolTip
BalloonTip
Error
Warning
Info
Question
Progress
Huge
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
Thanks again for making/sharing this... I'm so glad you and others use Notify()

gwarble

Trubbleguy
  • Members
  • 122 posts
  • Last active: Jan 15 2017 10:50 AM
  • Joined: 20 Jan 2007
To both gwarble and JamixZol, i have just one word:
AWESOME

Bartimus
  • Members
  • 237 posts
  • Last active: Nov 10 2016 05:01 PM
  • Joined: 10 Nov 2005

To both gwarble and JamixZol, i have just one word:
AWESOME

 

I second that remark!!!    B) 



Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011

This seems amazing!! But as a noob can you please post a full example of something we can display a notification for?  For example, like USB stick has been inserted or something?  Like how would you build a notify message for this?