From 39e2168a9a4cb7c2703bf0adef34cf642459d3cf Mon Sep 17 00:00:00 2001 From: Yudi Date: Wed, 18 Sep 2019 12:55:00 -0300 Subject: [PATCH] Updated Scheduling exports on macOS (markdown) --- Scheduling-exports-on-macOS.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Scheduling-exports-on-macOS.md b/Scheduling-exports-on-macOS.md index b4420d7..e96f21b 100644 --- a/Scheduling-exports-on-macOS.md +++ b/Scheduling-exports-on-macOS.md @@ -31,6 +31,7 @@ FILENAME= EXPORTDIRECTORY= EXPORTFORMAT= # Available export formats: PlainText, HtmlDark, HtmlLight, Csv +# /\ CaSe-SeNsItIvE /\ cd $EXEPATH || exit 1 @@ -46,14 +47,16 @@ CURRENTTIME=$(date +"%Y-%m-%d-%H-%M-%S") if [[ "$EXPORTFORMAT" == "PlainText" ]]; then mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt" -elif [[ "$EXPORTFORMAT" == "Html"* ]]; then +elif [[ "$EXPORTFORMAT" == "HtmlDark" ]] || [[ "$EXPORTFORMAT" == "HtmlLight" ]]; then mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html" elif [[ "$EXPORTFORMAT" == "Csv" ]]; then mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv" else echo "$EXPORTFORMAT - Unknown export format" -if ! rm -Rf "export.tmp" ; then +echo "Available export formats: PlainText, HtmlDark, HtmlLight, Csv" +echo "/\ CaSe-SeNsItIvE \/\\" +if ! rm -Rf "export.tmp" ;then echo "Unable to delete $PWD/export.tmp" fi exit 1 @@ -69,21 +72,22 @@ exit 0 `` with a [Channel ID](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs) - `` with the .exe path (e.g. /Users/user/Desktop/DiscordChatExporter) + `` with the .exe path (e.g. `/Users/user/Desktop/DiscordChatExporter`) `` with a filename without spaces - `` with the export directory (e.g. /Users/user/Documents/Discord\ Exports) + `` with the directory you want the files to be saved at, it can be different from the .exe path (e.g. `/Users/user/Documents/Discord\ Exports`) `` with one of the available export formats
To quickly get file or folder paths, select the file/folder, hit Command+I (⌘I) and copy what's after `Where:`.
-After copying and pasting, make sure the file/folder name is not missing. And if any of the folders has a name with a space, add `\` before the space: +After copying and pasting, make sure the file/folder name is not missing. And if a folder has a space in its name, add `\` before the space, like in the example below: * `/Users/user/Documents` - Wrong ✗ * `/Users/user/Documents/Discord Exports` - Wrong ✗ * `/Users/user/Documents/Discord\ Exports` - Correct ✓ +* `/Users/user/Desktop/DiscordChatExporter/DiscordChatExporter.Cli.exe` - Correct ✓ ![](https://i.imgur.com/29u6Nyx.png) @@ -160,10 +164,10 @@ Key | Integer **Hour** | 0-23 **Minute** | 0-59 -**Sunday** - 0; **Monday** - 1; **Tuesday** - 2; **Wednesday** - 3; **Thursday** - 4; **Friday** - 5; **Saturday** - 6. +**Sunday** - 0; **Monday** - 1; **Tuesday** - 2; **Wednesday** - 3; **Thursday** - 4; **Friday** - 5; **Saturday** - 6 Replace the template's `0`s according to the desired times.
-You can delete the ``s you don't want, don't forget to remove the `` under it. Omitted keys are interpreted as wildcards, for example, if you delete the Minute key, the script will run at every minute, delete the Weekday key and it'll run at every weekday, and so on. +You can delete the ``s you don't want, don't forget to remove the `0` under it. Omitted keys are interpreted as wildcards, for example, if you delete the Minute key, the script will run at every minute, delete the Weekday key and it'll run at every weekday, and so on. **Examples ([or skip to step 3](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Scheduling-exports-on-macOS#3-loading-the-plist-into-launchctl))** @@ -191,7 +195,7 @@ Every 15 minutes of an hour (xx:15): ``` -Every Sunday at midnight and every Wednesday full hour (xx:00). Notice the inclusion of `` and `` for multiple times: +Every Sunday at midnight and every Wednesday full hour (xx:00). Notice the inclusion of `` and `` to enable multiple times: ```xml StartCalendarInterval @@ -208,7 +212,7 @@ Every Sunday at midnight and every Wednesday full hour (xx:00). Notice the inclu Weekday 3 Minute - 0 + 00 ``` @@ -235,7 +239,7 @@ To quickly go to these directories, open Finder and press Command+Shift+G (⌘ ### Extra launchctl commands -**Starting a job**
+**Force a job to run**
To run a job regardless of its conditions (time), being `local.discordchatexporter` its `Label`: ``` launchctl start local.discordchatexporter @@ -251,7 +255,8 @@ launchctl unload /path/to/Library/LaunchAgents/local.discordchatexporter.plist launchctl list ``` -**Test if job is enabled** +**Check if a specific job is enabled**
+You can also see error codes (2nd number) by running this command. ``` launchctl list | grep local.discordchatexporter ```