text
stringlengths
0
15.7k
source
stringlengths
6
112
on run {powerHungryApps}
PowerSave.applescript
set d to text item delimiters
PowerSave.applescript
set text item delimiters to "/"
PowerSave.applescript
set workingDir to (POSIX path of (path to me))'s text 1 thru text item -2 & "/"
PowerSave.applescript
set text item delimiters to d
PowerSave.applescript
set toggleFile to workingDir & ".powerSaveOn"
PowerSave.applescript
set testCmd to "if test -e " & toggleFile & "; then echo off; else echo on; fi"
PowerSave.applescript
set powerMode to do shell script testCmd
PowerSave.applescript
if (powerMode is "on") then
PowerSave.applescript
do shell script "touch " & toggleFile
PowerSave.applescript
set checkBoxVal to 1
PowerSave.applescript
set brightness to 0.06
PowerSave.applescript
set airPortCheck to "On"
PowerSave.applescript
set newAirPortState to "off"
PowerSave.applescript
else if (powerMode is "off") then
PowerSave.applescript
do shell script "rm " & toggleFile
PowerSave.applescript
set checkBoxVal to 0
PowerSave.applescript
set brightness to 1
PowerSave.applescript
set airPortCheck to "Off"
PowerSave.applescript
set newAirPortState to "on"
PowerSave.applescript
end if
PowerSave.applescript
activate application "System Preferences"
PowerSave.applescript
tell application "System Events"
PowerSave.applescript
tell process "System Preferences"
PowerSave.applescript
set frontmost to true
PowerSave.applescript
click menu item "Bluetooth" of menu 1 of menu bar item "View" of menu bar 1
PowerSave.applescript
delay 2
PowerSave.applescript
try
PowerSave.applescript
click button "Turn Bluetooth Off" of window "Bluetooth"
PowerSave.applescript
end try
PowerSave.applescript
else
PowerSave.applescript
click button "Turn Bluetooth On" of window "Bluetooth"
PowerSave.applescript
click menu item "Keyboard" of menu "View" of menu bar 1
PowerSave.applescript
click radio button "Keyboard" of tab group 1 of window "Keyboard"
PowerSave.applescript
delay 1
PowerSave.applescript
if (value of checkbox "Adjust keyboard brightness in low light" of tab group 1 of window "Keyboard" is checkBoxVal) then
PowerSave.applescript
click checkbox "Adjust keyboard brightness in low light" of tab group 1 of window "Keyboard"
PowerSave.applescript
try --use try here because this part will fail if there are other monitors connected
PowerSave.applescript
click menu item "Displays" of menu "View" of menu bar 1
PowerSave.applescript
if (value of checkbox "Automatically adjust brightness" of group 1 of tab group 1 of window "Built-in Display" is checkBoxVal) then
PowerSave.applescript
click checkbox "Automatically adjust brightness" of group 1 of tab group 1 of window "Built-in Display"
PowerSave.applescript
set value of slider 1 of group 1 of tab group 1 of window "Built-in Display" to brightness
PowerSave.applescript
end tell
PowerSave.applescript
tell application "System Preferences" to quit
PowerSave.applescript
set devName to do shell script "networksetup -listallhardwareports | grep -A1 \"Wi-Fi\" | awk '{ if ($1 == \"Device:\") print $2 }'"
PowerSave.applescript
set airportPower to do shell script "networksetup -getairportpower " & devName & " | awk '{print $4}'"
PowerSave.applescript
if (airportPower is airPortCheck) then
PowerSave.applescript
do shell script "networksetup -setairportpower " & devName & " " & newAirPortState
PowerSave.applescript
repeat with appName in powerHungryApps
PowerSave.applescript
tell application appName to quit
PowerSave.applescript
activate application appName
PowerSave.applescript
end repeat
PowerSave.applescript
if (powerMode is "off") then
PowerSave.applescript
tell application "Finder"
PowerSave.applescript
set visible of process appName to false
PowerSave.applescript
end run
PowerSave.applescript
tell application "System Events" to tell process "SystemUIServer"
disconnect airpods.scpt
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
disconnect airpods.scpt
click bt
disconnect airpods.scpt
tell (first menu item whose title is "Sing’s AirPods II") of menu of bt
disconnect airpods.scpt
click
disconnect airpods.scpt
tell menu 1
disconnect airpods.scpt
if exists menu item "Disconnect" then
disconnect airpods.scpt
click menu item "Disconnect"
disconnect airpods.scpt
property mode : "start"
Defer Until Today.scpt
property showSummaryNotification : false --if true, will display success notifications
Defer Until Today.scpt
property useGrowl : true --if true, will use Growl for success/failure alerts
Defer Until Today.scpt
property startTime : 6 --Start hour for items not previously assigned a start time (24 hr clock)
Defer Until Today.scpt
property dueTime : 17 --Due hour for items not previously assigned a due time (24 hr clock)
Defer Until Today.scpt
property alertItemNum : ""
Defer Until Today.scpt
property alertDayNum : ""
Defer Until Today.scpt
property growlAppName : "Dan's Scripts"
Defer Until Today.scpt
property allNotifications : {"General", "Error"}
Defer Until Today.scpt
property enabledNotifications : {"General", "Error"}
Defer Until Today.scpt
property iconApplication : "OmniFocus.app"
Defer Until Today.scpt
on main()
Defer Until Today.scpt
tell application "OmniFocus"
Defer Until Today.scpt
tell content of first document window of front document
Defer Until Today.scpt
set totalMinutes to 0
Defer Until Today.scpt
set validSelectedItemsList to value of (selected trees where class of its value is not item and class of its value is not folder)
Defer Until Today.scpt
set totalItems to count of validSelectedItemsList
Defer Until Today.scpt
if totalItems is 0 then
Defer Until Today.scpt
set alertName to "Error"
Defer Until Today.scpt
set alertTitle to "Script failure"
Defer Until Today.scpt
set alertText to "No valid task(s) selected"
Defer Until Today.scpt
my notify(alertName, alertTitle, alertText)
Defer Until Today.scpt
return
Defer Until Today.scpt
set successTot to 0
Defer Until Today.scpt
set autosave to false
Defer Until Today.scpt
set currDate to (current date) - (time of (current date))
Defer Until Today.scpt
if mode is "start" then
Defer Until Today.scpt
repeat with thisItem in validSelectedItemsList
Defer Until Today.scpt
set succeeded to my startToday(thisItem, currDate)
Defer Until Today.scpt
if succeeded then set successTot to successTot + 1
Defer Until Today.scpt
else if mode is "due" then
Defer Until Today.scpt
set succeeded to my dueToday(thisItem, currDate)
Defer Until Today.scpt
set alertText to "Improper mode setting"
Defer Until Today.scpt
set autosave to true
Defer Until Today.scpt
if showSummaryNotification then
Defer Until Today.scpt
set alertName to "General"
Defer Until Today.scpt

Dataset Card for "applescript-lines-100k-non-annotated"

Description

Dataset of 100,000 unique lines of AppleScript code scraped from GitHub and GitHub Gists. The dataset has been de-duplicated, comments have been removed (both single and multi-line), and effort has been made to merge multi-line structures such as records into one (however, expect some variability in this regard).

The dataset is constructed as an intermediate step to a fully-annotated AppleScript dataset.

Each row has fields for text and source, with text being the raw text of the line and source being the file name and extension from which the line was obtained. Full source links have been omitted for anonymity.

Downloads last month
58