Skip to content

Fix: master-light image never sent from WBPP event script (V1.0.5) #2

Description

@jlg84

The WBPP event-script scope does not define the PJSR constants
SampleType_Real or UndoFlag_NoSwapFile, and the bundle has no #include
to supply them. duplicateImageWindow() therefore throws a ReferenceError
at send time, so the master light is produced but no image reaches the
messaging platform (text/stage notifications are unaffected).

Fix keeps the helper self-contained:

  • read the floating-point flag from image.isReal (always available)
    instead of comparing to SampleType_Real
  • guard UndoFlag_NoSwapFile, defining it only if not already in scope

Tested on macOS (Apple Silicon), PixInsight 1.9.4, WBPP 3.0.1, Telegram.

--- a/TheSpaceKoala/NotificationEventScript.js
+++ b/TheSpaceKoala/NotificationEventScript.js
@@ -113,6 +113,11 @@
   return exitCode;
 };
 
+// Fallback for the swap-file undo flag if the event-script scope lacks it.
+if (typeof UndoFlag_NoSwapFile === 'undefined') {
+  var UndoFlag_NoSwapFile = 0x80000000;
+}
+
 var duplicateImageWindow = function (imageWindow, newId) {
   if (!imageWindow || imageWindow.isNull) {
     printError('Invalid image window provided for duplication.');
@@ -124,7 +129,7 @@
     1,
     1,
     imageWindow.mainView.image.bitsPerSample,
-    imageWindow.mainView.image.sampleType == SampleType_Real,
+    imageWindow.mainView.image.isReal,
     false,
     newId
   );

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions