-
Notifications
You must be signed in to change notification settings - Fork 0
/
bt_off.ahk
35 lines (26 loc) · 877 Bytes
/
bt_off.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Requires AutoHotkey v2.0
#Warn
#SingleInstance Force
#include %A_ScriptDir%\cred_manager.ahk
param := A_Args[1]
; Extract the password property, assuming this holds the API key
APIkey := CredRead(param).password
; Set Device name
Device := "Dylan%27s%20Tab%20S8"
; Set optional command prefix
cmdPrefix := "Prefix=:="
; Set Var to the command and replace spaces with %20
Var := "btoff"
; Replace whitespace in Var (for URL encoding)
Var := RegExReplace(Var, "\s", "%20")
; Construct the URL with all variables
url := "https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush?deviceNames=" . Device . "&text=" . cmdPrefix . Var . "&apikey=" . APIkey
; Set up HTTP request with error handling
try {
oHttp := ComObject("WinHttp.WinHttpRequest.5.1")
oHttp.open("GET", url)
oHttp.send()
} catch {
MsgBox("Error: Failed to send request")
}
ExitApp