Created Scheduling Exports on macOS (markdown)

Yudi
2018-09-13 00:00:31 -03:00
parent 9a7f89bba7
commit da32b1eecf

@@ -0,0 +1,106 @@
Make sure you already have DiscordChatExporter and Mono properly installed ([instructions here](https://github.com/RenanYudi/DiscordChatExporter/wiki/macOS-usage-instructions)).
* [Creating a Workflow](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Scheduling-Exports-on-macOS#creating-a-workflow-with-automator)
* [Scheduling with Calendar](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Scheduling-Exports-on-macOS#scheduling-exports-with-calendar)
* [Exporting on User login](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Scheduling-Exports-on-macOS#exporting-on-user-login)
## Creating a Workflow with Automator
**1.** Search for `Automator.app` on Spotlight (⌘+SPACE) and open it
**2.** Create a new `Workflow` file
![](https://i.imgur.com/DpsQkAR.png)
**3.** Search for `Shell` and Drag it to the empty space on the right
![](https://i.imgur.com/AIv3iS6.png)
**4.** Paste the following into the empty text box:
```# Info: https://github.com/Tyrrrz/DiscordChatExporter
TOKEN=<token>
TOKENTYPE=<BOT/USER>
CHANNEL=<channel>
EXEPATH=<exe>
FILENAME=<name>
EXPORTDIRECTORY=<dir>
EXPORTFORMAT=<format>
# Available export formats: PlainText, HtmlDark, HtmlLight, Csv
cd $EXEPATH || exit
if [[ "$TOKENTYPE" == "BOT" ]]; then
ISBOTYES=-b
fi
PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
mono DiscordChatExporter.Cli.exe -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o exporttmp
CURRENTTIME=`date +"%Y-%m-%d-%H-%M-%S"`
if [[ "$EXPORTFORMAT" == "PlainText" ]]; then
mv "exporttmp" $EXPORTDIRECTORY/$FILENAME-$CURRENTTIME.txt
elif [[ "$EXPORTFORMAT" == "Html"* ]]; then
mv "exporttmp" $EXPORTDIRECTORY/$FILENAME-$CURRENTTIME.html
elif [[ "$EXPORTFORMAT" == "Csv" ]]; then
mv "exporttmp" $EXPORTDIRECTORY/$FILENAME-$CURRENTTIME.csv
else
exit
fi
exit
```
**5.** Replace:
`<token>` with your [Token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
`<BOT/USER>` If the Token is from a bot replace it with `BOT`, if it's from a user, `USER`.
`<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)
`<name>` with a filename without spaces
`<dir>` with the export directory without quotes (e.g. /Users/user/Documents/Discord\ Exports)
`<format>` with one of the available export formats.
**6.** Run the Workflow (this may take a while to complete). If the export file was created, you're ready to save the Workflow at the Exporter exe's directory.
![](https://i.imgur.com/ogPrhNp.png)
## Scheduling Exports with Calendar
**1.** Search for `Calendar.app` on Spotlight (⌘+SPACE) and open it
**2.** Create a New Event (⌘+N).
![](https://i.imgur.com/BtmOxc3.png)
* Set `starts` hour to the time you want the Workflow to be executed
* Set `repeat` frequency
* Set `alert` as `Custom…`, `Open File`, `Other…` and select your Workflow file, and `At time of event`
![](https://i.imgur.com/GbUOPmt.png)
## Exporting on User Login
**1.** Open System Preferences on the Apple () menu
**2.** Open Users & Groups
**3.** Click on User and then on Login Items
**4.** Drag your Workflow file into the list
![](https://i.imgur.com/xacYWCA.png)