diff options
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript')
| -rwxr-xr-x | users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript new file mode 100755 index 0000000..6618fec --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/scripts/firefox-dev-audio.applescript | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | set browser to "" | ||
| 2 | set title_string to "" | ||
| 3 | set active_tab to 0 | ||
| 4 | |||
| 5 | to replace_chars(this_text, search_string, replacement_string) | ||
| 6 | set AppleScript's text item delimiters to the search_string | ||
| 7 | set the item_list to every text item of this_text | ||
| 8 | set AppleScript's text item delimiters to the replacement_string | ||
| 9 | set this_text to the item_list as string | ||
| 10 | set AppleScript's text item delimiters to "" | ||
| 11 | return this_text | ||
| 12 | end replace_chars | ||
| 13 | |||
| 14 | tell application "Firefox Developer Edition" | ||
| 15 | set the_title to (name of windows whose name contains "- YouTube") as text | ||
| 16 | |||
| 17 | if "- YouTube" is in the_title then | ||
| 18 | if active_tab is 0 then set title_string to " " & text 1 thru -11 of the_title | ||
| 19 | set browser to "firefox" | ||
| 20 | set active_tab to 1 | ||
| 21 | end if | ||
| 22 | end tell | ||
| 23 | |||
| 24 | return "{ \"browser\": \"" & browser & "\", \"title\": \"" & replace_chars(title_string, "\"", "Ò") & "\" }" | ||
