text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set theResult to do shell script "echo " & quoted form of theData & ¬ | clipboard.applescript |
" | sed -e 's/ //g'" | clipboard.applescript |
set the clipboard to theResult | clipboard.applescript |
on run (input) | clipboard.applescript |
set theResult to do shell script "echo " & quoted form of input & ¬ | clipboard.applescript |
do shell script "pbpaste" | clipboard.applescript |
set exchangeAccountDescription to "<exchange account>" -- By default you don't have to change this to your account name as the script will attempt to auto detect the primary account. However, if you have multiple accounts then you set this to the greyed out name of your Exchange Account in the main Outlook window holding all your folders (Inbox etc) | OutlookMac-Archive-ExchangeToLocal.applescript |
set runInSimulationMode to false -- when set to true no mail or calendar events will be archived. It will however create the appropriate folder structures under 'On My Computer' and the candidate items that will be archived will be logged to the events window for you to review. The script can be run repeatedly to test out the effect off different parameters below. You can also optionally delete the empty folders that were created from running in this mode if you want to re-run the simulation | OutlookMac-Archive-ExchangeToLocal.applescript |
set minutesBeforeTimeOut to 2 -- When first running this script against a very large mailbox (one user had 150 000 mails in one folder to archive, for example), it can take the script a long time to build the arrays necessary for calculating the items to be archived. By default AppleScript will timeout quite quickly if it feels an application is taking too long to respond. This timeout value overrides that to allow it handle the long processing times. You can make it longer if you still experience timeouts (CPU dependent). In extreme large cases an alterntive is to manually drag down mail to your archive and then allow the script to keep the archive up to date from there. | OutlookMac-Archive-ExchangeToLocal.applescript |
set processingDelay to 0.2 -- The number of milliseconds to wait between moving messages on Outlook. On slower machines Outlook can't handle the speed at which the script requests mail to be moved sometimes causing a lock-up. It also makes Outlook more responsive while running in the background. | OutlookMac-Archive-ExchangeToLocal.applescript |
set doNotArchiveCategoryName to "Do Not Archive" -- If you create an Outlook category that has this exact name (case sensitive) and assign that category to messages or calendar events the archiving process will skip those items indefinitely | OutlookMac-Archive-ExchangeToLocal.applescript |
set archiveMailItems to true -- no mail archiving will take place if set to false | OutlookMac-Archive-ExchangeToLocal.applescript |
set daysBeforeMailArchive to 80 -- number of days to keep mail in your exchange account before archiving | OutlookMac-Archive-ExchangeToLocal.applescript |
set localMailArchiveRootFolderName to "Archive Mail" -- name of the root archive mail folder to create under 'On My Computer'. If an existing archive mail folder is found it will use it, otherwise it will create the folder for you | OutlookMac-Archive-ExchangeToLocal.applescript |
set excludedMailFoldersList to {"Subscribed Public Folders", "Junk E-mail", "Deleted Items", "Sync Issues", "quarantine", "Conversation History"} -- list of mail folders in your exchange account to exclude (sub-folders will also be excluded). | OutlookMac-Archive-ExchangeToLocal.applescript |
set processSubFoldersofExcludedFolders to false -- By setting to true subfolders will be archived even though the parent folder is excluded for all excluded folders in above list (e.g. excluding your inbox but allowing it's sub-folders to be archived). Note that in this mode, folders with the repeated same name in your folder tree hierarchy will be all excluded if included in the excluded list. | OutlookMac-Archive-ExchangeToLocal.applescript |
set doNotArchiveInCompleteTodoItems to false -- If set to true then archiving will ignore all items that are marked with a todo flag but are not complete (including items with no due date which are by definition always incomplete) | OutlookMac-Archive-ExchangeToLocal.applescript |
set archiveCalendarItems to true -- no calendar archiving will take place if set to false | OutlookMac-Archive-ExchangeToLocal.applescript |
set localArchiveCalendarName to "Archive Calendar" -- name of the archive calendar to create under 'On My Computer'. If an existing calendar is found it will use it, otherwise it will create the calendar for you | OutlookMac-Archive-ExchangeToLocal.applescript |
set daysBeforeCalendarArchive to 730 -- number of days to keep non-recurring calendar events in your exchange account before archiving | OutlookMac-Archive-ExchangeToLocal.applescript |
set archiveReccuringEvents to false -- If you wish to also archive recurring events then set this to true. Warning: if a recurring event is moved to the archive it will remove the entire series from your calendar even if those recurrances are present today | OutlookMac-Archive-ExchangeToLocal.applescript |
if exchangeAccountDescription is "<exchange account>" then | OutlookMac-Archive-ExchangeToLocal.applescript |
set exchangeAccount to item 1 of exchange accounts | OutlookMac-Archive-ExchangeToLocal.applescript |
if exchange type of exchangeAccount is not primary account then | OutlookMac-Archive-ExchangeToLocal.applescript |
error "Please set an exchange account which is not delegated or another users folder account" | OutlookMac-Archive-ExchangeToLocal.applescript |
log ("Processing " & name of exchangeAccount as text) & " - the primary exchange account" | OutlookMac-Archive-ExchangeToLocal.applescript |
set exchangeAccount to exchange account exchangeAccountDescription | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Processing " & exchangeAccountDescription & " - the set exchange account" | OutlookMac-Archive-ExchangeToLocal.applescript |
log "==================== Mail ====================" | OutlookMac-Archive-ExchangeToLocal.applescript |
if archiveMailItems then | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Processing mail folders" | OutlookMac-Archive-ExchangeToLocal.applescript |
my archiveExchangeFolders(mail folders of exchangeAccount, excludedMailFoldersList, my createMailArchiveFolder(localMailArchiveRootFolderName, on my computer), daysBeforeMailArchive) | OutlookMac-Archive-ExchangeToLocal.applescript |
log "================== Calendar ===================" | OutlookMac-Archive-ExchangeToLocal.applescript |
if archiveCalendarItems then | OutlookMac-Archive-ExchangeToLocal.applescript |
set defaultExchangeCalendar to default calendar of exchangeAccount | OutlookMac-Archive-ExchangeToLocal.applescript |
log ("Processing " & name of exchangeAccount as text) & "'s primary calendar: " & (name of defaultExchangeCalendar as text) | OutlookMac-Archive-ExchangeToLocal.applescript |
my archiveCalendarEvents(defaultExchangeCalendar, my createLocalArchiveCalendar(localArchiveCalendarName), daysBeforeCalendarArchive) | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Done!" | OutlookMac-Archive-ExchangeToLocal.applescript |
on archiveExchangeFolders(exchangeFolders, excludedFolders, archiveRootFolder, daysBeforeArchive) | OutlookMac-Archive-ExchangeToLocal.applescript |
set earliestDate to ((current date) - (daysBeforeArchive * days)) | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Earliest Date - " & earliestDate | OutlookMac-Archive-ExchangeToLocal.applescript |
repeat with mailFolder in exchangeFolders | OutlookMac-Archive-ExchangeToLocal.applescript |
set mailFolderName to name of mailFolder as text | OutlookMac-Archive-ExchangeToLocal.applescript |
set mailFolderExcluded to (mailFolderName) is in excludedFolders | OutlookMac-Archive-ExchangeToLocal.applescript |
set subFoldersExist to my hasSubFolders(mailFolder) | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveFolder to "" | OutlookMac-Archive-ExchangeToLocal.applescript |
if not mailFolderExcluded or my processSubFoldersofExcludedFolders then | OutlookMac-Archive-ExchangeToLocal.applescript |
if subFoldersExist or not mailFolderExcluded then | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveFolder to my createMailArchiveFolder(mailFolderName, archiveRootFolder) | OutlookMac-Archive-ExchangeToLocal.applescript |
if not mailFolderExcluded then | OutlookMac-Archive-ExchangeToLocal.applescript |
my archiveMail(mailFolder, currentArchiveFolder, earliestDate) | OutlookMac-Archive-ExchangeToLocal.applescript |
if subFoldersExist then | OutlookMac-Archive-ExchangeToLocal.applescript |
log mailFolderName & " has sub-folders" | OutlookMac-Archive-ExchangeToLocal.applescript |
my archiveExchangeFolders(mail folders in mailFolder, excludedFolders, currentArchiveFolder, daysBeforeArchive) | OutlookMac-Archive-ExchangeToLocal.applescript |
log mailFolderName & " and sub-folders excluded" | OutlookMac-Archive-ExchangeToLocal.applescript |
end archiveExchangeFolders | OutlookMac-Archive-ExchangeToLocal.applescript |
on createMailArchiveFolder(mailFolderName, archiveRootFolder) | OutlookMac-Archive-ExchangeToLocal.applescript |
set foundItemList to every mail folder of archiveRootFolder where name is mailFolderName | OutlookMac-Archive-ExchangeToLocal.applescript |
if (count of foundItemList) is greater than 0 then | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Found existing folder " & mailFolderName | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveFolder to mail folder mailFolderName of archiveRootFolder | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Creating folder " & mailFolderName | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveFolder to make new mail folder in archiveRootFolder with properties {name:mailFolderName} | OutlookMac-Archive-ExchangeToLocal.applescript |
return currentArchiveFolder | OutlookMac-Archive-ExchangeToLocal.applescript |
end createMailArchiveFolder | OutlookMac-Archive-ExchangeToLocal.applescript |
on archiveMail(mailFolder, currentArchiveFolder, earliestDate) | OutlookMac-Archive-ExchangeToLocal.applescript |
with timeout of (my minutesBeforeTimeOut) * 60 seconds | OutlookMac-Archive-ExchangeToLocal.applescript |
set exchangeMessages to messages of mailFolder | OutlookMac-Archive-ExchangeToLocal.applescript |
repeat with theIncrementValue from 1 to count of exchangeMessages | OutlookMac-Archive-ExchangeToLocal.applescript |
set theMessage to item theIncrementValue of exchangeMessages | OutlookMac-Archive-ExchangeToLocal.applescript |
if time sent of theMessage is less than earliestDate then | OutlookMac-Archive-ExchangeToLocal.applescript |
if my excludedFromArchiving(theMessage) then | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Skipping mail marked for no archiving - " & (subject of theMessage as text) & " - " & (time sent of theMessage as text) | OutlookMac-Archive-ExchangeToLocal.applescript |
if todo flag of theMessage is not not flagged and todo flag of theMessage is not completed and my doNotArchiveInCompleteTodoItems is true then | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Skipping mail marked for todo but not complete - " & (subject of theMessage as text) & " - " & (time sent of theMessage as text) | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Archiving mail - " & (subject of theMessage as text) & " - " & (time sent of theMessage as text) | OutlookMac-Archive-ExchangeToLocal.applescript |
if not my runInSimulationMode then | OutlookMac-Archive-ExchangeToLocal.applescript |
set todo flag of theMessage to not flagged | OutlookMac-Archive-ExchangeToLocal.applescript |
move theMessage to currentArchiveFolder | OutlookMac-Archive-ExchangeToLocal.applescript |
delay my processingDelay | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Folder archive complete" | OutlookMac-Archive-ExchangeToLocal.applescript |
end archiveMail | OutlookMac-Archive-ExchangeToLocal.applescript |
on archiveCalendarEvents(exchangeCalendar, localArchiveCalendar, daysBeforeCalendarArchive) | OutlookMac-Archive-ExchangeToLocal.applescript |
set earliestDate to ((current date) - (daysBeforeCalendarArchive * days)) | OutlookMac-Archive-ExchangeToLocal.applescript |
repeat with calendarEvent in calendar events of exchangeCalendar | OutlookMac-Archive-ExchangeToLocal.applescript |
if end time of calendarEvent is less than earliestDate then | OutlookMac-Archive-ExchangeToLocal.applescript |
if is recurring of calendarEvent is false and is occurrence of calendarEvent is false or my archiveReccuringEvents is true then | OutlookMac-Archive-ExchangeToLocal.applescript |
if my excludedFromArchiving(calendarEvent) then | OutlookMac-Archive-ExchangeToLocal.applescript |
log ("Skipping event marked with no archiving - " & subject of calendarEvent as text) & " " & end time of calendarEvent as text | OutlookMac-Archive-ExchangeToLocal.applescript |
log ("Archiving event - " & subject of calendarEvent as text) & " " & end time of calendarEvent as text | OutlookMac-Archive-ExchangeToLocal.applescript |
move calendarEvent to localArchiveCalendar | OutlookMac-Archive-ExchangeToLocal.applescript |
log ("Skipping recurring event - " & subject of calendarEvent as text) & " " & end time of calendarEvent as text | OutlookMac-Archive-ExchangeToLocal.applescript |
end archiveCalendarEvents | OutlookMac-Archive-ExchangeToLocal.applescript |
on createLocalArchiveCalendar(calendarName) | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Number of local calendars: " & (count of calendars of on my computer) as text | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveCalendar to "" | OutlookMac-Archive-ExchangeToLocal.applescript |
set foundItemList to every calendar of on my computer where name is calendarName | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Found existing archive calendar: " & calendarName | OutlookMac-Archive-ExchangeToLocal.applescript |
set currentArchiveCalendar to calendar calendarName of on my computer | OutlookMac-Archive-ExchangeToLocal.applescript |
log "Creating new calendar: " & calendarName | OutlookMac-Archive-ExchangeToLocal.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.