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 device to do shell script "networksetup -listallhardwareports | awk '$3==\"Wi-Fi\" {getline;print}' | awk '{print $2}'" | |
set power to do shell script "networksetup -getairportpower " & device & " | awk '{print $4}'" | |
if power is equal to "on" then | |
set power to "off" | |
else | |
set power to "on" | |
end if | |
do shell script ("networksetup -setairportpower " & device & " " & power) |
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 "QuickTime Player" | |
set check to name of every window | |
if check is {} then | |
set resultDocument to new screen recording | |
tell resultDocument | |
delay 1 | |
start | |
end tell | |
else | |
set resultDocument to first document whose name is "Screen Recording" |
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 "Script Debugger" | |
tell front document | |
set sourceText to source text | |
set thename to name | |
end tell | |
set d to make new document with properties {source text:sourceText} | |
tell d | |
compile | |
end tell | |
end tell |
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 "System Events" to tell process "SystemUIServer" | |
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1 | |
click bt | |
tell menu of bt | |
if exists menu item "Turn Bluetooth On" then | |
click menu item "Turn Bluetooth On" | |
else if menu item "Turn Bluetooth Off" exists then | |
click menu item "Turn Bluetooth Off" | |
else | |
key code 53 --escape |
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 run | |
set strLinkHTML to "" | |
tell application "Safari" | |
tell front window | |
tell current tab | |
set strNameTabUrl to URL | |
set lstNameTab to name | |
end tell | |
end tell |
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 "Finder" | |
set myWin to window 1 | |
set theWin to (quoted form of POSIX path of (target of myWin as alias)) | |
end tell | |
tell application "iTerm" | |
set w to create window with profile "Default" | |
tell w's current session to write text "cd " & theWin & " && clear" | |
end tell |
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
-- Note: This works in all the apps I’ve tried it in, so there may be others it doesn't | |
tell application "System Events" to set frontapp to name of first process whose frontmost is true | |
tell application frontapp | |
activate | |
repeat with i from (count of documents) to 1 by -1 | |
set thisDocument to document i | |
try | |
if path of (get properties of thisDocument) = missing value or name of thisDocument contains "Untitled" then |
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 "System Events" to set frontapp to name of first process whose frontmost is true | |
tell application frontapp to close every document with saving |
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 "System Events" to set frontapp to name of first process whose frontmost is true | |
tell application frontapp to close every document without saving |
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 "System Events" to set frontapp to name of first process whose frontmost is true | |
tell application frontapp | |
tell front document | |
close saving yes | |
end tell | |
end tell |
OlderNewer