-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsession.ps1
More file actions
executable file
·66 lines (53 loc) · 1.96 KB
/
session.ps1
File metadata and controls
executable file
·66 lines (53 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Tracks and displays combined crucible stats per gameplay session.
#
# Works on: Windows with Powershell
# If you have permission issues running, see:
# https://stackoverflow.com/a/62403405/10232
#
# Created by Mike Chambers
# https://www.mikechambers.com
#
# Released under an MIT License
# More info at:
# https://github.com/mikechambers/dcli/
#
# Requires dcliah and dclitime v0.2.0
################ Script configuration #################
#run dclim to sync manifest before running this script
#pull setting from environment variables. you can also
#just enter them here
#you can get member_id and platform by running dclis
$member_id=$env:MEMBER_ID
$platform=$env:PLATFORM
#for tracking trials on the weekend mode=trials_of_osiris moment=weekend
$mode="all_pvp"
$moment="now"
$session_start = (dclitime.exe --moment $moment)
$check_interval_seconds=30
############# program #############
Clear-Host
Write-Output "Retrieving activity data..."
$last_call_was_error=$false
while ($true) {
# you could use the Destiny2.exe process detection in ths status_notifications.ps1
# script, and then reset the session_start everytime destiny launches.
# that way, you could keep this script running, and it would always and automatically
# reset your session to when you launch destiny.
# assumes dcliah.exe is in your path
$activity = (dcliah.exe --name mesh#3230 `
--mode $mode --moment custom --custom-time $session_start 2>$null) -join "`n"
#note, to view any errors that might occur, remove 2>$null (this will print
#extra output though, or change to 2>err.txt and it will write to a text file)
if($LASTEXITCODE) {
if(!$last_call_was_error) {
Write-Host ("Error retrieving activities. Trying again in {0} seconds" -f $check_interval_seconds) -ForegroundColor White -BackgroundColor Red
$last_call_was_error=$true
}
} else {
$last_call_was_error=$false
Clear-Host
Write-Output $activity
}
Start-Sleep -Seconds $check_interval_seconds
}