ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.28 GrowlNotifyTask When you have a long process and want to be notified when it is finished, without to stay focused on the console windows. Then use the GrowlNotify task. This task requires the PEAR [Net\_Growl](http://pear.php.net/package/Net_Growl) package installed (version 2.6.0). **Features** - Compatible Windows and Mac/OSX - Do not forget notification with sticky option - Define priority of messages - Send notification on private or public network Table C.29:聽Attributes NameTypeDescriptionDefaultRequired`name``String`Name of application to be registerGrowl for PhingNo`sticky``Boolean`Indicates if the notification should be sticky on desktopfalseNo`message``String`Text of notification. Use \\n to specify a line breakn/aYes`title``String`Title of notificationGrowlNotifyNo`notification``String`The notification name/typeGeneral NotificationNo`appicon``String`- absolute url (http://domain/image.png) - absolute file path (c:\\temp\\image.png) - relative file path (.\\folder\\image.png) n/aNo`host``String`The host address where to send the notification127.0.0.1No`password``String`The password required to send notifications over networkn/aNo`priority``String`The notification priority. Valid values are : - low - moderate - normal - high - emergency normalNo`protocol``String`The protocol used to send the notification. May be either gntp or udp.gntpNo`icon``String`The icon to show for the notification. Must be a valid file type (png, jpg, gif, ico). Can be any of the following: - absolute url (http://domain/image.png) - absolute file path (c:\\temp\\image.png) - relative file path (.\\folder\\image.png) embedded growl icon v2No C.28.1 Examples Send a single notification on a remote host Both sender and Growl client (Mac or Windows) should share the same password. ``` <?xml version="1.0" encoding="UTF-8"?> <project name="phing-GrowlNotifyTask" basedir="." default="notification"> <taskdef name="growlnotify" classname="phing.tasks.ext.GrowlNotifyTask" /> <target name="notification" description="display a single message with growl gntp over network" > <growlnotify message="Deployment of project LAMBDA is finished." host="192.168.1.2" password="seCretPa$$word" /> </target> </project> ``` Send a single notification with UDP protocol When you don't have a Macintosh, OS compatible with Growl GNTP, you should use the basic UDP protocol. ``` <?xml version="1.0" encoding="UTF-8"?> <project name="phing-GrowlNotifyTask" basedir="." default="notification"> <taskdef name="growlnotify" classname="phing.tasks.ext.GrowlNotifyTask" /> <target name="notification" description="display a single message with growl udp over network" > <growlnotify message="Notify my MAC that does not accept GNTP." host="192.168.1.2" password="seCretPa$$word" protocol="udp" /> </target> </project> ``` Send an important notification If you want to send a notification that is so important that you don't want to missed it, even if you are away from your computer. Use the sticky attribute. ``` <?xml version="1.0" encoding="UTF-8"?> <project name="phing-GrowlNotifyTask" basedir="." default="notification"> <taskdef name="growlnotify" classname="phing.tasks.ext.GrowlNotifyTask" /> <target name="notification" description="display a sticky message on desktop" > <growlnotify message="Project LAMDBA, unit tests FAILED." priority="high" sticky="true" /> </target> </project> ``` Use your icons to identify an application You may customize the Growl notification system, with different icons and more. ``` <?xml version="1.0" encoding="UTF-8"?> <project name="phing-GrowlNotifyTask" basedir="." default="notification"> <taskdef name="growlnotify" classname="phing.tasks.ext.GrowlNotifyTask" /> <target name="notification" description="display a custom icon message" > <growlnotify message="Have a look on my beautiful message!" name="phing Notifier" title="phing notification" priority="low" sticky="false" appicon="../images/my_icon.png" /> </target> </project> ```