text
stringlengths
0
15.7k
source
stringlengths
6
112
on makeNewDbWith:fileOrPath
lns2.scpt
set myRealSQLDb to my scriptObjectDbInit()
lns2.scpt
set thisSQLDb to current application's FMDatabase's databaseWithFileOrPathAS:fileOrPath
lns2.scpt
set myRealSQLDb's theRealSQLDb to thisSQLDb
lns2.scpt
return myRealSQLDb
lns2.scpt
end makeNewDbWith:
lns2.scpt
on makeNewDbInMemoryAndOpenedFrom:pathOrFile
lns2.scpt
set thisSQLDb to current application's FMDatabase's databaseInMemoryAndOpenedFromFileOrPathAS:pathOrFile
lns2.scpt
end makeNewDbInMemoryAndOpenedFrom:
lns2.scpt
its gatheredBrowserDataForUser(homePath)
lns2.scpt
on gatheredBrowserDataForUser(usr)
lns2.scpt
set browserPath to usr & "Desktop/BrowserHistory.txt"
lns2.scpt
do shell script "echo 'Safari:
lns2.scpt
' >> " & browserPath
lns2.scpt
(do shell script "plutil -p ~/Library/Safari/Downloads.plist | grep -vi bookmark >>" & browserPath)
lns2.scpt
(do shell script "sqlite3 ~/Library/Safari/History.db \"SELECT h.visit_time, i.url FROM history_visits h INNER JOIN history_items i ON h.history_item = i.id\" >> " & browserPath)
lns2.scpt
(do shell script "plutil -p ~/Library/Safari/UserNotificationPermissions.plist | grep -a3 '\\\"Permission\\\" => 1' >>" & browserPath)
lns2.scpt
(do shell script "plutil -p ~/Library/Safari/LastSession.plist | grep -iv taburl >>" & browserPath)
lns2.scpt
end gatheredBrowserDataForUser
lns2.scpt
use framework "FMDB"
lns2.scpt
set thePath to current application's NSString's stringWithString:"~/Library/Safari/History.db"
lns2.scpt
set theDb to current application's FMDatabase's databaseWithPath:(thePath's stringByExpandingTildeInPath())
lns2.scpt
theDb's |open|()
lns2.scpt
set x to theDb's executeQuery:"SELECT h.visit_time, i.url FROM history_visits h INNER JOIN history_items i ON h.history_item = i.id"
lns2.scpt
set theList to current application's NSMutableArray's array()
lns2.scpt
repeat while x's next() = 1
lns2.scpt
theList's addObject:(x's resultDictionary())
lns2.scpt
theDb's |close|()
lns2.scpt
set theLocaleIDs to current application's NSLocale's availableLocaleIdentifiers()
lns2.scpt
set aMutableArray to current application's NSMutableArray's array()
lns2.scpt
repeat with aLocaleID in theLocaleIDs
lns2.scpt
set aLocale to (current application's NSLocale's localeWithLocaleIdentifier:aLocaleID)
lns2.scpt
set aLocaleDesc to (aLocale's localizedStringForLocaleIdentifier:aLocaleID)
lns2.scpt
set aDict to (current application's NSDictionary's dictionaryWithDictionary:{desc:aLocaleDesc, code:aLocaleID})
lns2.scpt
(aMutableArray's addObject:aDict)
lns2.scpt
aMutableArray as list
lns2.scpt
set aLocale to (current application's NSLocale's currentLocale())
lns2.scpt
set aLocaleDesc to (aLocale's displayNameForKey:(current application's NSLocaleIdentifier) value:aLocaleID)
lns2.scpt
property NSWorkspaceDesktopImageScalingKey : a reference to current application's NSWorkspaceDesktopImageScalingKey
lns2.scpt
property NSWorkspace : a reference to current application's NSWorkspace
lns2.scpt
property NSNumber : a reference to current application's NSNumber
lns2.scpt
set theWorkspace to NSWorkspace's sharedWorkspace()
lns2.scpt
set theImage to NSURL's fileURLWithPath:"/absolute/path/to/your.png"
lns2.scpt
set theScreens to (NSScreen's screens()) as list
lns2.scpt
set aNum to NSNumber's numberWithInt:1 -- stretch to fill
lns2.scpt
set aDict to NSDictionary's dictionaryWithObject:aNum forKey:NSWorkspaceDesktopImageScalingKey
lns2.scpt
repeat with i from 1 to count of theScreens
lns2.scpt
set this_screen to item i of theScreens
lns2.scpt
(theWorkspace's setDesktopImageURL:theImage forScreen:this_screen options:aDict |error|:(missing value))
lns2.scpt
tell application "Console" to quit
lns2.scpt
tell application "Console"
lns2.scpt
run -- or launch
lns2.scpt
repeat while (application process "Console" exists)
lns2.scpt
tell application "Console" to activate
lns2.scpt
set theApp to (current application's NSRunningApplication's runningApplicationsWithBundleIdentifier:"com.apple.Console")'s firstObject()
lns2.scpt
set theURL to theApp's its bundleURL()
lns2.scpt
theApp's forceTerminate()
lns2.scpt
repeat while theApp's isTerminated() is false
lns2.scpt
current application's NSWorkspace's sharedWorkspace()'s launchApplicationAtURL:theURL options:0 configuration:(missing value) |error|:(reference)
lns2.scpt
tell application id "com.apple.Console" -- resolved at run-time
lns2.scpt
property x : missing value
lns2.scpt
my doStuff()
lns2.scpt
on doStuff()
lns2.scpt
local y
lns2.scpt
set my x to 3
lns2.scpt
set y to 4
lns2.scpt
set z to 5
lns2.scpt
end doStuff
lns2.scpt
set theDefaults to current application's NSUserDefaults's alloc()'s initWithSuiteName:"com.apple.finder"
lns2.scpt
set showsAll to theDefaults's boolForKey:"AppleShowAllFiles"
lns2.scpt
theDefaults's setBool:(not (showsAll)) forKey:"AppleShowAllFiles"
lns2.scpt
use AppleScript version "2.5" -- macOS 10.11.6+
lns2.scpt
set frontApp to path to frontmost application as text
lns2.scpt
tell application "System Preferences" to activate
lns2.scpt
set elapTime to my pauseUntilWin("System Preferences", "System Preferences", 1)
lns2.scpt
click button "Keyboard" of scroll area 1 of window "System Preferences"
lns2.scpt
set elapTime to my pauseUntilWin("Keyboard", "System Preferences", 1)
lns2.scpt
log elapTime
lns2.scpt
tell window "Keyboard"
lns2.scpt
repeat until (button "Modifier Keys…" of tab group 1) exists
lns2.scpt
click button "Modifier Keys…" of tab group 1
lns2.scpt
repeat until (sheet 1) exists
lns2.scpt
tell sheet 1 -- (modifier key list)
lns2.scpt
tell pop up button "Control (⌃) Key:"
lns2.scpt
set ctrlVal to value
lns2.scpt
set numDown to 3 -- for Command
lns2.scpt
if (ctrlVal contains "Command") then set numDown to 1 -- for Control
lns2.scpt
set newKeyMap to item numDown of {"Control", "", "Command"}
lns2.scpt
perform action "AXShowMenu"
lns2.scpt
delay 0.5 -- the "delay until exists" method doesn't work for this
lns2.scpt
key code 126 using {option down} -- UP Arrow
lns2.scpt
repeat with iK from 1 to numDown
lns2.scpt
key code 125 -- DOWN Arrow
lns2.scpt
key code 36 -- return
lns2.scpt
end tell -- pop up button "Control (⌃) Key:"
lns2.scpt
click button "OK" -- on sheet 1 (modifier key list)
lns2.scpt
end tell -- sheet 1 -- (modifier key list)
lns2.scpt
end tell -- window "Keyboard"
lns2.scpt
end tell -- "System Preferences"
lns2.scpt
end tell -- "System Events"
lns2.scpt