This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on SafariTabsWhoseURLsContain:(phrase as text) | |
set text item delimiters to linefeed | |
tell application id "com.apple.Safari" to if it ¬ | |
is running then tell every window to if ¬ | |
it exists then tell (it where (index of ¬ | |
tab 1 where phrase is in the URL) is in ¬ | |
index of tabs) to tell (every tab whose ¬ | |
URL contains the phrase) to if (exists) ¬ | |
then return a reference to it | |
end SafariTabsWhoseURLsContain: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property home : system attribute "HOME" | |
property file : home & "/.chrometabs" | |
on storeURLs() | |
close access (open for access my file) | |
tell application id "com.google.chrome" to ¬ | |
set URLs to every window's tabs's URL | |
write the URLs to my file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to open location www | |
--OR: application id "com.google.Chrome" | |
tell application id "com.brave.Browser" to tell windows to tell (it ¬ | |
where integer 1 in ((tab 1's id where www is in URL) & 0) ¬ | |
is in the id of every tab) & false to tell the first item | |
if it = false then return continue open location www | |
set i to character id (id of tab 1 where www is in URL) | |
set t to character id (id of tabs) | |
set the active tab index to the offset of i in t | |
activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application id "com.apple.systemevents" to tell (the first process ¬ | |
where it is frontmost) to tell (a reference to the front window) ¬ | |
to if it exists then tell its attribute "AXDocument"'s value to ¬ | |
if it is not in [missing value, "file:///Irrelevent"] then ¬ | |
return my (POSIXPathOfFolder for it) | |
false | |
on POSIXPathOfFolder for (fileURL as text) | |
local fileURL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use framework "Foundation" | |
use framework "AppKit" | |
use scripting additions | |
property this : a reference to the current application | |
property nil : a reference to missing value | |
property _1 : a reference to reference | |
property NSWorkspace : a reference to NSWorkspace of this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fp to "~/Library/Preferences/com.apple.ScriptEditor2.plist" | |
tell application id "com.apple.SystemEvents" to tell the ¬ | |
property list file fp to make new property list item ¬ | |
with properties {name:"ScriptWindowState", value:¬ | |
{selectedTab:"log"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjC.import('stdlib'); | |
ObjC.import('Foundation'); | |
__NSString__ = $.NSString.stringWithString.bind($.NSString); | |
ObjC.bindFunction('objc_copyClassList', ['void**', ['int']]); | |
ObjC.bindFunction('class_getName', ['char *', ['void*']]); | |
ObjC.bindFunction('class_getSuperclass', ['void*', ['void*']]); | |
ObjC.bindFunction('class_isMetaClass', ['bool *', ['void*']]); | |
i = 0; // Counter variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use application "System Events" | |
property process : a reference to (first process whose frontmost = true) | |
property window : a reference to front window of my process | |
property display : a reference to scroll area 1 of process "Finder" | |
if not (my window exists) then return | |
set [width, height] to size of my window | |
set [screenX, screenY] to size of my display |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property dir : path to applications folder | |
use Finder : application id "com.apple.Finder" | |
property contents : a reference to (folder dir)'s entire contents | |
property list : a reference to application files in its contents | |
script | |
property parent : my list | |
property id : my id | |
property key : my has scripting terminology |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--OR: tell app id "com.google.Chrome" | |
tell application id "com.brave.browser" to if it is ¬ | |
running then tell every window to if (exists) ¬ | |
then close (the tabs whose id ≠ my window 1's ¬ | |
active tab's id) |
NewerOlder