mrflibblehat Posted September 12, 2013 Posted September 12, 2013 Hi All, In a recent project of mine I needed to send multiple message to an app on my Iphone called Prowl. Hopefully this will come in useful to someone. expandcollapse popup#Include-Once #include <WinHttp.au3> ; #INDEX# ========================================================================================= ; Title .........: Prowl UDF ; AutoIt Version : 3.3.8++ ; Language ..... : English ; Description ...: Functions for use with Prowl App (http://www.prowlapp.com/) API ; Author(s) .....: mrflibblehat (danielcarroll@gmail.com) ; ================================================================================================= ; #GLOBALS# ======================================================================================= Global Const $vProwl = "api.prowlapp.com" ;~ Prowl API Site Global $vOpen = 0, $vConnect = 0 ; ================================================================================================= ; #CURRENT# ======================================================================================= ;_Prowl_Open ;_Prowl_Close ;_ProwlAdd ; ================================================================================================= ; #FUNCTION# ==================================================================================================================== ; Name...........: _Prowl_Open ; Description ...: Create Session and Connection Handle ; Syntax.........: _Prowl_Open ; Return values .: Failure - Returns 0 and Sets @Error: ; |@error = 1 - Error Opening WinHTTP Handle ; |@error = 2 - Error Opening WinHTTPConnect Handle ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _Prowl_Open() $vOpen = _WinHttpOpen() if (@error) then Return SetError(1, 0, "Error Opening WinHTTP Handle") $vConnect = _WinHttpConnect($vOpen, $vProwl) if (@error) then Return SetError(2, 0, "Error Opening WinHTTPConnect Handle") EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Prowl_Close ; Description ...: Close Session and Connection Handle ; Syntax.........: _Prowl_Close ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _Prowl_Close() _WinHttpCloseHandle($vConnect) _WinHttpCloseHandle($vOpen) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ProwlAdd ; Description ...: ; Syntax ........: _ProwlAdd($vAPIKey, $vEvent, $vDescription[, $vPriority = 0[, $vApplicationName = "Prowl 4 AutoIT"[, $vProviderKey = ""[, $vURL = ""]]]]) ; Parameters ....: $vAPIKey - Prowl API Key ; $vEvent - Name of Event. ; $vDescription - Message to Send. ; $vPriority - [optional] Priority of Message. Default is 0 - Normal. -2 - Very Low | -1 - Moderate | 0 - Normal | 1 - High | 2 - Emergency ; $vApplicationName - [optional] Application Name. Default is "Prowl 4 AutoIT" ; $vProviderKey - [optional] Your provider API key. Only necessary if you have been whitelisted. Default is "". ; $vURL - [optional] Requires Prowl 1.2 The URL which should be attached to the notification. Default is "". ; Return values .: XML response from server ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _ProwlAdd($vAPIKey, $vEvent, $vDescription, $vPriority = 0, $vApplicationName = "Prowl 4 AutoIT", $vProviderKey = "", $vURL = "") Local $sData = ("apikey=" & $vAPIKey & "&application=" & $vApplicationName & "&event=" & $vEvent & "&description=" & $vDescription & "&priority=" & $vPriority & "&providerkey=" & $vProviderKey & "&url=" & $vURL) Local $vRequest = _WinHttpSimpleRequest($vConnect, "POST", "/publicapi/add/", $WINHTTP_NO_REFERER, $sData, "Content-Type: application/x-www-form-urlencoded") if (@error) then Return SetError(3, 0, "Unable To Send Request") Return $vRequest EndFunc Example #include <ProwlUDF.au3> Global $vApiKey = "PUT API KEY HERE" _Prowl_Open() _ProwlAdd($vApiKey, "Test", "Test Message") _Prowl_Close() [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]
kingnothing Posted July 15, 2014 Posted July 15, 2014 Spot on. Exactly what i was looking for. Will make a GUI for this soon.
psbeau Posted September 13, 2016 Posted September 13, 2016 Works great, thanks. I just added the time it fired. #include <Date.au3> #include <ProwlUDF.au3> Global $vApiKey = "PUT API KEY HERE" _Prowl_Open() _ProwlAdd($vApiKey, "Test", "Test Message fired at: " & _NowTime()) _Prowl_Close()
Nick3399 Posted January 20, 2019 Posted January 20, 2019 (edited) Anyone know if this still works? Is there any instructions on how to do this... do I have to install growl on my windows PC to use this? Edit: tested and it works!!! Edited January 20, 2019 by Nick3399
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