Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:39
Show Gist options
  • Save JoeGlines/f70956030899b4291e6e43ba059a94f6 to your computer and use it in GitHub Desktop.
Save JoeGlines/f70956030899b4291e6e43ba059a94f6 to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#singleinstance, force
#MaxThreadsPerHotkey 2 ;added for multithreading
menu, tray, icon, C:\users\Joe\dropbox\Progs\AutoHotKey_L\Icons\Guitar.ico, 1
;*******************************************************.
Open:
MediaFolder :="D:\Audio\Music"
FileSelectFolder, MediaFolder ,*%MediaFolder% ,0 ,Add media folder... ;-- Browse for it
If ErrorLevel ;-- Nothing selected?
{
MsgBox 48,Open Failure,No media folder selected.
return
}
Gosub Player
Return
;***********************Original********************************.
Player:
FileList =
Loop %MediaFolder%\*.mp3,, 1
{Listsize++
FileList%Listsize% = %A_LoopFileFullPath%
}
loop
{
Random, rand, 1, %listsize%
randfilename = % filelist%rand%
if rand != %last%
menu , tray, tip, %randfilename%
Soundplay, %randfilename%, wait
last = %rand%
}
return
;*******************************************************.
^+s:: Soundplay, skip, ;skips the current track
^+o::Reload ;allows for selecting of new folder
^+esc::exitapp ;Quits the program
^+d:: ;Delete currently playing file
FiletoDelete:=RandFileName
MsgBox, 4, Delete file, Are you sure you wish to delete %RandFileName%?
IfMsgBox, No
Return ; User pressed the "No" button.
Clipboard :=randfilename
Soundplay, skip, ;skips the current track
FileDelete, %RandFileName%
Return
^+p:: ;pauses the media player
;~ !7:: ;remapped ot pause button for win 8
Pause:: ;Pause media player
Media_Play_Pause:: ;Pause media player
Soundplay, c:\
menu, tray, icon, C:\users\Joe\dropbox\Progs\AutoHotKey_L\Icons\stop.ico, ,1
Pause
menu, tray, icon, C:\users\Joe\dropbox\Progs\AutoHotKey_L\Icons\Guitar.ico, 1
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment