text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set volume input volume inputVolume
|
mic-control.applescript
|
set nW to 0
|
close.applescript
|
set isQuit to -1
|
close.applescript
|
set alwaysQuit to {"cooViewer"}
|
close.applescript
|
set alwaysClose to {"Mail", "Skype", "Finder", "X11.bin", "Evernote", "Slack"}
|
close.applescript
|
set useApplication to {"Microsoft Word", "Microsoft Excel", "EverNote"}
|
close.applescript
|
set useDocument to {}
|
close.applescript
|
if debug > 0 then
|
close.applescript
|
display dialog "debug mode = " & debug
|
close.applescript
|
else if appName is in useApplication then
|
close.applescript
|
set isQuit to 2
|
close.applescript
|
else if appName is in useDocument then
|
close.applescript
|
set isQuit to 3
|
close.applescript
|
if isQuit is 2 or isQuit is 3 then
|
close.applescript
|
if isQuit is 2 then
|
close.applescript
|
display dialog "get number of windows in application"
|
close.applescript
|
repeat with i from 1 to nW
|
close.applescript
|
get properties of window i
|
close.applescript
|
display dialog "get number of documents in application"
|
close.applescript
|
display dialog appName & ", nDocuments=" & nW
|
close.applescript
|
if isQuit is -1 then
|
close.applescript
|
get properties of w
|
close.applescript
|
display dialog "get number of windows in process"
|
close.applescript
|
if isQuit is 0 then
|
close.applescript
|
if s is "AXCloseButton" then
|
close.applescript
|
display dialog "quit"
|
close.applescript
|
display dialog "quit, ok"
|
close.applescript
|
-- Use GUI Scripting to click on Edit -> Copy in Preview's menu bar
|
Script 23-7.applescript
|
tell application process "Preview"
|
Script 23-7.applescript
|
set pdf_data to the clipboard as «class PDF »
|
Script 23-7.applescript
|
on error number -1700 -- The clipboard doesn't contain any PDF data
|
Script 23-7.applescript
|
display alert "Please make a marquee selection " & "in a PDF document in Preview, then try again." as warning
|
Script 23-7.applescript
|
set destination_file to choose file name default name "cutting.pdf"
|
Script 23-7.applescript
|
set file_ID to open for access destination_file with write permission
|
Script 23-7.applescript
|
write pdf_data to file_ID as «class PDF »
|
Script 23-7.applescript
|
set file type of file destination_file to "PDF "
|
Script 23-7.applescript
|
tell application "Preview" to open destination_file
|
Script 23-7.applescript
|
on getKeychain(keychainItemName)
|
Get-Keychain-Access-Passwords.applescript
|
if result is not "SecKeychainSearchCopyNext:" then
|
Get-Keychain-Access-Passwords.applescript
|
return (text 2 thru -2 of result)
|
Get-Keychain-Access-Passwords.applescript
|
display alert ("No " & keychainItemName & " keychain found!") ¬
|
Get-Keychain-Access-Passwords.applescript
|
message ("Press OK to set up a " & keychainItemName & " keychain, this is a one time step.") as critical ¬
|
Get-Keychain-Access-Passwords.applescript
|
cancel button "Cancel"
|
Get-Keychain-Access-Passwords.applescript
|
tell application "Keychain Access" to activate
|
Get-Keychain-Access-Passwords.applescript
|
tell process "Keychain Access"
|
Get-Keychain-Access-Passwords.applescript
|
set accountName to short user name of (system info)
|
Get-Keychain-Access-Passwords.applescript
|
set the clipboard to keychainItemName
|
Get-Keychain-Access-Passwords.applescript
|
set the clipboard to accountName
|
Get-Keychain-Access-Passwords.applescript
|
display alert ("Almost Done") ¬
|
Get-Keychain-Access-Passwords.applescript
|
message ("Type in your " & keychainItemName & " password into the password field and click Add. Once it's saved run the script again.") as critical ¬
|
Get-Keychain-Access-Passwords.applescript
|
end getKeychain
|
Get-Keychain-Access-Passwords.applescript
|
tell application "GraphicConverter 11"
|
Crop JPEG.applescript
|
set fname to (the file of window 1)
|
Crop JPEG.applescript
|
display alert "No file?" message "There doesn't appear to be a window open." giving up after 30
|
Crop JPEG.applescript
|
tell application "Finder" to set ext to the name extension of file fname
|
Crop JPEG.applescript
|
if ext is not in {"jpg", "JPG", "jpeg", "JPEG"} then
|
Crop JPEG.applescript
|
display alert "Not JPEG" message "The file needs to be a jpeg for this script to work."
|
Crop JPEG.applescript
|
set thePath to POSIX path of fname
|
Crop JPEG.applescript
|
set {xleft, ybottom, xright, ytop} to the selection
|
Crop JPEG.applescript
|
set {imgW, imgH} to image dimension
|
Crop JPEG.applescript
|
display alert "Problem" message "Is there anything selected?" giving up after 30
|
Crop JPEG.applescript
|
set w to xright - xleft
|
Crop JPEG.applescript
|
set h to ytop - ybottom
|
Crop JPEG.applescript
|
set y1 to imgH - ytop
|
Crop JPEG.applescript
|
set cropDims to (w & "x" & h & "+" & xleft & "+" & y1) as string
|
Crop JPEG.applescript
|
set newpath to (do shell script "dirname " & quoted form of thePath) & "/" & dateString & "_" & name of window 1
|
Crop JPEG.applescript
|
do shell script ("/opt/homebrew/bin/jpegtran -crop " & cropDims & " -outfile " & quoted form of newpath & " " & quoted form of thePath)
|
Crop JPEG.applescript
|
do shell script ("qlmanage -p " & quoted form of newpath)
|
Crop JPEG.applescript
|
repeat with img in sel
|
ProcessPhotoDupeV2.applescript
|
set theFileName to filename of img
|
ProcessPhotoDupeV2.applescript
|
if (theFileName) does not contain "HEIC" then
|
ProcessPhotoDupeV2.applescript
|
log "skipping photo " & theFileName
|
ProcessPhotoDupeV2.applescript
|
set fileStem to (characters 1 through 8 of theFileName as string)
|
ProcessPhotoDupeV2.applescript
|
if (count of results) is 1 then
|
ProcessPhotoDupeV2.applescript
|
log ("single: removing keyword from single photo " & theFileName)
|
ProcessPhotoDupeV2.applescript
|
my RemoveDupeKeyword(img)
|
ProcessPhotoDupeV2.applescript
|
else if (count of results) is 2 then
|
ProcessPhotoDupeV2.applescript
|
log "count is 2 for " & fileStem
|
ProcessPhotoDupeV2.applescript
|
set timeDiff to (my CompareDateWithinXSeconds(date of item 1 of results, date of item 2 of results, 3))
|
ProcessPhotoDupeV2.applescript
|
log "time diff: " & timeDiff
|
ProcessPhotoDupeV2.applescript
|
if timeDiff = 0 then
|
ProcessPhotoDupeV2.applescript
|
my OnlyJPGAreDupes(item 1 of results)
|
ProcessPhotoDupeV2.applescript
|
my OnlyJPGAreDupes(item 2 of results)
|
ProcessPhotoDupeV2.applescript
|
log "photos times don't match!"
|
ProcessPhotoDupeV2.applescript
|
log "Too man found! Count is " & (count of results) & " for " & fileStem
|
ProcessPhotoDupeV2.applescript
|
on OnlyJPGAreDupes(img)
|
ProcessPhotoDupeV2.applescript
|
if (filename of img) contains "JPG" then
|
ProcessPhotoDupeV2.applescript
|
log (" adding keyword to photo " & filename of img)
|
ProcessPhotoDupeV2.applescript
|
my AddKeyword(img, "Duplicate?")
|
ProcessPhotoDupeV2.applescript
|
if (filename of img) contains "HEIC" then
|
ProcessPhotoDupeV2.applescript
|
log (" removing keyword from photo " & filename of img)
|
ProcessPhotoDupeV2.applescript
|
end OnlyJPGAreDupes
|
ProcessPhotoDupeV2.applescript
|
on RemoveDupeKeyword(img)
|
ProcessPhotoDupeV2.applescript
|
set keyWordToRemove to "Duplicate?"
|
ProcessPhotoDupeV2.applescript
|
set theKeywords to keywords of img
|
ProcessPhotoDupeV2.applescript
|
set theNewKeywords to {}
|
ProcessPhotoDupeV2.applescript
|
if theKeywords is not missing value then
|
ProcessPhotoDupeV2.applescript
|
repeat with k in theKeywords
|
ProcessPhotoDupeV2.applescript
|
if (k as string) is not keyWordToRemove then
|
ProcessPhotoDupeV2.applescript
|
set theNewKeywords to theNewKeywords & k
|
ProcessPhotoDupeV2.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.