weighted random ambient playlist hotkey for foobar2000

this one is nasty:

global arr := ["ambient", "ambient2", "ambient3", "ambient4", "ambient5", "ambient6", "ambient7", "ambient8", "randambient2", "randambient2"]
Random, oVar, 1, arr.MaxIndex()	
rand := arr[oVar]
Run "D:\foobar2000\foobar2000.exe" /runcmd=File/Scheduler/%rand%

foo_scheduler actions:

ambient#
Set playback order to “Repeat (Playlist)”
Set active playlist “ambient”
Start playback from track #123456


randambient2
Set playback order to “Random”
Set active playlist “ambient”
Start playback
1 seconds delay
Next track
1 seconds delay
Set playback order to “Repeat (Playlist)”

Peak hours power saving ahk script

Here is a script that changes the power plan to Balanced or Power Saver depending on idle time. Just schedule it with Task Scheduler.

if A_TimeIdlePhysical > 1200000 
{
# Power Saver
	Run C:\Windows\System32\powercfg.exe /setactive a1841308-3541-4fab-bc81-f71556f20b4a
	return
}
else
{
# Balanced
	Run C:\Windows\System32\powercfg.exe /setactive 381b4222-f694-41f0-9685-ff5bb260df2e
	return
}

Autohotkey ahk power control script etc/

; #InstallKeybdHook
#SingleInstance force
Menu, Tray, Icon, power.ico 

;NumpadMult::

;Suspend

;return

^!NumpadSub::
Run C:\Windows\System32\powercfg.exe /setactive a1841308-3541-4fab-bc81-f71556f20b4a
TrayTip, Power Control, Power Saver mode, 20, 17
return

^!NumpadAdd::
Run C:\Windows\System32\powercfg.exe /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
TrayTip, Power Control, High Performance mode, 20, 17
return

!NumpadAdd::
Run C:\Windows\System32\powercfg.exe /setactive e9a42b02-d5df-448d-aa00-03f14749eb61
TrayTip, Power Control, Ultimate Performance mode, 20, 17
return

#NumpadAdd::
Run C:\Windows\System32\powercfg.exe /setactive 381b4222-f694-41f0-9685-ff5bb260df2e
TrayTip, Power Control, Balanced mode, 20, 17
return

; ^!NumpadMult::
; Run C:\Windows\System32\powercfg.exe /setactive a1841308-3541-4fab-bc81-f71556f20b4a
; FormatTime, locktime, A_now, MMM-dd hh:mm:ss tt
; IfWinNotExist, important.abw - AbiWord
; Run "C:\Program Files (x86)\AbiWord\bin\AbiWord.exe" "C:\bat\important.abw"
; else
; {
	; WinActivate, important.abw - AbiWord
; }
; sleep, 5000
; IfWinExist, iSpy 64 v7.1.8.0
; {
; Run "C:\bat\ispystart.bat"
; Run "C:\Users\sb\AppData\Local\MEGAsync\MEGAsync.exe"
; }
; DllCall("LockWorkStation")
; return

; ^+[::
; Run "C:\bat\ispystart2.bat"
; FileAppend, %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min%:%A_Sec% start`n, ispy.txt
; return

; ^+]::
; Run "C:\bat\ispystop2.bat"
; FileAppend, %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min%:%A_Sec% stop`n, ispy.txt
; return

^f7::
Loop, 1500
{
send, a
sleep 800
}
return

;^XButton1::
; XButton1::
; SendInput, {F11}
; return

^+!d::
FormatTime, time, A_now, dddd MMM dd, yyyy hh:mm:ss tt
send %time%
return

!#t::
FormatTime, time, A_now, yyyy MM/dd HH:mm:s
send %time%
return

!#y::
FormatTime, time, A_now, yyyy MM dd 
send %time%
return

^+!f::
FormatTime, time, A_now, dddd MMM dd, yyyy
send %time%
return

^+!g::
FormatTime, time, A_now, dddd MMM dd, yyyy hh:mm tt 
send last modified %time% EST
return

!#r::
send, {LWin up}
sleep, 100
red := clipboard
send, https://reddit.com/r/
sendinput %red%
send, /.rss
return

!f3::
; send, {LWin up}
sleep, 100
; red := clipboard
send, /ignore -channels
send, {space down}
send, {space up}
send, ^+{Insert}
; send, {ctrl down}
; send, {ctrl up}
; send, {shift down}
; send, {shift up}
; send, 
; Send ^v
send, {space down}
send, {space up}
send, * JOINS PARTS QUITS NICKS
return


!#k::
clip := clipboard
StringTrimRight, OutputVar, clip, 15
send, gp
send, {space down}
send, {space up}
sendinput %OutputVar%
return

!w::
Send ^x
Sleep, 100
ClipWait
Clipboard="%Clipboard%"
Sleep, 100
ClipWait
Send ^v
return

^+!v::
Clipboard='%Clipboard%'
; Clipboard=%Clipboard% | vlc -
Sleep, 100
ClipWait
Send ^v
return

^+!b::
Clipboard="%Clipboard%"
; Clipboard=%Clipboard% | vlc -
Sleep, 100
ClipWait
Send ^v
return

^+!f12:: 
FileRecycleEmpty
TrayTip, Recycle Bin, Bin emptied, 20, 17
return

^F2::
ID := DllCall("GetParent", UInt,WinExist("A")), ID := !ID ? WinExist("A") : ID
WinGetClass, Class, ahk_id %id%
WinGetTitle, Title, ahk_id %id%
MsgBox,0, %ID%, % Title "`n" Class
Return

; ^Up::
; Send, {Left Down}
; Send, {Left up}
; return

; !Up::
; Send, {Left Down}
; Send, {Left up}
; return


; !#l::
; Run "C:\bat\ispystart.bat"
; WinActivate, important.txt - Notepad
; sleep, 3000
; DllCall("LockWorkStation")
; return

; +f10::
; MouseGetPos, NEX, NEY
; Loop

; {
; Random, SleepAmount, 1, 5
; Random, SleepAmount2, 1, 2
; Random, SleepAmount3, 1, 10
; Random, SleepAmount4, 1, 4
; Sleep, %SleepAmount%
; MouseMove, 0, 1000,,R
; Sleep, %SleepAmount2%
; MouseMove, 1000, 0,,R
; Sleep, %SleepAmount3%
; MouseMove, 0, -1000,,R
; Sleep, %SleepAmount4%
; MouseMove, -1000, 0,,R
; Sleep, %SleepAmount%
; MouseGetPos, NEA, NEB
; If (NEX != NEA)
    ; Break
; sleep, 1320000
; }
; return

; !o::
; send, p
; return

; !l::
; send, :
; return

; !,::
; send, .
; return

; !9::
; send, 0
; return

; !Capslock::
; send, {Tab down}
; send, {Tab up}
; return

; ^!Capslock::
; send, {Shift down}
; send, {Tab down}
; send, {Shift up}
; send, {Tab up}
; return

; Volume_Mute::
; WinWaitActive, ahk_group ESC
; WinMove, -1, 141
; return

+NumpadAdd::
WinActivate, ahk_class Renoise
return

+NumpadSub::
WinActivate, ahk_class SunDogEngine
return

appskey & b::
WinActivate, ahk_exe thunderbird.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

; appskey & g::

; Loop 255
	; keyState .= (keyName := GetKeyName("sc" A_Index))? keyName . " : " . GetKeyState(keyName) . "`n" : ""
; MsgBox % keyState
; return

appskey & n::
WinActivate, ahk_exe QOwnNotes.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & p::
WinActivate, ahk_exe notepad++.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & f::
WinActivate, ahk_exe firefox.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & m::
WinActivate, ahk_exe palemoon.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & r::
WinActivate, ahk_exe renoise.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & t::
WinActivate, ahk_exe Ableton Live 11 Beta.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & k::
WinActivate, ahk_exe KeePass.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & s::
WinActivate, ahk_exe sunvox.exe
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & i::
WinActivate, pi@raspberrypi: ~
Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

appskey & v::
; if WinExist("vid")
	; {	WinActivate
		; return
	; }
; If !WinExist("vid") 
; {
 ; Run, D:\vid
 ; sleep, 1000
 ; WinWait, vid
 ; WinMaximize
 ; return
; }
; return

IfWinExist, vid
{
    WinActivate, vid ; otherwise the last found window will activate
}
else
{
    Run, D:\vid
	sleep, 1000
	WinWait, vid
	WinMaximize

}
return

appskey & c::

IfWinExist, bat
{
    WinActivate, bat ; otherwise the last found window will activate
}
else
{
    Run, D:\bat
	sleep, 1000
	WinWait, bat
	WinMaximize

}
return

appskey & h::

IfWinExist, html
{
    WinActivate, bat ; otherwise the last found window will activate
}
else
{
    Run, D:\windows\docs\html
	sleep, 1000
	WinWait, bat
	WinMaximize

}
return

appskey & a::

IfWinExist, apps
{
    WinActivate, apps ; otherwise the last found window will activate
}
else
{
    Run, D:\apps
	sleep, 1000
	WinWait, apps
	WinMaximize

}
return

appskey & ,::
WinActivate, ahk_exe D:\foobar2000\foobar2000.exe
return

appskey & .::
WinActivate, ahk_exe D:\foobar2000b\foobar2000.exe
return

appskey & /::
WinActivate, ahk_exe D:\foobar2000c\foobar2000.exe
return

+NumpadMult::
WinActivate, ahk_class SDL_app
return

^!v::
Send, ^v
Sleep, 200
clipboard = 
return

; random max patcher
!#v::
File = maxmsp.txt
FileRead,FileContents,%File% 
Sort,FileContents,Random 
RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1) 
Run, %RandLine%
return

; random max help patcher
!#b::
File = maxhelp.txt
FileRead,FileContents,%File% 
Sort,FileContents,Random 
RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1) 
Run, %RandLine%
return

; !#b::
; File = bible4.txt
; FileRead,FileContents,%File% 
; Sort,FileContents,Random 
; RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1) 
; send, %RandLine%
; return
		
		
!#3::
File = english.txt
FileRead,FileContents,%File% 
Sort,FileContents,Random 
RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1) 
send, %RandLine%
return

; turn off monitor	
#m::
Sleep 1000
SendMessage, 0x112, 0xF170, 2,, Program Manager
return

#Insert::
Suspend
return

Insert::
Pause
return

; random book
#b::
File = pdf.txt
FileRead,FileContents,%File% 
Sort,FileContents,Random 
RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1) 
Run, %RandLine%
return

f3::
File = channels3.txt
FileRead,FileContents,%File% 
Sort,FileContents,Random 
RandLine := SubStr(FileContents,1,InStr(FileContents,"`r")-1)
send /join
send, {space down}
send, {space up} 
send, %RandLine%
return

; youtube-dl
#c::
Send, ^c
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
sleep, 200
send, y
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

XButton2::
; send, ^r
send, r
return

XButton1::
WinActivate, ahk_exe renoise.exe
return

; wget
^+c::
Send, ^c
WinActivate, /cygdrive/d/apps ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/apps ahk_class VirtualConsoleClass
sleep, 200
send, wg
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

!#c::
Send, ^c
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
sleep, 200
send, yt
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

f7::
return

#/::
Send, ^c
WinActivate, /cygdrive/d/ng ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/ng ahk_class VirtualConsoleClass
sleep, 200
send, yg
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

#5::
Send, ^c
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
sleep, 200
send, y5
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

#9::
Send, ^c
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
sleep, 200
send, y9
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

#0::
Send, ^c
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
sleep, 200
send, y0
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

!#5::
Send, ^c
WinActivate, /cygdrive/d/apps ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/apps ahk_class VirtualConsoleClass
sleep, 200
send, wg5
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

!#9::
Send, ^c
WinActivate, /cygdrive/d/apps ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/apps ahk_class VirtualConsoleClass
sleep, 200
send, wg9
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

!#0::
Send, ^c
WinActivate, /cygdrive/d/apps ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/apps ahk_class VirtualConsoleClass
sleep, 200
send, wg0
send, {space down}
send, {space up}
Send, ^v
send, {enter down}
send, {enter up} 
return

#v::
quote := """"
WinActivate, /cygdrive/d/vid ahk_class VirtualConsoleClass
WinWait, /cygdrive/d/vid ahk_class VirtualConsoleClass
send, v
send, {space down}
send, {space up}
send %quote%
Send, ^v
send %quote%
send, {enter down}
send, {enter up} 
return

Launch_App2::
; hwnd:=winexist("pi@raspberrypi: ~")
; DllCall( "SetParent", UInt,hwnd, UInt,DllCall( "GetShellWindow" ) )
return

Launch_Media::
return

^#t::
WinSet, AlwaysOnTop, Toggle,A
return

#f::
Random, rand, 1, 658
; Random, SleepAmount2, 1, 2
Random, test, 0, 1
if (test = 0) {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
    Click, WheelUp 
}
else {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
	Click, WheelDown 
}
return


!#f::
Loop,
{
Random, rand, 1, 658
; Random, SleepAmount2, 1, 2
Random, test, 0, 1
if (test = 0) {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
    Click, WheelUp 
}
else {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
	Click, WheelDown 
}
}

!#g::
Loop,
{
Random, rand, 1, 658
Random, rand2, 1, 1000
; Random, SleepAmount2, 1, 2
Random, test, 0, 1
if (test = 0) {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
    Click, WheelUp 
}
else {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
	Click, WheelDown 
}
sleep, %rand2%
}

!#h::
Loop,
{
Random, rand, 1, 658
Random, rand2, 1, 6000
; Random, SleepAmount2, 1, 2
Random, test, 0, 1
if (test = 0) {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
    Click, WheelUp 
}
else {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
	Click, WheelDown 
}
sleep, %rand2%
}

!#j::
Loop,
{
Random, rand, 1, 3000
Random, rand2, 1, 6000
; Random, SleepAmount2, 1, 2
Random, test, 0, 1
if (test = 0) {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
    Click, WheelUp 
}
else {
	WinActivate, ahk_class IrfanView
	WinWaitActive, ahk_class IrfanView
	Loop, %rand% 
	Click, WheelDown 
}
sleep, %rand2%
}


#g::
Run "D:\foobar2000\foobar2000.exe" "/runcmd=View/Display Discord Rich Presence"
return


; ^+!r::
; Run "D:\foobar2000\foobar2000.exe" "/runcmd=Playback/Random"
; return

^+!e::
Run "D:\foobar2000\foobar2000.exe" "/runcmd=Playback/Random"
return

#n::
Run ms-settings:nightlight
return

#,::
Run ms-settings:windowsupdate
return

#.::
Run ms-settings:taskbar
return


+f9::
Run D:\foobar2000b\foobar2000.exe /playpause
return

f9::
Run D:\foobar2000\foobar2000.exe /playpause
return

f10::
Run D:\foobar2000\foobar2000.exe /prev
return

f11::
Run D:\foobar2000\foobar2000.exe /next
return

; block keyboard and mouse input
!#pause::
blockinput,on
return

; holding appskey and pressing pause to abort 
appskey & pause::
    blockinput,off
	Send, {Alt Up}{Shift Up}{ctrl Up}{lwin up}
return

+Volume_Down::
Run "D:\foobar2000\foobar2000.exe" /runcmd=Playback/Seek/"Back by 1 second"
return

+Volume_Up::
Run "D:\foobar2000\foobar2000.exe" /runcmd=Playback/Seek/"Ahead by 1 second"
return

^Volume_Down::
Run "D:\foobar2000\foobar2000.exe" /runcmd=Playback/Seek/"Back by 10 seconds"
return

^Volume_Up::
Run "D:\foobar2000\foobar2000.exe" /runcmd=Playback/Seek/"Ahead by 10 seconds"
return

#PrintScreen::
send, {PrintScreen}
Run "C:\Program Files\paint.net\PaintDotNet.exe"
WinWait, ahk_exe PaintDotNet.exe
Send, ^v
send, {enter down}
send, {enter up}
return