Last active
May 24, 2018 21:04
-
-
Save samuelcarreira/4f832a58df62f3522833779a1d9ad8eb to your computer and use it in GitHub Desktop.
Inno Setup Script - Get Slack notification when someone installs your app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Get Slack notification when someone installs your app | |
; by: Samuel Carreira | |
; -- Basic code from Inno Setup Example1.iss -- | |
#define MyAppVersion "0.1.0" | |
#define MyAppName "Your App Name" | |
[Setup] | |
AppName=My Program | |
AppVersion=0.1.0 | |
DefaultDirName={pf}\My Program | |
DefaultGroupName=My Program | |
UninstallDisplayIcon={app}\MyProg.exe | |
Compression=lzma2 | |
SolidCompression=yes | |
OutputDir=userdocs:Inno Setup Examples Output | |
[Files] | |
Source: "MyProg.exe"; DestDir: "{app}" | |
Source: "MyProg.chm"; DestDir: "{app}" | |
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme | |
[Icons] | |
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe" | |
[Code] | |
procedure CurStepChanged(CurStep: TSetupStep); | |
var | |
myVersion, | |
json, | |
WinHttpReq: Variant; | |
begin | |
myVersion := '{#SetupSetting("AppVersion")}'; | |
json := '{"text":"[Automatic Message] {#SetupSetting("AppName")} v.{#SetupSetting("AppVersion")} was installed"}'; | |
if CurStep = ssDone then | |
begin | |
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); | |
WinHttpReq.Open('POST', 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', false); | |
WinHttpReq.setRequestHeader('Content-type', 'application/json'); | |
WinHttpReq.Send(json); | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To ignore errors: