You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'-e',' set frontmostProcess to first application process whose frontmost is true',
748
+
'-e',' if targetProcessId is not "" then',
749
+
'-e',' set currentPid to (unix id of frontmostProcess) as string',
750
+
'-e',' if currentPid is not targetProcessId then error "Target app lost frontmost status " & phase & " (pid " & currentPid & " != " & targetProcessId & ")"',
751
+
'-e',' else if targetBundleId is not "" then',
752
+
'-e',' set currentBundleId to ""',
753
+
'-e',' try',
754
+
'-e',' set currentBundleId to (bundle identifier of frontmostProcess) as string',
755
+
'-e',' end try',
756
+
'-e',' if currentBundleId is not targetBundleId then error "Target app lost frontmost status " & phase & " (bundle " & currentBundleId & " != " & targetBundleId & ")"',
757
+
'-e',' else',
758
+
'-e',' set currentApp to name of frontmostProcess',
759
+
'-e',' if currentApp is not appName then error "Target app lost frontmost status " & phase & " (" & currentApp & " != " & appName & ")"',
760
+
'-e',' end if',
761
+
'-e',' end tell',
762
+
'-e','end assertTargetFrontmost',
733
763
'-e','on run argv',
734
764
'-e',' set wakePayload to (item 1 of argv)',
765
+
'-e',` set targetAppName to "${appleScriptAppName}"`,
766
+
'-e',' set targetBundleId to ""',
767
+
'-e',' try',
768
+
'-e',` set targetBundleId to id of application "${appleScriptAppName}"`,
769
+
'-e',' end try',
770
+
'-e',` set targetProcessId to "${targetProcessId}"`,
735
771
'-e',' try',
736
772
'-e',' set savedClipboard to the clipboard as string',
737
773
'-e',' on error',
738
774
'-e',' set savedClipboard to ""',
739
775
'-e',' end try',
776
+
'-e',' try',
740
777
'-e',activateLine,
741
778
'-e',' delay 0.5',
779
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "after activation")',
742
780
'-e',' tell application "System Events"',
743
781
'-e',' set frontmostProcess to first application process whose frontmost is true',
744
782
'-e',' tell frontmostProcess'
@@ -777,6 +815,7 @@ async function deliverDigest(subscription, digest) {
777
815
}
778
816
779
817
osascriptArgs.push(
818
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "before prompt clear")',
780
819
'-e',' set the clipboard to ""',
781
820
'-e',' keystroke "a" using command down',
782
821
'-e',' delay 0.2',
@@ -789,8 +828,10 @@ async function deliverDigest(subscription, digest) {
789
828
'-e',' on error',
790
829
'-e',' set userInput to ""',
791
830
'-e',' end try',
831
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "before wake clipboard set")',
792
832
'-e',' set the clipboard to wakePayload',
793
833
'-e',' delay 0.2',
834
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "before wake paste")',
794
835
'-e',' tell application "System Events"',
795
836
'-e',' set frontmostProcess to first application process whose frontmost is true',
796
837
'-e',' tell frontmostProcess',
@@ -801,8 +842,10 @@ async function deliverDigest(subscription, digest) {
801
842
'-e',' end tell',
802
843
'-e',' end tell',
803
844
'-e',' if userInput is not "" then',
845
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "before user input restore clipboard set")',
804
846
'-e',' set the clipboard to userInput',
805
847
'-e',' delay 0.2',
848
+
'-e',' my assertTargetFrontmost(targetAppName, targetBundleId, targetProcessId, "before user input restore paste")',
806
849
'-e',' tell application "System Events"',
807
850
'-e',' set frontmostProcess to first application process whose frontmost is true',
808
851
'-e',' tell frontmostProcess',
@@ -812,6 +855,10 @@ async function deliverDigest(subscription, digest) {
0 commit comments