Files
WhoDidIt/tools/WhoDidIt-Sync-Hidden.vbs
bdot1andClaude Opus 5.5 80c5b0eea5 Ship the sync launcher: no more "Can not find script file" for players
An older WhoDidIt could leave a "WhoDidIt-Sync" scheduled task on a
player's PC. It points at tools\WhoDidIt-Sync-Hidden.vbs, which used to be
generated on the one PC that ran AutoSync and wasn't in the download, so
Windows showed "Can not find script file" at every login, unlock and every
15 minutes.

The launcher now ships with WhoDidIt and works out its own folder at run
time (so umlauts are fine):
- if tools\WhoDidIt-Sync.ps1 is there (the maintainer), it starts the helper
  with no window, as before;
- otherwise (any player: the helper isn't in the download) it deletes the
  task and the old Startup shortcut without a word.

Players only need to download WhoDidIt again. AutoSync no longer writes or
deletes the launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 21:51:16 +01:00

22 lines
1.1 KiB
Plaintext
Vendored

' WhoDidIt - the sync helper's launcher, run by the "WhoDidIt-Sync" scheduled task.
'
' On the maintainer's PC (tools\WhoDidIt-Sync.ps1 is there): starts the sync
' helper with no window.
'
' Anywhere else: the helper isn't part of the WhoDidIt download, so this is an
' older version's leftover task. It removes that task (and the old Startup
' shortcut) without a word, so nothing pops up again, and does nothing else.
' (The paths are worked out here at run time, so a folder name with an accent
' or umlaut is fine.)
Option Explicit
Dim fso, sh, helper, startupLink
Set fso = CreateObject("Scripting.FileSystemObject")
Set sh = CreateObject("WScript.Shell")
helper = fso.BuildPath(fso.GetParentFolderName(WScript.ScriptFullName), "WhoDidIt-Sync.ps1")
If fso.FileExists(helper) Then
sh.Run "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & helper & """", 0, False
Else
sh.Run "schtasks.exe /Delete /TN ""WhoDidIt-Sync"" /F", 0, True
startupLink = fso.BuildPath(sh.SpecialFolders("Startup"), "WhoDidIt-Sync.lnk")
If fso.FileExists(startupLink) Then fso.DeleteFile startupLink, True
End If