11; OpenClaw Companion Inno Setup Script (WinUI version)
2- #define MyAppName " OpenClaw Companion"
3- #define MyAppPublisher " Scott Hanselman"
2+ ; Pass /DDevBuild=1 to produce a side-by-side dev installer.
3+ #ifdef DevBuild
4+ #define MyAppName " OpenClaw Companion (Dev)"
5+ #define MyAppId " {{M0LTB0T-TRAY-4PP1-DEV}"
6+ #define MyInstallDir " OpenClawTray-Dev"
7+ #define MyMutex " OpenClawTray-Dev"
8+ #define MyAutoStartName " OpenClawTray-Dev"
9+ #define MyStartupTaskName " OpenClaw Companion (Dev)"
10+ #define MyDistroName " OpenClawGateway-Dev"
11+ #define MyProtocol " openclaw-dev"
12+ #define MyOutputSuffix " -Dev"
13+ #else
14+ #define MyAppName " OpenClaw Companion"
15+ #define MyAppId " {{M0LTB0T-TRAY-4PP1-D3N7}"
16+ #define MyInstallDir " OpenClawTray"
17+ #define MyMutex " OpenClawTray"
18+ #define MyAutoStartName " OpenClawTray"
19+ #define MyStartupTaskName " OpenClaw Companion"
20+ #define MyDistroName " OpenClawGateway"
21+ #define MyProtocol " openclaw"
22+ #define MyOutputSuffix " "
23+ #endif
24+ #define MyAppPublisher " OpenClaw Foundation"
425#define MyAppURL " https://github.com/openclaw/openclaw-windows-node"
526#define MyAppExeName " OpenClaw.Tray.WinUI.exe"
627
2041[Setup]
2142; Inno requires "{{" to emit a literal opening brace in AppId.
2243; Do not add a second closing brace here; that creates a malformed uninstall registry key.
23- AppId = {{M0LTB0T-TRAY-4PP1-D3N7 }
44+ AppId = {#MyAppId }
2445AppName = {#MyAppName }
2546AppVersion = {#MyAppVersion}
2647AppPublisher = {#MyAppPublisher}
2748AppPublisherURL = {#MyAppURL}
2849AppSupportURL = https://github.com/openclaw/openclaw-windows-node/issues
2950AppUpdatesURL = https://github.com/openclaw/openclaw-windows-node/releases
30- DefaultDirName = {localappdata} \OpenClawTray
51+ DefaultDirName = {localappdata} \{#MyInstallDir}
3152DefaultGroupName = {#MyAppName }
3253DisableProgramGroupPage = yes
33- OutputBaseFilename = OpenClawCompanion-Setup-{#MyAppArch}
54+ OutputBaseFilename = OpenClawCompanion{#MyOutputSuffix} -Setup-{#MyAppArch}
3455Compression = {#MyCompression}
3556SolidCompression = {#MySolidCompression}
3657WizardStyle = modern
3758PrivilegesRequired = lowest
3859SetupIconFile = src\OpenClaw.Tray.WinUI\Assets\openclaw.ico
3960UninstallDisplayIcon = {app} \{#MyAppExeName}
4061; Round 2 (Scott #5): block install/uninstall while the tray is running.
41- ; Mutex name matches App.xaml.cs (`new Mutex(true, "OpenClawTray", …)`).
42- ; Tray and Inno run in the same user session, so the bare name resolves
43- ; against Local\OpenClawTray — no Global\ prefix needed.
44- AppMutex = OpenClawTray
62+ ; Mutex name matches AppIdentity.MutexBaseName for this build variant.
63+ ; Tray and Inno run in the same user session, so no Global\ prefix is needed.
64+ AppMutex = {#MyMutex}
4565#if MyAppArch == " arm64"
4666ArchitecturesInstallIn64BitMode = arm64
4767ArchitecturesAllowed = arm64
@@ -74,7 +94,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
7494
7595[Tasks]
7696Name : " desktopicon" ; Description : " {cm:CreateDesktopIcon}" ; GroupDescription: " {cm:AdditionalIcons}" ; Flags : unchecked
77- Name : " startupicon" ; Description : " Start OpenClaw Companion when Windows starts" ; GroupDescription: " Startup:" ; Flags : unchecked
97+ Name : " startupicon" ; Description : " Start {#MyAppName} when Windows starts" ; GroupDescription: " Startup:" ; Flags : unchecked
7898
7999[Files]
80100; WinUI Tray app - include all files (WinUI needs DLLs, not single-file)
@@ -86,17 +106,17 @@ Source: "{#vcRedist}"; DestDir: "{tmp}"; DestName: "vc_redist.exe"; Flags: delet
86106#endif
87107
88108[Registry]
89- Root : HKCU; Subkey : " Software\Classes\openclaw " ; ValueType : string ; ValueName : " " ; ValueData : " URL:OpenClaw Protocol" ; Flags : uninsdeletekey
90- Root : HKCU; Subkey : " Software\Classes\openclaw " ; ValueType : string ; ValueName : " URL Protocol" ; ValueData : " "
91- Root : HKCU; Subkey : " Software\Classes\openclaw \DefaultIcon" ; ValueType : string ; ValueName : " " ; ValueData : " " " {app} \{#MyAppExeName}" " ,0"
92- Root : HKCU; Subkey : " Software\Classes\openclaw \shell\open\command" ; ValueType : string ; ValueName : " " ; ValueData : " " " {app} \{#MyAppExeName}" " " " %1 " " "
109+ Root : HKCU; Subkey : " Software\Classes\{#MyProtocol} " ; ValueType : string ; ValueName : " " ; ValueData : " URL:OpenClaw Protocol" ; Flags : uninsdeletekey
110+ Root : HKCU; Subkey : " Software\Classes\{#MyProtocol} " ; ValueType : string ; ValueName : " URL Protocol" ; ValueData : " "
111+ Root : HKCU; Subkey : " Software\Classes\{#MyProtocol} \DefaultIcon" ; ValueType : string ; ValueName : " " ; ValueData : " " " {app} \{#MyAppExeName}" " ,0"
112+ Root : HKCU; Subkey : " Software\Classes\{#MyProtocol} \shell\open\command" ; ValueType : string ; ValueName : " " ; ValueData : " " " {app} \{#MyAppExeName}" " " " %1 " " "
93113
94114[Icons]
95115Name : " {group} \{#MyAppName}" ; Filename : " {app} \{#MyAppExeName}"
96- Name : " {group} \OpenClaw Gateway Setup" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " openclaw ://setup" ; IconFilename: " {app} \{#MyAppExeName}"
97- Name : " {group} \OpenClaw Companion Settings" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " openclaw ://commandcenter" ; IconFilename: " {app} \{#MyAppExeName}"
98- Name : " {group} \OpenClaw Chat" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " openclaw ://chat" ; IconFilename: " {app} \{#MyAppExeName}"
99- Name : " {group} \Check for Updates" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " openclaw ://check-updates" ; IconFilename: " {app} \{#MyAppExeName}"
116+ Name : " {group} \OpenClaw Gateway Setup" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " {#MyProtocol} ://setup" ; IconFilename: " {app} \{#MyAppExeName}"
117+ Name : " {group} \OpenClaw Companion Settings" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " {#MyProtocol} ://commandcenter" ; IconFilename: " {app} \{#MyAppExeName}"
118+ Name : " {group} \OpenClaw Chat" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " {#MyProtocol} ://chat" ; IconFilename: " {app} \{#MyAppExeName}"
119+ Name : " {group} \Check for Updates" ; Filename : " {app} \{#MyAppExeName}" ; Parameters : " {#MyProtocol} ://check-updates" ; IconFilename: " {app} \{#MyAppExeName}"
100120Name : " {group} \{cm:UninstallProgram,{#MyAppName}}" ; Filename : " {uninstallexe} "
101121Name : " {autodesktop}\{#MyAppName}" ; Filename : " {app} \{#MyAppExeName}" ; Tasks: desktopicon
102122Name : " {userstartup}\{#MyAppName}" ; Filename : " {app} \{#MyAppExeName}" ; Tasks: startupicon
@@ -170,7 +190,7 @@ begin
170190 LocalGatewayCleanupRequested :=
171191 MsgBox(
172192 ' Do you also want to remove the OpenClaw local WSL gateway?' + #13 #10 #13 #10 +
173- ' Choose Yes to unregister the OpenClawGateway WSL distro and remove generated local gateway state.' + #13 #10 +
193+ ' Choose Yes to unregister the {#MyDistroName} WSL distro and remove generated local gateway state.' + #13 #10 +
174194 ' Choose No to leave the local gateway and generated local state on this computer.' ,
175195 mbConfirmation,
176196 MB_YESNO) = IDYES;
@@ -212,7 +232,11 @@ begin
212232
213233 Params :=
214234 ' -NoProfile -ExecutionPolicy Bypass -File ' + AddQuotes(TempScriptPath) +
215- ' -AppRoot ' + AddQuotes(ExpandConstant(' {app}' ));
235+ ' -AppRoot ' + AddQuotes(ExpandConstant(' {app}' )) +
236+ ' -DataDirectoryName ' + AddQuotes(' {#MyInstallDir}' ) +
237+ ' -AutoStartName ' + AddQuotes(' {#MyAutoStartName}' ) +
238+ ' -StartupTaskName ' + AddQuotes(' {#MyStartupTaskName}' ) +
239+ ' -DistroName ' + AddQuotes(' {#MyDistroName}' );
216240
217241 Log(' Running local gateway cleanup script from {tmp}.' );
218242 Result :=
@@ -282,10 +306,38 @@ begin
282306 Log(' Generated app state in {app} could not be fully deleted; continuing uninstall.' );
283307end ;
284308
309+ procedure RemoveAppAutoStart ;
310+ var
311+ ResultCode: Integer;
312+ Started: Boolean;
313+ begin
314+ if RegDeleteValue(
315+ HKCU,
316+ ' SOFTWARE\Microsoft\Windows\CurrentVersion\Run' ,
317+ ' {#MyAutoStartName}' ) then
318+ Log(' Removed {#MyAutoStartName} autostart registry value.' )
319+ else
320+ Log(' {#MyAutoStartName} autostart registry value already absent.' );
321+
322+ Started :=
323+ Exec(
324+ ExpandConstant(' {sys}\schtasks.exe' ),
325+ ' /Delete /TN ' + AddQuotes(' {#MyStartupTaskName}' ) + ' /F' ,
326+ ' ' ,
327+ SW_HIDE,
328+ ewWaitUntilTerminated,
329+ ResultCode);
330+ if Started and (ResultCode = 0 ) then
331+ Log(' Removed {#MyStartupTaskName} startup task.' )
332+ else
333+ Log(' {#MyStartupTaskName} startup task already absent or unavailable.' );
334+ end ;
335+
285336procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
286337begin
287338 if CurUninstallStep = usUninstall then
288339 begin
340+ RemoveAppAutoStart;
289341 EnsureLocalGatewayCleanupChoice;
290342 RunLocalGatewayCleanup;
291343 end
0 commit comments