text
stringlengths
0
15.7k
source
stringlengths
6
112
repeat while (frontmostProcess is frontmost)
last_in_front.applescript
set secondFrontmost to name of first process where it is frontmost
last_in_front.applescript
set frontmost of frontmostProcess to true
last_in_front.applescript
if "Finder" is in secondFrontmost then
last_in_front.applescript
display dialog ("Finder was last in front")
last_in_front.applescript
display dialog (secondFrontmost & " was last in front")
last_in_front.applescript
tell application "Notes" to get note "geeknotes"
notes.applescript
set output to "No current note called geeknotes"
notes.applescript
tell application "Notes" to get folder "geeknotes"
notes.applescript
set notelist to every note of result
notes.applescript
repeat with i from 1 to number of items in notelist
notes.applescript
set this_note to item i of notelist
notes.applescript
set output to number of items in notelist
notes.applescript
set output to "No current folder called geeknotes"
notes.applescript
set sPBStatus to "TBD" -- Will be set to "Cancel" if User Cancels. Otherwise set to "OK"
ASObjC%20Progress%20Bar%20AS.scpt
set sPBTitle to "ASObjC Runner Progress Bar" -- Window Title
ASObjC%20Progress%20Bar%20AS.scpt
set sPBMsg to "DEMO Progress Bar by ASObjC Runner" -- Msg ABOVE progress bar
ASObjC%20Progress%20Bar%20AS.scpt
set iStart to 1
ASObjC%20Progress%20Bar%20AS.scpt
set iEnd to 100
ASObjC%20Progress%20Bar%20AS.scpt
my initProgressBar(sPBTitle, sPBMsg, iEnd, 0)
ASObjC%20Progress%20Bar%20AS.scpt
repeat with iCurrent from iStart to iEnd
ASObjC%20Progress%20Bar%20AS.scpt
set sPBStatus to my updateProgressBar(iCurrent, iEnd)
ASObjC%20Progress%20Bar%20AS.scpt
if (sPBStatus = "Cancel") then
ASObjC%20Progress%20Bar%20AS.scpt
delay 0.1 -- for demo only, not needed in production use
ASObjC%20Progress%20Bar%20AS.scpt
my closeProgressBar()
ASObjC%20Progress%20Bar%20AS.scpt
display notification ("User CANCELED process") with title sPBTitle
ASObjC%20Progress%20Bar%20AS.scpt
display notification ("Process SUCCESSFULLY Completed") with title sPBTitle
ASObjC%20Progress%20Bar%20AS.scpt
end if -- User Canceled
ASObjC%20Progress%20Bar%20AS.scpt
on initProgressBar(psTitle, psMsg, piMax, piCurrent)
ASObjC%20Progress%20Bar%20AS.scpt
tell application "ASObjC Runner"
ASObjC%20Progress%20Bar%20AS.scpt
reset progress
ASObjC%20Progress%20Bar%20AS.scpt
set properties of progress window to ¬
ASObjC%20Progress%20Bar%20AS.scpt
{button title:"Cancel", button visible:true, name:psTitle, message:psMsg, detail:"", indeterminate:false, max value:piMax, current value:piCurrent}
ASObjC%20Progress%20Bar%20AS.scpt
show progress
ASObjC%20Progress%20Bar%20AS.scpt
end initProgressBar
ASObjC%20Progress%20Bar%20AS.scpt
on updateProgressBar(piCurrent, piMax)
ASObjC%20Progress%20Bar%20AS.scpt
{detail:"This is number " & piCurrent & " of " & piMax, current value:piCurrent}
ASObjC%20Progress%20Bar%20AS.scpt
if button was pressed of progress window then
ASObjC%20Progress%20Bar%20AS.scpt
return "Cancel"
ASObjC%20Progress%20Bar%20AS.scpt
return "OK"
ASObjC%20Progress%20Bar%20AS.scpt
end updateProgressBar
ASObjC%20Progress%20Bar%20AS.scpt
on closeProgressBar()
ASObjC%20Progress%20Bar%20AS.scpt
tell application "ASObjC Runner" to hide progress
ASObjC%20Progress%20Bar%20AS.scpt
end closeProgressBar
ASObjC%20Progress%20Bar%20AS.scpt
return (name of processes) contains (app_name)
is_app_running.applescript
set requestedFolder to text returned of (display dialog "Which folder of Notes would you like to export? (the name must match exactly)" default answer "" with icon note buttons {"Export"} default button "Export")
export-apple-notes-by-folder.scpt
display dialog "Choose where the exported notes should be saved:" with icon note buttons {"Choose Folder"} default button "Choose Folder"
export-apple-notes-by-folder.scpt
set exportFolder to (choose folder) as string
export-apple-notes-by-folder.scpt
on noteNameToFilePath(noteName)
export-apple-notes-by-folder.scpt
global exportFolder
export-apple-notes-by-folder.scpt
set strLength to the length of noteName
export-apple-notes-by-folder.scpt
if strLength > 250 then
export-apple-notes-by-folder.scpt
set noteName to text 1 thru 250 of noteName
export-apple-notes-by-folder.scpt
set fileName to (exportFolder & replaceText(":", "_", noteName) & ".html")
export-apple-notes-by-folder.scpt
end noteNameToFilePath
export-apple-notes-by-folder.scpt
repeat with theFolder in folders of default account
export-apple-notes-by-folder.scpt
if name of theFolder = requestedFolder then
export-apple-notes-by-folder.scpt
repeat with theNote in every note of theFolder
export-apple-notes-by-folder.scpt
set filepath to noteNameToFilePath(name of theNote as string) of me
export-apple-notes-by-folder.scpt
set noteFile to open for access filepath with write permission
export-apple-notes-by-folder.scpt
write theText to noteFile as «class utf8»
export-apple-notes-by-folder.scpt
close access noteFile
export-apple-notes-by-folder.scpt
set modification date of file (filepath) to modDate
export-apple-notes-by-folder.scpt
tell inbox
Mark-All-Inbox-Messages-as-Read.applescript
set ms to every message whose read status is false
Mark-All-Inbox-Messages-as-Read.applescript
repeat with m in ms
Mark-All-Inbox-Messages-as-Read.applescript
set read status to true
Mark-All-Inbox-Messages-as-Read.applescript
set jsCode to "console.log('Apple Script'); " -- None the whitespace at the end. That is required.
Run Javascript example.applescript
repeat with appleNote in theMessages
MigrateNotesToEvernote.applescript
set appleNoteTitle to the name of appleNote
MigrateNotesToEvernote.applescript
set appleNoteBody to the body of appleNote
MigrateNotesToEvernote.applescript
set appleNoteCreation to the creation date of appleNote
MigrateNotesToEvernote.applescript
set appleNoteModification to the modification date of appleNote
MigrateNotesToEvernote.applescript
set thisItem to appleNote
MigrateNotesToEvernote.applescript
set appleNoteAccount to null
MigrateNotesToEvernote.applescript
set appleNoteFolder to null
MigrateNotesToEvernote.applescript
set thisContainer to the container of thisItem
MigrateNotesToEvernote.applescript
if (the class of thisContainer) is folder then
MigrateNotesToEvernote.applescript
set appleNoteFolder to name of thisContainer
MigrateNotesToEvernote.applescript
else if (the class of thisContainer) is account then
MigrateNotesToEvernote.applescript
set appleNoteAccount to name of thisContainer
MigrateNotesToEvernote.applescript
if appleNoteFolder is not null and appleNoteAccount is not null then
MigrateNotesToEvernote.applescript
set thisItem to thisContainer
MigrateNotesToEvernote.applescript
set evernoteNote to create note with html appleNoteBody title appleNoteTitle notebook appleNoteFolder tags appleNoteAccount
MigrateNotesToEvernote.applescript
set the creation date of evernoteNote to appleNoteCreation
MigrateNotesToEvernote.applescript
set the modification date of evernoteNote to appleNoteModification
MigrateNotesToEvernote.applescript
global std, textUtil, retryLib, cliclick, clip, kb
1password.applescript
property initCategory : false
1password.applescript
property waitOtpThreshold : 3 -- 2 is too short, failed January 6, 2021
1password.applescript
set thisCaseId to "1password-spotCheck"
1password.applescript
Manual: Unlocked (yes, no)
1password.applescript
Manual: Retrieve a password
1password.applescript
Retrieve a password via mini - Manual (Takes 1s vs 3s for the standard.)
1password.applescript
Retrieve an OTP via mini
1password.applescript
set spotCredKey to "AppleScript Core"
1password.applescript
logger's infof("Unlocked: {}", sut's isUnlocked())
1password.applescript
set unlocked to sut's waitToUnlock()
1password.applescript
if unlocked then
1password.applescript
sut's selectCategory("Logins")
1password.applescript
logger's infof("U: {}, P: {}", sut's doGetUsernameAndPassword(spotCredKey))
1password.applescript