Push notifications when your compile finishes
January 2024
You can help by adding links to this article from other relevant articles.
January 2024
Because compiling a map can take multiple hours, it's often necessary to step away from the computer while it's compiling. By following this tutorial, you can get a push notification on your phone when your compile finishes.
This tutorial requires you have AutoHotKey installed and working.
Setting up Pushbullet
In order to get notifications on your phone, we will be using Pushbullet. Install the application on your phone (from the App Store or your phone's equivalent), create an account, and allow it access to notifications.
Next, visit https://www.pushbullet.com/ and sign in. Once you have signed in, select "Settings" on the left, and then press the button labeled "Create Access Token" on the right. Copy the token it provides.
Creating the AutoHotKey executable
Now we need to create the executable that hammer will run. With AutoHotKey installed, right-click in the folder you want to keep the executable in and select New -> Autohotkey script. Name the file compileNotification.ahk.
Open the script (Double-clicking it will run it, right-click it and open with your text editor of choice), delete everything already inside the script, and paste in this code:
PB_Token := "YOUR TOKEN HERE" PB_Title := "Compile Done" PB_Message := "Come back!" MsgBox % PB_PushNote(PB_Token, PB_Title, PB_Message) PB_PushNote(PB_Token, PB_Title, PB_Message) { 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"": ""note"", ""title"": """ PB_Title """, ""body"": """ PB_Message """}" WinHTTP.Send(PB_Body) Result := WinHTTP.ResponseText Status := WinHTTP.Status return Status } Exit
Make sure to replace "YOUR TOKEN HERE" with the access token you got from Pushbullet, then save the script and close your text editor.
Finally, right-click on your .ahk file inside the file browser and press "Compile Script". This will take a moment, but once it is done, you will have a file called compileNotification.exe
. If you double-click on it to run it, you should get a notification on your phone saying "Compile Done". On your computer, a box should appear saying "200". This means the notification was sent successfully.
Code from https://www.autohotkey.com/boards/viewtopic.php?t=4842
Adding the script to Hammer
Finally, we need to add the executable to Hammer so that it is run when our compilation finishes. Press F9 to open the Run Map window, then select "Expert" to open the expert compile menu. Select the compile type you want to use from the dropdown, then press "New". This will add a new step to the compile. In the "Command" box on the right, provide the path to the executable. This example uses C:\Users\Dashz\Documents\Macros\compileNotification.exe
, but you should change it with the path to your executable. You do not need any parameters.
You are all set! Now, when you finish compiling, you will get a notification on your phone.