text
stringlengths
0
15.7k
source
stringlengths
6
112
close windows
OpenBraveIncognito.applescript
make new window with properties {mode:"incognito"}
OpenBraveIncognito.applescript
tell application "System Events" to keystroke "f" using {control down, command down}
OpenBraveIncognito.applescript
display dialog "Hello World!"
hello copy 3.applescript
property scriptName : "Set group icon to parent icon"
Set group icon to parent icon.applescript
repeat with rec in (selected records)
Set group icon to parent icon.applescript
set recType to (type of rec) as string
Set group icon to parent icon.applescript
if recType is in {"group", "«constant ****DTgr»", ¬ "smart group", "«constant ****DTsg»"} then
Set group icon to parent icon.applescript
set locGroup to location group of rec
Set group icon to parent icon.applescript
set thumbnail of rec to thumbnail of locGroup
Set group icon to parent icon.applescript
set recName to name of rec
Set group icon to parent icon.applescript
log message "[" & scriptName & "] " & ¬
Set group icon to parent icon.applescript
"Icon not changed because item is not a group: " ¬
Set group icon to parent icon.applescript
& recName
Set group icon to parent icon.applescript
set nameList to the name of every window
01-window-list.applescript
log "?? list " &linefeed & nameList
01-window-list.applescript
set firstWindow to the name of window 1
01-window-list.applescript
log "The first ?? is " & firstWindow
01-window-list.applescript
my lockscrn()
LockScreen.scpt
on lockscrn()
LockScreen.scpt
set bundle to current application's NSBundle's bundleWithPath:"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu/"
LockScreen.scpt
bundle's load
LockScreen.scpt
set aClass to bundle's classNamed:"AppleKeychainExtra"
LockScreen.scpt
set aObj to aClass's alloc
LockScreen.scpt
set aKeyChain to aObj's init
LockScreen.scpt
aKeyChain's performSelector:"_lockScreenMenuHit:" withObject:(null) afterDelay:0.0
LockScreen.scpt
end lockscrn
LockScreen.scpt
set current_path to (POSIX path of (target of front window as alias))
Git Init Repo.applescript
set git_status to (do shell script "cd \"" & current_path & "\"; git init")
Git Init Repo.applescript
display dialog git_status buttons {"OK"} with title "Init Repo"
Git Init Repo.applescript
on error the_error
Git Init Repo.applescript
display dialog the_error buttons {"OK"} with icon caution with title "Error"
Git Init Repo.applescript
property _support : a reference to script "TypeSupport" -- used for parameter checking
lns3.scpt
to _error(handlerName, eText, eNumber, eFrom, eTo)
lns3.scpt
_support's throwCommandError("Web", handlerName, eText, eNumber, eFrom, eTo)
lns3.scpt
end _error
lns3.scpt
property _usesNetLoc : {"ftp", "http", "gopher", "nntp", "telnet", "imap", "wais", "file", "mms", "https", "shttp", "snews", "prospero", "rtsp", "rtspu", "rsync", "", "svn", "svn+ssh", "sftp", "nfs", "git", "git+ssh"}
lns3.scpt
to _asComponent(asocString)
lns3.scpt
if asocString is missing value then return ""
lns3.scpt
return asocString as text
lns3.scpt
end _asComponent
lns3.scpt
to _joinNetworkLocation(networkLocationRecord)
lns3.scpt
set fullNetLocRecord to _support's asOptionalRecordParameter(networkLocationRecord, {userName:"", userPassword:"", hostName:"", portNumber:""}, "")
lns3.scpt
set urlComponents to {userName, userPassword, hostName, portNumber} of fullNetLocRecord
lns3.scpt
repeat with aRef in urlComponents
lns3.scpt
set aRef's contents to aRef's contents as text
lns3.scpt
on error number -1700
lns3.scpt
error "Invalid network location record (‘" & (item ((length of urlComponents) + 1) of {"userName", "userPassword", "hostName", "portNumber"}) & "’ property is not text)." number -1703 from urlRecord
lns3.scpt
set {userName, userPassword, hostName, portNumber} to urlComponents
lns3.scpt
if userPassword is not "" then set userName to userName & ":" & userPassword
lns3.scpt
if userName is not "" then set userName to userName & "@"
lns3.scpt
if hostName is "" and not (userName is "" and portNumber is "") then error "Invalid network location record (missing ‘hostName’ property)." number -1703 from urlRecord
lns3.scpt
set hostName to userName & hostName
lns3.scpt
if portNumber is not "" then set hostName to hostName & ":" & portNumber
lns3.scpt
return hostName
lns3.scpt
end _joinNetworkLocation
lns3.scpt
to split URL urlText network location record splitNetworkLocation : (false)
lns3.scpt
set asocURL to _support's asNSURLParameter(urlText, "")
lns3.scpt
set networkLocation to {userName:_asComponent(asocURL's user()), userPassword:_asComponent(asocURL's password()), hostName:_asComponent(asocURL's host()), portNumber:_asComponent(asocURL's port())}
lns3.scpt
if not _support's asBooleanParameter(splitNetworkLocation, "network location record") then
lns3.scpt
set networkLocation to _joinNetworkLocation(networkLocation)
lns3.scpt
return {urlScheme:_asComponent(asocURL's scheme()), networkLocation:networkLocation, resourcePath:_asComponent(asocURL's path()), parameterString:_asComponent(asocURL's parameterString()), queryString:_asComponent(asocURL's query()), fragmentIdentifier:_asComponent(asocURL's fragment())}
lns3.scpt
on error eText number eNumber from eFrom to eTo
lns3.scpt
_error("split URL", eText, eNumber, eFrom, eTo)
lns3.scpt
end split URL
lns3.scpt
to join URL urlRecord using base URL baseURL : ("") -- TO DO: if baseURL is given, direct parameter should be either record or text
lns3.scpt
considering case, diacriticals, hyphens, punctuation and white space but ignoring numeric strings
lns3.scpt
if (count {urlRecord} each record) ≠ 0 then
lns3.scpt
set fullURLRecord to _support's asOptionalRecordParameter(urlRecord, {urlScheme:"", networkLocation:"", resourcePath:"", parameterString:"", queryString:"", fragmentIdentifier:""}, "")
lns3.scpt
set urlComponents to {urlScheme, resourcePath, parameterString, queryString, fragmentIdentifier} of fullURLRecord
lns3.scpt
_support's throwInvalidParameter(urlRecord, "", record, "URL components record’s ‘" & (item ((length of urlComponents) + 1) of {"urlScheme", "resourcePath", "parameterString", "queryString", "fragmentIdentifier"}) & "’ property is not text.")
lns3.scpt
set {urlScheme, resourcePath, parameterString, queryString, fragmentIdentifier} to urlComponents
lns3.scpt
if (count {fullURLRecord's networkLocation} each record) ≠ 0 then
lns3.scpt
set networkLocation to _joinNetworkLocation(fullURLRecord's networkLocation)
lns3.scpt
set networkLocation to fullURLRecord's networkLocation as text
lns3.scpt
_support's throwInvalidParameter(urlRecord, "", record, "URL components record’s ‘networkLocation’ property is not text.")
lns3.scpt
set resourcePath to encode URL characters resourcePath preserving "/" -- `split URL` (i.e. NSURL) automatically decodes % escapes in resource path, so automatically encode them here
lns3.scpt
if networkLocation is not "" or (urlScheme is not "" and urlScheme is in _usesNetLoc and resourcePath does not start with "//") then -- copied from Python's urllib.parse module
lns3.scpt
if resourcePath is not "" and resourcePath does not start with "/" then set resourcePath to "/" & resourcePath
lns3.scpt
set urlText to "//" & networkLocation & resourcePath
lns3.scpt
set urlText to resourcePath
lns3.scpt
if urlScheme is not "" then set urlText to urlScheme & ":" & urlText
lns3.scpt
if parameterString is not "" then set urlText to urlText & ";" & parameterString
lns3.scpt
if queryString is not "" then set urlText to urlText & "?" & queryString
lns3.scpt
if fragmentIdentifier is not "" then set urlText to urlText & "#" & fragmentIdentifier
lns3.scpt
else -- assume it's a relative URL string that's going to be joined to baseURL
lns3.scpt
set urlText to _support's asTextParameter(urlRecord, "")
lns3.scpt
if baseURL is not "" then
lns3.scpt
set baseURL to _support's asNSURLParameter(baseURL, "using base URL")
lns3.scpt
set asocURL to current application's NSURL's URLWithString:urlText relativeToURL:baseURL
lns3.scpt
if asocURL is missing value then error "Not a valid URL." number -1703 from urlText
lns3.scpt
set urlText to asocURL as text
lns3.scpt
return urlText
lns3.scpt
_error("join URL", eText, eNumber, eFrom, eTo)
lns3.scpt
end join URL
lns3.scpt
property _safeCharacters : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."
lns3.scpt
to _replaceText(theText, fromText, toText)
lns3.scpt
set AppleScript's text item delimiters to fromText
lns3.scpt
set theList to theText's text items
lns3.scpt
set AppleScript's text item delimiters to toText
lns3.scpt