Skip to main content
added 9 characters in body
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
property scriptToRun : (path to desktop as text) & "your.scpt" -- your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

on idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 6 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end idle

on quit
    --  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
    tell application id "com.apple.SystemEvents"
        tell (the first process whose bundle identifier = "com.apple.notificationcenterui")
            set theseWindows to every window whose subrole is ¬
                "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
            set theseTitles to {}
            repeat with thisWindow in theseWindows
                set titleText to the value of static text 1 of thisWindow
                set the end of theseTitles to titleText
                set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                set the end of theseTitles to subTitleText
                set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                set the end of theseTitles to notificationText
            end repeat
        end tell
    end tell
end getNotificationTitles
property scriptToRun : (path to desktop as text) & "your.scpt" -- your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

on idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 6 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end idle

on quit
    --  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
    tell application id "com.apple.SystemEvents"
        tell (the first process whose bundle identifier = "com.apple.notificationcenterui")
            set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
            set theseTitles to {}
            repeat with thisWindow in theseWindows
                set titleText to the value of static text 1 of thisWindow
                set the end of theseTitles to titleText
                set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                set the end of theseTitles to subTitleText
                set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                set the end of theseTitles to notificationText
            end repeat
        end tell
    end tell
end getNotificationTitles
property scriptToRun : (path to desktop as text) & "your.scpt" -- your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

on idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 6 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end idle

on quit
    --  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
    tell application id "com.apple.SystemEvents"
        tell (the first process whose bundle identifier = "com.apple.notificationcenterui")
            set theseWindows to every window whose subrole is ¬
                "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
            set theseTitles to {}
            repeat with thisWindow in theseWindows
                set titleText to the value of static text 1 of thisWindow
                set the end of theseTitles to titleText
                set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                set the end of theseTitles to subTitleText
                set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                set the end of theseTitles to notificationText
            end repeat
        end tell
    end tell
end getNotificationTitles
added 9 characters in body
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
property scriptToRun : (path to desktop as text) & "your.scpt" -- your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

repeaton idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 76 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        return -- Remove This If You Want This To Keep Repeating
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end repeatidle

on getNotificationTitles()quit
    try--  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
        tell application "Systemid Events""com.apple.SystemEvents"
          tell (the tellfirst process "Notification Center"
whose bundle identifier = "com.apple.notificationcenterui")
            set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        set titleText to the value of static text 1 of thisWindow
                        set the end of theseTitles to titleText
                    end try
                    try
                        set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                        set the end of theseTitles to subTitleText
                    end try
                    try
                        set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                        set the end of theseTitles to notificationText
                    end try
                end repeat
            end tell
        end tell
    end try
end getNotificationTitles. 
property scriptToRun : (path to desktop as text) & "your.scpt"  your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

repeat
    getNotificationTitles()
    delay 1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 7 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        return -- Remove This If You Want This To Keep Repeating
        ---------------------------------------------------------------
    end if
end repeat

on getNotificationTitles()
    try
        -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
        tell application "System Events"
            tell process "Notification Center"
                set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        set titleText to the value of static text 1 of thisWindow
                        set the end of theseTitles to titleText
                    end try
                    try
                        set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                        set the end of theseTitles to subTitleText
                    end try
                    try
                        set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                        set the end of theseTitles to notificationText
                    end try
                end repeat
            end tell
        end tell
    end try
end getNotificationTitles. 
property scriptToRun : (path to desktop as text) & "your.scpt" -- your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

on idle
    getNotificationTitles()
    delay 0.1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 6 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        ---------------------------------------------------------------
    end if
    return 1 -- in seconds
end idle

on quit
    --  Executed when the script quits
    continue quit -- allows the script to quit
end quit

on getNotificationTitles()
    -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
    tell application id "com.apple.SystemEvents"
        tell (the first process whose bundle identifier = "com.apple.notificationcenterui")
            set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
            set theseTitles to {}
            repeat with thisWindow in theseWindows
                set titleText to the value of static text 1 of thisWindow
                set the end of theseTitles to titleText
                set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                set the end of theseTitles to subTitleText
                set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                set the end of theseTitles to notificationText
            end repeat
        end tell
    end tell
end getNotificationTitles
deleted 1 character in body
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
property scriptToRun : (path to desktop as text) & "your.scpt" — your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

repeat
    getNotificationTitles()
    delay 1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 7 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        quit mereturn -- Remove This If You Want This To Keep Repeating
        ---------------------------------------------------------------
    end if
end repeat

on getNotificationTitles()
    try
        -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
        tell application "System Events"
            tell process "Notification Center"
                set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        set titleText to the value of static text 1 of thisWindow
                        set the end of theseTitles to titleText
                    end try
                    try
                        set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                        set the end of theseTitles to subTitleText
                    end try
                    try
                        set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                        set the end of theseTitles to notificationText
                    end try
                end repeat
            end tell
        end tell
    end try
end getNotificationTitles. 
property scriptToRun : (path to desktop as text) & "your.scpt" — your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

repeat
    getNotificationTitles()
    delay 1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 7 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        quit me -- Remove This If You Want This To Keep Repeating
        ---------------------------------------------------------------
    end if
end repeat

on getNotificationTitles()
    try
        -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
        tell application "System Events"
            tell process "Notification Center"
                set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        set titleText to the value of static text 1 of thisWindow
                        set the end of theseTitles to titleText
                    end try
                    try
                        set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                        set the end of theseTitles to subTitleText
                    end try
                    try
                        set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                        set the end of theseTitles to notificationText
                    end try
                end repeat
            end tell
        end tell
    end try
end getNotificationTitles. 
property scriptToRun : (path to desktop as text) & "your.scpt" — your path to .scpt file
property lookForThisText : "Search For This Text In Notification Windows" -- your search term
property theseTitles : {}

repeat
    getNotificationTitles()
    delay 1
    if theseTitles contains lookForThisText then
        ---------------------------------------------------------------
        delay 7 -- Gives Banner Time To Self Close
        --tell current application to beep 5 -- Just For Testing
        run script alias scriptToRun
        return -- Remove This If You Want This To Keep Repeating
        ---------------------------------------------------------------
    end if
end repeat

on getNotificationTitles()
    try
        -- This Gets The Titles Of The Currently Displaying Notification Alerts And Banners
        tell application "System Events"
            tell process "Notification Center"
                set theseWindows to every window whose subrole is "AXNotificationCenterAlert" or subrole is "AXNotificationCenterBanner"
                set theseTitles to {}
                repeat with thisWindow in theseWindows
                    try
                        set titleText to the value of static text 1 of thisWindow
                        set the end of theseTitles to titleText
                    end try
                    try
                        set subTitleText to the value of static text 1 of scroll area 1 of thisWindow
                        set the end of theseTitles to subTitleText
                    end try
                    try
                        set notificationText to the value of static text 2 of scroll area 1 of thisWindow
                        set the end of theseTitles to notificationText
                    end try
                end repeat
            end tell
        end tell
    end try
end getNotificationTitles. 
added 17 characters in body
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
Loading
added 799 characters in body
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
Loading
Source Link
wch1zpink
  • 7.7k
  • 17
  • 35
Loading