mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-05 05:09:04 +00:00
Updated Scheduling exports on macOS (markdown)
@@ -31,6 +31,7 @@ FILENAME=<name>
|
||||
EXPORTDIRECTORY=<dir>
|
||||
EXPORTFORMAT=<format>
|
||||
# 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
|
||||
|
||||
`<channel>` with a [Channel ID](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
|
||||
|
||||
`<exe>` with the .exe path (e.g. /Users/user/Desktop/DiscordChatExporter)
|
||||
`<exe>` with the .exe path (e.g. `/Users/user/Desktop/DiscordChatExporter`)
|
||||
|
||||
`<name>` with a filename without spaces
|
||||
|
||||
`<dir>` with the export directory (e.g. /Users/user/Documents/Discord\ Exports)
|
||||
`<dir>` 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`)
|
||||
|
||||
`<format>` with one of the available export formats
|
||||
|
||||
<br/>
|
||||
|
||||
To quickly get file or folder paths, select the file/folder, hit Command+I (⌘I) and copy what's after `Where:`. <br/>
|
||||
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 ✓
|
||||
|
||||

|
||||
|
||||
@@ -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.<br/>
|
||||
You can delete the `<key>`s you don't want, don't forget to remove the `<integer>` 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 `<key>`s you don't want, don't forget to remove the `<integer>0</integer>` 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 `<array>` and `</array>` for multiple times:
|
||||
Every Sunday at midnight and every Wednesday full hour (xx:00). Notice the inclusion of `<array>` and `</array>` to enable multiple times:
|
||||
|
||||
```xml
|
||||
<key>StartCalendarInterval</key>
|
||||
@@ -208,7 +212,7 @@ Every Sunday at midnight and every Wednesday full hour (xx:00). Notice the inclu
|
||||
<key>Weekday</key>
|
||||
<integer>3</integer>
|
||||
<key>Minute</key>
|
||||
<integer>0</integer>
|
||||
<integer>00</integer>
|
||||
</dict>
|
||||
</array>
|
||||
```
|
||||
@@ -235,7 +239,7 @@ To quickly go to these directories, open Finder and press Command+Shift+G (⌘
|
||||
|
||||
### Extra launchctl commands
|
||||
|
||||
**Starting a job**<br/>
|
||||
**Force a job to run**<br/>
|
||||
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**<br/>
|
||||
You can also see error codes (2nd number) by running this command.
|
||||
```
|
||||
launchctl list | grep local.discordchatexporter
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user