PushBullet & AutoHotkey
- Delta Pythagorean
- Posts: 628
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: PushBullet & AutoHotkey
Alright, it's clearly established that this function can send a message, what about reading a message that was sent from another user?
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
- Delta Pythagorean
- Posts: 628
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: PushBullet & AutoHotkey
Sending a message with a new line can simply be done by switching out the `n to \n.flyingDman wrote:I want to be able to do PB_Message := clipboard. If the clipboard content includes a `n or `r it throws an error (the other code I referred to does this well)
Similarly, you can do this to most (Not tested) other escape messages.
Hope this helps!
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
- flyingDman
- Posts: 3012
- Joined: 29 Sep 2013, 19:01
Re: PushBullet & AutoHotkey
Thanks. That seems to be the same solution as tmplinshi provided.
It seems that you have an interest for Pushbullet. Have you (or anybody else) found how to push a file?
It seems that you have an interest for Pushbullet. Have you (or anybody else) found how to push a file?
14.3 & 1.3.7
Re: PushBullet & AutoHotkey
API seems pretty straight forward
For a file (see lower on the page):
https://docs.pushbullet.com/#create-push
For a file (see lower on the page):
https://docs.pushbullet.com/#create-push
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]
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Using PushBullet & AutoHotkey to send a file
Example of Pushing a file
Code: Select all
#Include CreateFormData.ahk ; https://gist.github.com/tmplinshi/8428a280bba58d25ef0b
#Include BinArr.ahk ; https://gist.github.com/tmplinshi/a97d9a99b9aa5a65fd20
#Include JSON.ahk ; https://github.com/cocobelgica/AutoHotkey-JSON/blob/master/JSON.ahk
image_path := "C:\Blue Cube.png"
PB_Token := "...Pease enter your own..."
PB_Image_Name := "Blue Cube.png"
JSON_Response := PB_PushUpload_request(PB_Token, PB_Image_Name)
JSON_Response_object := JSON.load( JSON_Response )
objParam := { "file": [image_path]}
CreateFormData(postData, hdr_ContentType, objParam)
Status := PB_PushUpload_formData(JSON_Response_object.upload_url, postData, hdr_ContentType)
if (Status != 204)
{
msgbox % "Upload Error!"
return
}
msgbox % PB_PushFile(PB_Token, "This is an image test", JSON_Response_object.file_name, JSON_Response_object.file_type, JSON_Response_object.file_url)
return
PB_PushUpload_request(PB_Token, PB_Image_Name)
{
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.SetProxy(0)
WinHTTP.Open("POST", "https://api.pushbullet.com/v2/upload-request", 0)
WinHTTP.SetCredentials(PB_Token, "", 0)
WinHTTP.SetRequestHeader("Content-Type", "application/json")
PB_Body := "{""file_name"": """ PB_Image_Name """, ""file_type"": ""image/png""}"
WinHTTP.Send(PB_Body)
Result := WinHTTP.ResponseText
Status := WinHTTP.Status
return Result
}
PB_PushUpload_formData(PB_upload_url, PB_postData, PB_ContentType)
{
WinHTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WinHTTP.Open("POST", PB_upload_url, true)
WinHTTP.SetRequestHeader("Content-Type", PB_ContentType)
WinHTTP.Option(6) := False ; No auto redirect
WinHTTP.Send(PB_postData)
WinHTTP.WaitForResponse()
Result := WinHTTP.ResponseText
Status := WinHTTP.Status
return Status
}
PB_PushFile(PB_Token, PB_Body, PB_file_name, PB_file_type, PB_file_url)
{
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.SetProxy(0)
WinHTTP.Open("POST", "https://api.pushbullet.com/v2/pushes", 0)
WinHTTP.SetCredentials(PB_Token, "", 0)
WinHTTP.SetRequestHeader("Content-Type", "application/json")
PB_Body := "{""type"": ""file"", ""body"": """ PB_Body """, ""file_name"": """ PB_file_name """, ""file_type"": """ PB_file_type """, ""file_url"": """ PB_file_url """}"
WinHTTP.Send(PB_Body)
Result := WinHTTP.ResponseText
Status := WinHTTP.Status
return Status
}
Courses on AutoHotkey
My Autohotkey Blog
Re: PushBullet & AutoHotkey
Maybe someone come in handy ... Works without glitches.
Code: Select all
PB_PushNote( PB_Token, PB_Message, PB_Number, PB_SourceUserID, PB_TargetDivaceID )
{
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
WinHTTP.SetProxy(0)
WinHTTP.Open("POST", "https://api.pushbullet.com/v2/ephemerals", 0)
WinHTTP.SetCredentials(PB_Token, "", 0)
WinHTTP.SetRequestHeader("Content-Type", "application/json")
PB_Body := "{""push"": {""conversation_iden"": """ PB_Number """, ""message"": """ PB_Message """, ""package_name"": ""com.pushbullet.android"", ""source_user_iden"": """ PB_SourceUserID """, ""target_device_iden"": """ PB_TargetDivaceID """, ""type"": ""messaging_extension_reply""}, ""type"": ""push""}"
WinHTTP.Send(PB_Body)
Result := WinHTTP.ResponseText
Status := WinHTTP.Status
Return Status
}
-
- Posts: 34
- Joined: 09 Jun 2017, 09:19
Re: PushBullet & AutoHotkey
Does anyone have the code for receiving notifications from other devices in order to trigger ahk scripts? i.e. I send a Pushbullet notification containing specific text from my Android phone to PC & that triggers the AHK script actions.
Re: PushBullet & AutoHotkey
Hi, I have tried but failed, is there anyway that I can use Pushbullet script without getting the Response Msg windows from appearing with the status.
Re: PushBullet & AutoHotkey
PushBullet no longer supports iOS devices. Is anyone aware of an alternative?
Re: PushBullet & AutoHotkey
Looks promising. Thank you.
Who is online
Users browsing this forum: No registered users and 27 guests