WMPlayer.OCX How to take control of your Media

Post your working scripts, libraries and tools
Trubbleguy
Posts: 8
Joined: 11 Jul 2014, 03:00

WMPlayer.OCX How to take control of your Media

15 Apr 2016, 21:09

This comObject control gives you direct control of media, including reading and writing to the files metadata/tags
all my documentation was obtained from here , it can be some pretty heavy reading.....
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
example code
Spoiler
Things it can do:
Play, Pause, Stop, fast forward, Jump to time location
Adjust volume
Edit tags

what i have found is some actions wont work unless sent in the right order, like i found that if you dont use
if not currentmedia1.isReadOnlyItem("Artist") *before* currentmedia1.setItemInfo( "Artist", "buggles" ), it quite often fails

WMA1:= ComObjCreate("WMPlayer.OCX") ; create and invoke individual media holders, Using 2 allows real time mixing of media
WMA2:= ComObjCreate("WMPlayer.OCX")

option 1: ;This just loads and plays a file in a mediaplayer window.
wmA1.url:=MyFilename ; specifies or retrieves the name of the media item to play
currentmedia1 := wma1.newMedia( MyFilename ) ; creates a new Media object so you can get data without a MS gui.
wma1.openPlayer( MyFilename ) ;opens the file directly into its own media player window
return

option 2:
; open a file and have great control without a gui

wmA1.url:=MyFilename ; specifies or retrieves the name of the media item to play
currentmedia1 := wma1.newMedia( MyFilename ) ; creates a new Media object so you can get data without a MS gui.


if (wma1.controls.isAvailable( name )) ; I found This checking function is not really required, Controls are mostly error free
; and works for the following commands
wma1.controls.currentItem
wma1.controls.currentMarker

wma1cp:=wma1.controls.currentPosition ; gets the current position in the media.
wma1.controls.currentPosition:=33 ; sets the current position in the media item at 33 seconds from the beginning.

wma1.controls.currentPositionString ; Retrieves the current position in the media item as a String formatted as HH:MM:SS
wma1.controls.currentPositionTimecode ; retrieves the current position in the current media item using a time code
wma1.controls.fastForward
wma1.controls.fastReverse
wma1.controls.next
wma1.controls.pause
wma1.controls.play
wma1.controls.previous
wma1.controls.step
wma1.controls.stop


if (wma1.settings.isAvailable( name )) ;this check is pretty useful as settings do or do not work with different types of media
; and works for the following commands which can also be written to.
wma1.settings.AutoStart ; Determines whether the autoStart property can be set.
wma1.settings.Balance ; Determines whether the balance property can be set.
wma1.settings.BaseURL ; Determines whether the baseURL property can be set.
wma1.settings.DefaultFrame ; Determines whether the defaultFrame property can be set.
wma1.settings.EnableErrorDialogs ; Determines whether the enableErrorDialogs property can be set.
wma1.settings.GetMode ; Determines whether the getMode method can be called.
wma1.settings.InvokeURLs ; Determines whether the invokeURLs property can be set.
wma1.settings.Mute ; Determines whether the mute property can be set.
wma1.settings.PlayCount ; Determines whether the playCount property can be set.
wma1.settings.Rate ; Determines whether the rate property can be set.
wma1.settings.SetMode ; Determines whether the setMode method can be called.
wma1.settings.Volume ; Determines whether the volume property can be set.



;set the following to get media info from the file (its usually required to play the file anyway)
currentmedia1 := wma1.newMedia( MyFilename )

;example: get artist info from currentmedia1
wma1Artist:=currentmedia1.getItemInfo(Artist)

;example: Set info To artist tag after checking readonly status, isReadOnlyItem must be done or setIteminfo will fail a lot.
if not currentmedia1.isReadOnlyItem("Artist")
currentmedia1.setItemInfo( "Artist" ,"ed sheeran" )

all of the following are Read/Write

wmaitemnames=
(
AcquisitionTime
AlbumID
AlbumIDAlbumArtist
Artist
Author
AverageLevel
Bitrate
BuyNow
BuyTickets
Copyright
CurrentBitrate
Duration
FileSize
FileType
Is_Protected
IsVBR
MediaType
MoreInfo
PeakValue
Provider
LogoURL
ProviderURL
RecordingTime
Writer
RequestState
SourceURL
SyncState
Title
TrackingID
UserCustom1
UserCustom2
UserEffectiveRating
UserLastPlayedTime
UserPlayCount
UserPlaycountAfternoon
UserPlaycountEvening
UserPlaycountMorning
UserPlaycountNight
UserPlaycountWeekday
UserPlaycountWeekend
UserRating
UserServiceRating
WM/AlbumArtist
WM/AlbumTitle
WM/Category
WM/Composer
WM/Conductor
WM/ContentDistributor
WM/ContentGroupDescription
WM/Writer
WM/Genre
WM/GenreID
WM/InitialKey
WM/Language
WM/Lyrics
WM/MCDI
WM/MediaClassPrimaryID
WM/MediaClassSecondaryID
WM/Mood
WM/ParentalRating
WM/Period
WM/ProtectionType
WM/Provider
WM/ProviderRating
WM/ProviderStyle
WM/Publisher
WM/SubscriptionContentID
WM/SubTitle
WM/TrackNumber
WM/UniqueFileIdentifier
WM/WMCollectionGroupID
WM/WMCollectionID
WM/WMContentID
WM/Writer
WM/Year
)
Trubbleguy
Posts: 8
Joined: 11 Jul 2014, 03:00

Re: WMPlayer.OCX How to take control of your Media

23 Apr 2016, 06:28

my AhkDJ program, mixes files nicely with tag reading etc.
I used one slider for volume on both players, you will see how it works.
Image
heres my code, minus a couple of .ani files you can replace with your own..

Code: Select all

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance , Force
#MaxThreads 128
#MaxThreadsBuffer On
firstime=1   ;tells queue to go ahead and load both players
overlap=6    ;eg. 6 seconds before end of song, load next song and play it, then fade first song.

WMA1          := ComObjCreate("WMPlayer.OCX") ; create individual media holders
WMA2          := ComObjCreate("WMPlayer.OCX")


iniread,volume,%A_ScriptDir%\dj.ini,settings,Volume,75 ;read in last volume setting
setbatchlines -1
x:=5
gui, +border -toolwindow -Theme
gui, Margin,5,5
Gui, Font,S10,Lucida Console
Gui, Color, 000000
Gui, Add, Slider,x%x% y10 w300 h20 range0-12000 gsetsongpos1 TickInterval10 vP1
;Gui, Add, progress,x%x% y10 w300 h20 range0-12000  TickInterval10 vP1
Gui, Add, Slider,xp y+4 w628 h25 vM1 cfff333 Altsubmit gvolume range-100-100 Page10 TickInterval10 ToolTipLeft, 0
y=60
Gui, Font,S8,Lucida Console
Gui, Add, Edit,xp y%y% w100 h20 vLength1,
if filelist
{
Gui, Add, Picture,xp+120 yp w20 h20 vpica1,aero_busy_xl.ani  ;find your own ani files to put here, i got this from windows folder
}
else
{
Gui, Add, Picture,xp+120 yp w20 h20 vpica1,sync.ico
}
Gui, Add, Edit,xp+40 yp w80 h20 vremain1,
Gui, Font,S10,Lucida Console
Gui, Add, Edit,x%x% y+2 w300 h20 vTitle1,Drag & Drop files Anywhere Here
Gui, Add, Edit,xp y+2 wp h20 vArtist1,to queue them
gui, Add, Edit,xp y+2 wp h20 vtrack1,Dragging Multiple files 
Gui, Add, edit,xp y+2 wp h20 Valbum1,will create a Playlist
Gui, Add, edit,xp y+2 wp h20 ValbumArtist1,
Gui, Font,S7,Lucida Console
Gui, Add, Button,xp y+2 w100 h15 vqueue1 gqueue11,Queue next Song
;Gui, Add, Button,xp+200 yp wp hp disabled ,Write Tags     ;future feature
Gui, Font,S10,Lucida Console


x=333
Gui, Add, slider,x%x% y10 w300 h20 range0-12000 gsetsongpos2 vP2
y=60
Gui, Font,S8,Lucida Console
Gui, Add, Edit,xp y%y% w100 h20 vLength2,
Gui, Add, Picture,xp+120 yp w20 h20 vpica2,sync.ico
Gui, Add, Edit,xp+40 yp w80 h20 vremain2,
Gui, Font,S10,Lucida Console
Gui, Add, Edit,x%X% y+2 w300 h20 vTitle2,Drag & Drop files anywhere here
Gui, Add, Edit,xp y+2 wp h20 vArtist2, to queue them
gui, Add, Edit,xp y+2 wp h20 vtrack2,Dragging Multiple files 
Gui, Add, edit,xp y+2 wp h20 Valbum2,will create a Playlist
Gui, Add, edit,xp y+2 wp h20 ValbumArtist2,
Gui, Font,S7,Lucida Console
Gui, Add, Button,xp y+2 w100 h15 vqueue2 gqueue22 ,Queue next Song
Gui, Add, Button,x+2 yp w100 h15 ggetsongs,Replace Songs
;Gui, Add, Button,xp+200 yp wp hp disabled ,Write Tags
Gui, Font,S10,Lucida Console

Gui, Add, Button,x310 Y60 w17 H60 vnextb disabled ,NEXT
Gui, Add, Button,xp Y+10 wp H60,STOP

Gui,show,y1 autosize, AhkDJ
GuiControl,,p1,1
GuiControl,,p2,1
guicontrol,,m1,-%volume%


ifexist,%A_ScriptDir%\filelist.txt
	fileread,filelist,%A_ScriptDir%\filelist.txt
	
if filelist ;go ahead and load the last list
{
Sort,filelist,U
gosub queue1
gosub queue2
gosub volume
settimer,djtimer1,333
guicontrol,,pica1,aero_busy_xl.ani
if getremtime1
	{
	splitpath,getremtime1,filenname1
	WinSetTitle,,sync.ico,AhkDJ - %filenname1%
	}
wma1.controls.play
firstime=
}
return

;########################################################################################## 
;tag
queue11:  ;simple way to skip current song and load next, stick name in playedsongs
playedlist = %playedlist%%getremtime1%`n
queue1:
getremtime1=
loop, parse, filelist,`n, `r
	{
	t=1
	if not A_LoopField
	continue
	getremtime11:=A_LoopField
	loop,parse,playedlist,`n,`r
	{
		if A_LoopField = %getremtime11%
		{
			t=
			getremtime11=
			break
		}
	}
	if t=
		{
		getremtime11=
		continue
		}
	if getremtime11
		{
		getremtime1:=getremtime11
		break
		}
	}		
if getremtime1
	{
	loaded=1	
	read1(getremtime1,"Title,Artist,Duration,MediaType,Album,Bitrate,WM/TrackNumber,WM/AlbumArtist")
	filename1:=getremtime1
	wma1duration:=currentmedia1.getItemInfo("Duration")
	GuiControl,,length1,% FormatSeconds(wma1duration)
	GuiControl,,remain1,% FormatSeconds(wma1duration)
	GuiControl,,title1,%wma1title%
	GuiControl,,artist1,%wma1artist%
	GuiControl,,track1,%wma1tracknumber%
	GuiControl,,album1,%wma1album%
	GuiControl,,albumartist1,%wma1albumartist%
	r1:=Round(currentmedia1.getItemInfo("Duration"))
	rem1:=Round(currentmedia1.getItemInfo("Duration")-overlap)
	r1s:=Round( 12000 / r1 )
	if firstime
	playedlist = %playedlist%%getremtime1%`n

	return
	}
	
;if no file, clear player	
r1=
rem1=
r1s=
GuiControl,,length1,
GuiControl,,remain1,
GuiControl,,title1,
GuiControl,,artist1,
GuiControl,,track1,
GuiControl,,album1,
GuiControl,,albumartist1,
loaded=3
return
;########################################################################################## 
;tag
queue22:
playedlist = %playedlist%%getremtime2%`n
queue2:
getremtime2=
loop, parse, filelist,`n, `r
	{
	t=1
	if not A_LoopField
	continue
	getremtime22:=A_LoopField
	loop,parse,playedlist,`n,`r
	{
		if A_LoopField = %getremtime22%
		{
		t=
		getremtime22=
		break
		}
	}
	if t=
		{
		getremtime22=
		continue
		}
	if getremtime22
		{
		getremtime2:=getremtime22
		break
		}
	}
	
	
if getremtime2
{
loaded=2
filename2:=getremtime2
read2(getremtime2,"Title,Artist,Duration,MediaType,Album,Bitrate,WM/TrackNumber,WM/AlbumArtist")
wma2duration:=currentmedia2.getItemInfo("Duration")
GuiControl,,length2,% FormatSeconds(wma2duration)
GuiControl,,remain2,% FormatSeconds(wma2duration)
GuiControl,,title2,%wma2title%
GuiControl,,artist2,%wma2artist%
GuiControl,,track2,%wma2tracknumber%
GuiControl,,album2,%wma2album%
GuiControl,,albumartist2,%wma2albumartist%
r2:=Round(currentmedia2.getItemInfo("Duration"))
rem2:=Round(currentmedia2.getItemInfo("Duration")-overlap)
r2s:=Round(12000/r2)
guicontrol,enable,nextb
return
}
;if no file, clear player	

r2=
rem2=
r2s=
GuiControl,,length2,
GuiControl,,remain2,
GuiControl,,title2,
GuiControl,,artist2,
GuiControl,,track2,
GuiControl,,album2,
GuiControl,,albumartist2,
loaded=3
;guicontrol,disable,nextb
return
;########################################################################################## 
;tag
buttonnext:

if loaded=2
	{
	if not r2			;if no file to play return
	return	
	settimer,volslide1,-1
	settimer,djtimer2,333
	guicontrol,,pica1,sync.ico
	guicontrol,,pica2,aero_busy_xl.ani
	stop2:=rem2
	cnt2=
	GuiControl,,p1,0
	guicontrol,enable,queue1
	guicontrol,enable,p2
	guicontrol,disable,p1
	guicontrol,disable,queue2
	settimer,djtimer1,delete
	return 
	}
if Loaded=1	
	{	
	if not r1 
	return	
	settimer,volslide2,-1
	settimer,djtimer1,333
	guicontrol,,pica2,sync.ico
	stop1:=rem1
	cnt1=
	GuiControl,,p2,0
	guicontrol,enable,queue2
	guicontrol,enable,p1
	guicontrol,disable,queue1
	guicontrol,disable,p2
	guicontrol,,pica1,aero_busy_xl.ani
	settimer,djtimer2,delete
	Return
	}
return

;########################################################################################## 
;tag
buttonstop:
wma1.controls.stop
wma2.controls.stop
guicontrol,,pica1,sync.ico
guicontrol,,pica2,sync.ico

settimer,djtimer1,delete
settimer,djtimer2,delete
return

;########################################################################################## 
;tag
djtimer1:
Critical 50 
if GetKeyState("LButton" , "P")
return 
	rteduc1:=Round(wma1.controls.currentPosition)
	GuiControl,,remain1,% FormatSeconds(wma1duration-rteduc1)
	r1ss:=r1s*rteduc1
	GuiControl,,p1,%r1ss%
	cnt1++	
	 if rteduc1 >= %rem1%
		gosub buttonnext	

	
return
;########################################################################################## 
;tag
djtimer2:
Critical 50 
if GetKeyState("LButton" , "P") ;disable timer functions while left mouse button down
return 
	rteduc2:=Round(wma2.controls.currentPosition)
	GuiControl,,remain2,% FormatSeconds(wma2duration-rteduc2)
	r2ss:=r2s*rteduc2
	GuiControl,,p2,%r2ss%
	cnt2++	
	 if rteduc2 >= %rem2%
		gosub buttonnext	
return
;########################################################################################## 
;tag
setsongpos1:
guicontrolget,1pos,,p1
1sp:=Round(1pos/r1s)
if 1pos >= rem1
1sp := rem1-128
if not 1pos
	1sp=1
if 1pos<12
	1sp=1

	wma1.controls.currentPosition:=1sp
Return
;########################################################################################## 
;tag
setsongpos2:
guicontrolget,2pos,,p2
2sp:=Round(2pos/r2s)
if 2pos > rem2
2sp:= (rem2-128)
if not 2pos 
2sp=1
if 2pos <= 12
2sp=1
wma2.controls.currentPosition:=2sp
Return
;########################################################################################## 
;tag
volslide1:   ;lowers one volume and raises other
sn= -%volume%
wma2.controls.play
playedlist = %playedlist%%getremtime2%`n
splitpath,getremtime2,filenname2
WinSetTitle,,sync.ico,AhkDJ - %filenname2%
playing2=1
playing1=
if not firstime
loop % (volume*2)
	{
	sn++
	wma1.settings.volume:=(volume-(A_Index/2))
	wma2.settings.volume:=(A_Index/2)
	guicontrol,,m1,%sn%
	sleep, 15
	}
wma1.controls.stop
loaded=1
gosub queue1
return
;########################################################################################## 
;tag

volslide2:
sn=%volume%
wma1.controls.play
playedlist = %playedlist%%getremtime1%`n
splitpath,getremtime1,filenname1
WinSetTitle,,sync.ico,AhkDJ - %filenname1%
playing1=1
playing2=

if not firsttime
loop % (volume*2)
	{
	sn--
	wma2.settings.volume:=(volume-(A_Index/2))
	wma1.settings.volume:=(A_Index/2)
	guicontrol,,m1,%sn%
	sleep, 15 
	}
else
	wma1.settings.volume:=sn
	
wma2.controls.stop

;guicontrol,,m1,-%volume%
loaded=2
gosub queue2
return
;########################################################################################## 
;tag

volume:			;set initial volumes
guicontrolget,volume,,m1
if volume<0
{
volume:=volume-(volume*2)
wma1.settings.volume:=volume
}
else
wma2.settings.volume:=volume
iniwrite,%volume%,%A_ScriptDir%\dj.ini,settings,Volume
;Notify( "[dj.ahk] `n" volume , ,5)
return


return
;########################################################################################## 
;tag
GuiDropFiles:

			SplitPath, A_GuiEvent ,,,OE,,

if oe not in mp3,wma,mp4,wav
{
	dodis=%A_GuiEvent%\*.*
	Loop files , %dodis% ,FR
	{
		if A_LoopFileFullPath
			{
				SplitPath, A_LoopFileFullPath ,,,OE,,
				if oe not in mp3,wma,mp4,wav
					continue
				if filelist not contains %A_LoopFileFullPath%	
				    Filelist = %filelist%%A_LoopFileFullPath%`n
			 }
	}
}
else
  Filelist = %filelist%%A_GuiEvent%`n
  
sort,filelist,U
if filelist
filedelete,%A_ScriptDir%\filelist.txt
sleep 300
fileappend,%filelist%`n,%A_ScriptDir%\filelist.txt
guicontrol,enable,nextb
if not playing1
if firstime
{
gosub queue1
firstime=
loaded=1
gosub buttonnext
playing1=1
playing2=
return
}
Notify( "[dj.ahk] `n" loaded , playing1 ,5)

if loaded in 1,3
if playing1=1
	{
	gosub queue2
	firstime=
	loaded=2
	}
if loaded=2	
	if playing2=1
		return

;########################################################################################## 
;tag
wmaget:
return
read1(WMAName,tagname="")
	{
	global
	wmaitemnames=AcquisitionTime,AlbumID,AlbumIDAlbumArtist,Artist,Author,AverageLevel,Bitrate,BuyNow,BuyTickets,Copyright,CurrentBitrate,Duration,FileSize,FileType,Is_Protected,IsVBR,MediaType,MoreInfo,PeakValue,ProviderLogoURL,ProviderURL,RecordingTime,Writer,RequestState,SourceURL,SyncState,Title,TrackingID,UserCustom1,UserCustom2,UserEffectiveRating,UserLastPlayedTime,UserPlayCount,UserPlaycountAfternoon,UserPlaycountEvening,UserPlaycountMorning,UserPlaycountNight,UserPlaycountWeekday,UserPlaycountWeekend,UserRating,UserServiceRating,WM/AlbumArtist,WM/AlbumTitle,WM/Category,WM/Composer,WM/Conductor,WM/ContentDistributor,WM/ContentGroupDescription,WM/Writer,WM/Genre,WM/GenreID,WM/InitialKey,WM/Language,WM/Lyrics,WM/MCDI,WM/MediaClassPrimaryID,WM/MediaClassSecondaryID,WM/Mood,WM/ParentalRating,WM/Period,WM/ProtectionType,WM/Provider,WM/ProviderRating,WM/ProviderStyle,WM/Publisher,WM/SubscriptionContentID,WM/SubTitle,WM/TrackNumber,WM/UniqueFileIdentifier,WM/WMCollectionGroupID,WM/WMCollectionID,WM/WMContentID,WM/Writer,WM/Year
	data=	
	if not tagname 
		return
	if not ib
	{	
		wmA1.url:=wmaname
		wma1.controls.stop
		wma1.settings.volume:=1
	}
	currentmedia1 := wma1.newMedia( WMAName )
	loop,parse,tagname,csv
	{
	if A_LoopField not in %wmaitemnames%
		continue	
	stringreplace,loopname,A_LoopField,wm/							;trim wm/ from tagname to stop errors in return value                   	   					
		wma1%Loopname%:=currentmedia1.getItemInfo(A_LoopField)  		;read the tagname and return a global value of "wma+tagname" minus any "wm/" it finds
	}
	wmaitemnames=
	return
	}
	
read2(WMAName,tagname="")
	{
	global
	wmaitemnames=AcquisitionTime,AlbumID,AlbumIDAlbumArtist,Artist,Author,AverageLevel,Bitrate,BuyNow,BuyTickets,Copyright,CurrentBitrate,Duration,FileSize,FileType,Is_Protected,IsVBR,MediaType,MoreInfo,PeakValue,ProviderLogoURL,ProviderURL,RecordingTime,Writer,RequestState,SourceURL,SyncState,Title,TrackingID,UserCustom1,UserCustom2,UserEffectiveRating,UserLastPlayedTime,UserPlayCount,UserPlaycountAfternoon,UserPlaycountEvening,UserPlaycountMorning,UserPlaycountNight,UserPlaycountWeekday,UserPlaycountWeekend,UserRating,UserServiceRating,WM/AlbumArtist,WM/AlbumTitle,WM/Category,WM/Composer,WM/Conductor,WM/ContentDistributor,WM/ContentGroupDescription,WM/Writer,WM/Genre,WM/GenreID,WM/InitialKey,WM/Language,WM/Lyrics,WM/MCDI,WM/MediaClassPrimaryID,WM/MediaClassSecondaryID,WM/Mood,WM/ParentalRating,WM/Period,WM/ProtectionType,WM/Provider,WM/ProviderRating,WM/ProviderStyle,WM/Publisher,WM/SubscriptionContentID,WM/SubTitle,WM/TrackNumber,WM/UniqueFileIdentifier,WM/WMCollectionGroupID,WM/WMCollectionID,WM/WMContentID,WM/Writer,WM/Year
	data=	
	if not tagname 
		return
	if not ib
	{	
		wmA2.url:=wmaname
		wma2.controls.stop
		wma2.settings.volume:=1
	}
	currentmedia2 := wma2.newMedia( WMAName )
	loop,parse,tagname,csv
	{
	if A_LoopField not in %wmaitemnames%
		continue	
	stringreplace,loopname,A_LoopField,wm/							;trim wm/ from tagname to stop errors in return value                   	   					
		wma2%Loopname%:=currentmedia2.getItemInfo(A_LoopField)  		;read the tagname and return a global value of "wma2+tagname" minus any "wm/" it finds
	}
	wmaitemnames=
	return
	}
return	
;########################################################################################## 
;tag
getsongs:
	if folder
	FileSelectFolder, folder, *%folder% ,2, Cancel To Drag && Drop Files Onto The Player`n Or Select A Folder To Play Songs From It ; My Computer.
	else
	FileSelectFolder, folder, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} ,, Cancel To Drag && Drop Files Onto The Player`n Or Select A Folder To Play Songs From It ; My Computer.
	Folder := RegExReplace(Folder, "\\$")  
	if folder
	{
	loop,%folder%\*.*,0,1
	if A_LoopFileExt in mp3,wma,mp4
		{
		filelist .= A_LoopFileFullPath "`n"
		scannedsongs:=A_Index
		}
	fileappend,%filelist%,%A_ScriptDir%\filelist.txt	
	}
	else
		fileappend,`n,%A_ScriptDir%\filelist.txt

	Notify( "Found`n" scannedsongs " Songs" , ,5)
	gosub queue1
	gosub buttonnext

return
;########################################################################################## 
;tag
!q::
guiclose:
if filelist
	MsgBox,  4,Delete,Delete playlist?,30
ifmsgbox Yes
	ifexist,%A_ScriptDir%\filelist.txt
		filedelete,%A_ScriptDir%\filelist.txt
exitapp
return
Attachments
AhkDJ.jpg
carno
Posts: 205
Joined: 20 Jun 2014, 16:48

Re: WMPlayer.OCX How to take control of your Media

23 Apr 2016, 13:35

Added #Include Notify.ahk below. Could you show your FormatSeconds() function to include? I used this version below. My GUI does not have the Stop or Start buttons (blue circles as shown in your screenshot.

Code: Select all

; The following function converts the specified number of seconds into the corresponding
; number of hours, minutes, and seconds (hh:mm:ss format).

MsgBox % FormatSeconds(7384)  ; 7384 = 2 hours + 3 minutes + 4 seconds. It yields: 2:03:04

FormatSeconds(NumberOfSeconds)  ; Convert the specified number of seconds to hh:mm:ss format.
{
    time = 19990101  ; *Midnight* of an arbitrary date.
    time += %NumberOfSeconds%, seconds
    FormatTime, mmss, %time%, mm:ss
    return NumberOfSeconds//3600 ":" mmss
    /*
    ; Unlike the method used above, this would not support more than 24 hours worth of seconds:
    FormatTime, hmmss, %time%, h:mm:ss
    return hmmss
    */
}

Code: Select all

; https://autohotkey.com/board/topic/44870-notify-multiple-easy-tray-area-notifications-v04991/
; http://www.gwarble.com/ahk/Notify/Notify.ahk

;——————————————————————————————————————————————————————
;————————      Notify() 0.4991 by gwarble       ————————
;—————                                            —————
;———      easy multiple tray area notifications     ———
;——    http://www.autohotkey.net/~gwarble/Notify/    ——
;——————————————————————————————————————————————————————
;
; Notify([Title,Message,Duration,Options])
;
; Duration  seconds to show notification [Default: 30]
;             0  for permanent/remain until clicked (flashing)
;            -3  negative value to ExitApp on click/timeout
;           "-0" for permanent and ExitApp when clicked (needs "")
;
; Options   string of options, single-space seperated, ie:
;           "TS=16 TM=8 TF=Times New Roman GC_=Blue SI_=1000"
;           most options are remembered (static), some not (local)
;           Option_= can be used for non-static call, ie:
;           "GC=Blue" makes all future blue, "GC_=Blue" only takes effect once
;           "Wait=ID"   to wait for a notification
;           "Update=ID" to change Title, Message, and Progress Bar (with 'Duration')
;
; Return   ID (Gui Number used)
;          0 if failed (too many open most likely)
;          VarValue if Options includes: Return=VarName
;——————————————————————————————————————————————————————

Notify(Title="Notify()",Message="",Duration="",Options="")
{
 static GNList, ACList, ATList, AXList, Exit, _Wallpaper_, _Title_, _Message_, _Progress_, _Image_, Saved
 static GF := 50 			; Gui First Number
 static GL := 74 			; Gui Last  Number (which defines range and allowed count)
 static GC,GR,GT,BC,BK,BW,BR,BT,BF		; static options, remembered between calls
 static TS,TW,TC,TF,MS,MW,MC,MF
 static SI,SC,ST,IW,IH,IN,XC,XS,XW,PC,PB

 If (Options)			; skip parsing steps if Options param isn't used
 {
  If (A_AutoTrim = "Off")
  {
   AutoTrim, On
   _AutoTrim = 1
  } ; ¶
  Options = %Options%
  Options.=" "			; poor whitespace handling for next parsing step (ensures last option is parsed)
  Loop,Parse,Options,= 		; parse options string at "="s, needs better whitespace handling
  {
      If A_Index = 1		; first option handling
        Option := A_LoopField		; sets options VarName
      Else			; for the rest after the first,
      {			; split at the last space, apply the first chunk to the VarValue for the last Option
        %Option% := SubStr(A_LoopField, 1, (pos := InStr(A_LoopField, A_Space, false, 0))-1)
        %Option% = % %Option%
        Option   := SubStr(A_LoopField, pos+1)	; and set the next option to the last chunk (from the last space to the "=")
      }
  }
  If _AutoTrim
   AutoTrim, Off
  If Wait <>			; option Wait=ID used, normal Notify window not being created
  {
      If Wait Is Number		; waits for a specific notify
      {
        Gui %Wait%:+LastFound		; i'd like to remove this to not affect calling script... 
        If NotifyGuiID := WinExist()	; but think i have to use hWnd's for reference instead of gui numbers which will
        {			; probably happen in my AHK_L transition since gui numbers won't matter anymore
          WinWaitClose, , , % Abs(Duration)	; wait to close for duration
          If (ErrorLevel && Duration < 1)	; destroys window when done waiting if duration is negative
          {			; otherwise lets the calling script procede after waiting the duration (without destroying)
            Gui, % Wait + GL - GF + 1 ":Destroy"	; destroys border gui
            If ST
              DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",ST,"UInt","0x00050001") ; slides window out to the right if ST or SC are used
            Gui, %Wait%:Destroy		; and destroys it
          }
        }
      }
      Else			; wait for all notify's if "Wait=All" is used in the options string
      {			; loops through all existing notify's and performs the same wait logic 
        Loop, % GL-GF		; (with or without destroying if negative or not)
        {
          Wait := A_Index + GF - 1
          Gui %Wait%:+LastFound
          If NotifyGuiID := WinExist()
          {
            WinWaitClose, , , % Abs(Duration)
            If (ErrorLevel && Duration < 1)
            {
              Gui, % Wait + GL - GF + 1 ":Destroy"	; destroys border gui
              If ST
                DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",ST,"UInt","0x00050001") ; slides window out to the right if ST or SC are used
              Gui, %Wait%:Destroy		; and destroys it
            }
          }
        }
        GNList := ACList := ATList := AXList := ""	; clears internal variables since they're all destroyed now
      }
      Return
  }
  If Update <>			; option "Update=ID" being used, Notify window will not be created
  {			; title, message, image and progress position can be updated
      If Title <>
       GuiControl, %Update%:,_Title_,%Title%
      If Message <>
       GuiControl, %Update%:,_Message_,%Message%
      If Duration <>
       GuiControl, %Update%:,_Progress_,%Duration%
      If Image <>
       GuiControl, %Update%:,_Image_,%Image%
      If Wallpaper <>
       GuiControl, %Update%:,_Wallpaper_,%Image%
      Return
  }
  If Style = Save			; option "Style=Save" is used to save the existing window style
  {			; and call it back later with "Style=Load"
   Saved := Options " GC=" GC " GR=" GR " GT=" GT " BC=" BC " BK=" BK " BW=" BW " BR=" BR " BT=" BT " BF=" BF
   Saved .= " TS=" TS " TW=" TW " TC=" TC " TF=" TF " MS=" MS " MW=" MW " MC=" MC " MF=" MF
   Saved .= " IW=" IW " IH=" IH " IN=" IN " PW=" PW " PH=" PH " PC=" PC " PB=" PB " XC=" XC " XS=" MS " XW=" XW
   Saved .= " SI=" SI " SC=" SC " ST=" ST " WF=" Image " IF=" IF
  }			; this needs some major improvement to have multiple saved instead of just one, otherwise pointless
  If Return <>
   Return, % (%Return%)
  If Style <>			; option "Style=Default will reset all variables back to defaults... except options also specified
  {			; so "Style=Default GC=Blue" is allowed, which will reset all defaults and then set GC=Blue
   If Style = Default
    Return % Notify(Title,Message,Duration,	; maybe handled poorly by calling itself, but it saves having to have the defaults set in two areas... thoughts?
(
"GC= GR= GT= BC= BK= BW= BR= BT= BF= TS= TW= TC= TF= 
 MS= MW= MC= MF= SI= ST= SC= IW=
 IH= IN= XC= XS= XW= PC= PB= " Options "Style=")
)			; below are more internally saved styles, which may move to an auxiliary function at some point, but could use some improvement
   Else If Style = ToolTip
    Return % Notify(Title,Message,Duration,"SI=50 GC=FFFFAA BC=00000 GR=0 BR=0 BW=1 BT=255 TS=8 MS=8 " Options "Style=")
   Else If Style = BalloonTip
    Return % Notify(Title,Message,Duration,"SI=350 GC=FFFFAA BC=00000 GR=13 BR=15 BW=1 BT=255 TS=10 MS=8 AX=1 XC=999922 IN=8 Image=" A_WinDir "\explorer.exe " Options "Style=")
   Else If Style = Error
    Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=10 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=")
   Else If Style = Warning
    Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=9 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=")
   Else If Style = Info
    Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 IN=8 IW=32 IH=32 Image=" A_WinDir "\explorer.exe " Options "Style=")
   Else If Style = Question
    Return % Notify(Title,Message,Duration,"SI=250 GC=Default BC=00000 GR=0 BR=0 BW=1 BT=255 TS=12 MS=12 AX=1 XC=666666 Image=24 IW=32 IH=32 " Options "Style=")
   Else If Style = Progress
    Return % Notify(Title,Message,Duration,"SI=100 GC=Default BC=00000 GR=9 BR=13 BW=2 BT=105 TS=10 MS=10 PG=100 PH=10 GW=300 " Options "Style=")
   Else If Style = Huge
    Return % Notify(Title,Message,Duration,"SI=100 ST=200 SC=200 GC=FFFFAA BC=00000 GR=27 BR=39 BW=6 BT=105 TS=24 MS=22 " Options "Style=")
   Else If Style = Load
    Return % Notify(Title,Message,Duration,Saved)
  }
 }
;—————— end if options ————————————————————————————————————————————————————————————————————————————

  GC_ := GC_<>"" ? GC_ : GC := GC<>"" ? GC : "FFFFAA"		; defaults are set here, and static overrides are used and saved
  GR_ := GR_<>"" ? GR_ : GR := GR<>"" ? GR : 9		; and non static options (with OP_=) are used but not saved
  GT_ := GT_<>"" ? GT_ : GT := GT<>"" ? GT : "Off"
  BC_ := BC_<>"" ? BC_ : BC := BC<>"" ? BC : "000000"
  BK_ := BK_<>"" ? BK_ : BK := BK<>"" ? BK : "Silver"
  BW_ := BW_<>"" ? BW_ : BW := BW<>"" ? BW : 2
  BR_ := BR_<>"" ? BR_ : BR := BR<>"" ? BR : 13
  BT_ := BT_<>"" ? BT_ : BT := BT<>"" ? BT : 105
  BF_ := BF_<>"" ? BF_ : BF := BF<>"" ? BF : 350
  TS_ := TS_<>"" ? TS_ : TS := TS<>"" ? TS : 10
  TW_ := TW_<>"" ? TW_ : TW := TW<>"" ? TW : 625
  TC_ := TC_<>"" ? TC_ : TC := TC<>"" ? TC : "Default"
  TF_ := TF_<>"" ? TF_ : TF := TF<>"" ? TF : "Default"
  MS_ := MS_<>"" ? MS_ : MS := MS<>"" ? MS : 10
  MW_ := MW_<>"" ? MW_ : MW := MW<>"" ? MW : "Default"
  MC_ := MC_<>"" ? MC_ : MC := MC<>"" ? MC : "Default"
  MF_ := MF_<>"" ? MF_ : MF := MF<>"" ? MF : "Default"
  SI_ := SI_<>"" ? SI_ : SI := SI<>"" ? SI : 0
  SC_ := SC_<>"" ? SC_ : SC := SC<>"" ? SC : 0
  ST_ := ST_<>"" ? ST_ : ST := ST<>"" ? ST : 0
  IW_ := IW_<>"" ? IW_ : IW := IW<>"" ? IW : 32
  IH_ := IH_<>"" ? IH_ : IH := IH<>"" ? IH : 32
  IN_ := IN_<>"" ? IN_ : IN := IN<>"" ? IN : 0
  XF_ := XF_<>"" ? XF_ : XF := XF<>"" ? XF : "Arial Black"
  XC_ := XC_<>"" ? XC_ : XC := XC<>"" ? XC : "Default"
  XS_ := XS_<>"" ? XS_ : XS := XS<>"" ? XS : 12
  XW_ := XW_<>"" ? XW_ : XW := XW<>"" ? XW : 800
  PC_ := PC_<>"" ? PC_ : PC := PC<>"" ? PC : "Default"
  PB_ := PB_<>"" ? PB_ : PB := PB<>"" ? PB : "Default"

  wPW := ((PW<>"") ? ("w" PW) : (""))		; needs improvement, poor handling of explicit sizes and progress widths
  hPH := ((PH<>"") ? ("h" PH) : (""))
  If GW <>
  {
   wGW = w%GW%
   wPW := "w" GW - 20
  }
  hGH := ((GH<>"") ? ("h" GH) : (""))
  wGW_ := ((GW<>"") ? ("w" GW - 20) : (""))
  hGH_ := ((GH<>"") ? ("h" GH - 20) : (""))
;————————————————————————————————————————————————————————————————————————
 If Duration =				; default if duration is not used or set to ""
  Duration = 30
 GN := GF				; find the next available gui number to use, starting from GF (default 50)
 Loop				; within the defined range GF to GL
  IfNotInString, GNList, % "|" GN
   Break
  Else
   If (++GN > GL)				;=== too many notifications open, returns 0, handle this error in the calling script
    Return 0            	  		; this is uncommon as the screen is too cluttered by this point anyway
 GNList .= "|" GN
 GN2 := GN + GL - GF + 1

 If AC <>				; saves the action to be used when clicked or timeout (or x-button is clicked)
  ACList .= "|" GN "=" AC			; need to add different clicks for Title, Message, Image as well
 If AT <>				; saved internally in a list, then parsed by the timer or click routine
  ATList .= "|" GN "=" AT			; to run the script-side subroutine/label "AC=LabelName"
 If AX <>
  AXList .= "|" GN "=" AX


 P_DHW := A_DetectHiddenWindows			; start finding location based on what other Notify() windows are on the screen
 P_TMM := A_TitleMatchMode			; saved to restore these settings after changing them, so the calling script won't know
 DetectHiddenWindows On			; as they are needed to find all as they are being made as well... or hidden for some reason...
 SetTitleMatchMode 1			; and specific window title match is a little more failsafe
 If (WinExist("_Notify()_GUI_"))  			;=== find all Notifications from ALL scripts, for placement
  WinGetPos, OtherX, OtherY       			;=== change this to a loop for all open notifications and find the highest?
 DetectHiddenWindows %P_DHW%			;=== using the last Notify() made at this point, which may be better
 SetTitleMatchMode %P_TMM%			; and the global settings are restored for the calling thread

 Gui, %GN%:-Caption +ToolWindow +AlwaysOnTop -Border		; here begins the creation of the window
 Gui, %GN%:Color, %GC_%			; with the logic to add or not add certain controls, Wallpaper, Image, Title, Progress, Message
 If FileExist(WP)				; and some placement logic depending if they are used or not... could definitely be improved
 {
  Gui, %GN%:Add, Picture, x0 y0 w0 h0 v_Wallpaper_, % WP	; wallpaper added first, stretched to size later
  ImageOptions = x+8 y+4
 }
 If Image <>				; icon image added next, sized, and spacing added for whats next
 {
  If FileExist(Image)
   Gui, %GN%:Add, Picture, w%IW_% h%IH_% Icon%IN_% v_Image_ %ImageOptions%, % Image
  Else
   Gui, %GN%:Add, Picture, w%IW_% h%IH_% Icon%Image% v_Image_ %ImageOptions%, %A_WinDir%\system32\shell32.dll
  ImageOptions = x+10
 }
 If Title <>				; title text control added next, if used
 {
  Gui, %GN%:Font, w%TW_% s%TS_% c%TC_%, %TF_%
  Gui, %GN%:Add, Text, %ImageOptions% BackgroundTrans v_Title_, % Title
 }
 If PG				; then the progress bar, if called for
  Gui, %GN%:Add, Progress, Range0-%PG% %wPW% %hPH% c%PC_% Background%PB_% v_Progress_
 Else
  If ((Title) && (Message))			; some spacing tweaks if both used
   Gui, %GN%:Margin, , -5
 If Message <>				; and finally the message text control if used
 {
  Gui, %GN%:Font, w%MW_% s%MS_% c%MC_%, %MF_%
  Gui, %GN%:Add, Text, BackgroundTrans v_Message_, % Message
 }
 If ((Title) && (Message))			; final spacing
  Gui, %GN%:Margin, , 8			
 Gui, %GN%:Show, Hide %wGW% %hGH%, _Notify()_GUI_		; final sizing
 Gui  %GN%:+LastFound			; would like to get rid of this to prevent calling script being affected
 WinGetPos, GX, GY, GW, GH			; final positioning
 GuiControl, %GN%:, _Wallpaper_, % "*w" GW " *h" GH " " WP	; stretch that wallpaper to size
 GuiControl, %GN%:MoveDraw, _Title_,    % "w" GW-20 " h" GH-10	; poor handling of text wrapping when gui has explicit size called
 GuiControl, %GN%:MoveDraw, _Message_,  % "w" GW-20 " h" GH-10	; needs improvement (and if image is used or not)
 If AX <>				; add the corner "X" for closing with a different action than otherwise clicked
 {
  GW += 10
  Gui, %GN%:Font, w%XW_% s%XS_% c%XC_%, Arial Black  		; × (multiply) is the character used for the X-Button
  Gui, %GN%:Add, Text, % "x" GW-15 " y-2 Center w12 h20 g_Notify_Kill_" GN - GF + 1, % chr(0x00D7) ;××
 }
 Gui, %GN%:Add, Text, x0 y0 w%GW% h%GH% BackgroundTrans g_Notify_Action_Clicked_ 	; to catch clicks anywhere on the gui
 If (GR_)					; may have to be removed for seperate title/message/etc actions
  WinSet, Region, % "0-0 w" GW " h" GH " R" GR_ "-" GR_
 If (GT_)					; non-functioning GT option, since the border gui gets in the way
  WinSet, Transparent, % GT_				; will be addressed someday, leaving it in

 SysGet, Workspace, MonitorWorkArea				; positioning
 NewX := WorkSpaceRight-GW-5
 If (OtherY)
  NewY := OtherY-GH-2-BW_*2
 Else
  NewY := WorkspaceBottom-GH-5
 If NewY < % WorkspaceTop
  NewY := WorkspaceBottom-GH-5

 Gui, %GN2%:-Caption +ToolWindow +AlwaysOnTop -Border +E0x20		; border gui
 Gui, %GN2%:Color, %BC_%
 Gui  %GN2%:+LastFound
 If (BR_)
  WinSet, Region, % "0-0 w" GW+(BW_*2) " h" GH+(BW_*2) " R" BR_ "-" BR_
 If (BT_)
  WinSet, Transparent, % BT_

 Gui, %GN2%:Show, % "Hide x" NewX-BW_ " y" NewY-BW_ " w" GW+(BW_*2) " h" GH+(BW_*2), _Notify()_BGGUI_ 	; actual creation of border gui! but still not shown
 Gui, %GN%:Show,  % "Hide x" NewX " y" NewY " w" GW, _Notify()_GUI_			; actual creation of Notify() gui! but still not shown
 Gui  %GN%:+LastFound					; need to get rid of this so calling script isn't affected
 If SI_
  DllCall("AnimateWindow","UInt",WinExist(),"Int",SI_,"UInt","0x00040008")		; animated in, if SI is used
 Else
  Gui, %GN%:Show, NA, _Notify()_GUI_				; otherwise, just shown
 Gui, %GN2%:Show, NA, _Notify()_BGGUI_				; and the border shown
 WinSet, AlwaysOnTop, On					; and set to Always on Top

 If ((Duration < 0) OR (Duration = "-0"))				; saves internally that ExitApp should happen when this
  Exit := GN						; notify dissappears
 If (Duration)	
  SetTimer, % "_Notify_Kill_" GN - GF + 1, % - Abs(Duration) * 1000			; timer set depending on Duration parameter
 Else
  SetTimer, % "_Notify_Flash_" GN - GF + 1, % BF_				; timer set to flash border if the Notify has 0 (infinite) duration

Return %GN%					; end of Notify(), returns Gui ID number used

;==========================================================================
;========================================== when a notification is clicked:
_Notify_Action_Clicked_:				; option AC=Label means Label: subroutine will be called here when clicked
 ; Critical
 SetTimer, % "_Notify_Kill_" A_Gui - GF + 1, Off
 Gui, % A_Gui + GL - GF + 1 ":Destroy"
 If SC
 {
  Gui, %A_Gui%:+LastFound
  DllCall("AnimateWindow","UInt",WinExist(),"Int",SC,"UInt", "0x00050001")
 }
 Gui, %A_Gui%:Destroy
 If (ACList)
  Loop,Parse,ACList,|
   If ((Action := SubStr(A_LoopField,1,2)) = A_Gui)
   {
    Temp_Notify_Action:= SubStr(A_LoopField,4)
    StringReplace, ACList, ACList, % "|" A_Gui "=" Temp_Notify_Action, , All
    If IsLabel(_Notify_Action := Temp_Notify_Action)
     Gosub, %_Notify_Action%
    _Notify_Action =
    Break
   }
 StringReplace, GNList, GNList, % "|" A_Gui, , All
 SetTimer, % "_Notify_Flash_" A_Gui - GF + 1, Off
 If (Exit = A_Gui)
  ExitApp
Return

;==========================================================================
;=========================================== when a notification times out:
_Notify_Kill_1:
_Notify_Kill_2:		; this needs a different method, too many labels
_Notify_Kill_3:		; they are used for Timers, different for each Notify() based on duration...
_Notify_Kill_4:
_Notify_Kill_5:
_Notify_Kill_6:
_Notify_Kill_7:
_Notify_Kill_8:
_Notify_Kill_9:
_Notify_Kill_10:
_Notify_Kill_11:
_Notify_Kill_12:
_Notify_Kill_13:
_Notify_Kill_14:
_Notify_Kill_15:
_Notify_Kill_16:
_Notify_Kill_17:
_Notify_Kill_18:
_Notify_Kill_19:
_Notify_Kill_20:
_Notify_Kill_21:
_Notify_Kill_22:
_Notify_Kill_23:
_Notify_Kill_24:
_Notify_Kill_25:
 Critical
 StringReplace, GK, A_ThisLabel, _Notify_Kill_
 SetTimer, _Notify_Flash_%GK%, Off
 GK := GK + GF - 1
 Gui, % GK + GL - GF + 1 ":Destroy"
 If ST
 {
  Gui, %GK%:+LastFound
  DllCall("AnimateWindow","UInt",WinExist(),"Int",ST,"UInt", "0x00050001")
 }
 Gui, %GK%:Destroy
 StringReplace, GNList, GNList, % "|" GK, , All
 If (Exit = GK)
  ExitApp
Return 1

;==========================================================================
;======================================== flashes a permanent notification:
_Notify_Flash_1:
_Notify_Flash_2:
_Notify_Flash_3:
_Notify_Flash_4:		; this needs a different method, too many labels
_Notify_Flash_5:		; they are used for Timers, different for each Notify() based on flash speed...
_Notify_Flash_6:		; when duration is 0 (infinite)
_Notify_Flash_7:		; this may feature may be removed completely, Update given the ability to affect GC and BC
_Notify_Flash_8:		; and then the flashing could be handled script-side via returned gui number and a script-side timer
_Notify_Flash_9:
_Notify_Flash_10:
_Notify_Flash_11:
_Notify_Flash_12:
_Notify_Flash_13:
_Notify_Flash_14:
_Notify_Flash_15:
_Notify_Flash_16:
_Notify_Flash_17:
_Notify_Flash_18:
_Notify_Flash_19:
_Notify_Flash_20:
_Notify_Flash_21:
_Notify_Flash_22:
_Notify_Flash_23:
_Notify_Flash_24:
_Notify_Flash_25:
 StringReplace, FlashGN, A_ThisLabel, _Notify_Flash_
 FlashGN += GF - 1
 FlashGN2 := FlashGN + GL - GF + 1
 If Flashed%FlashGN2% := !Flashed%FlashGN2%
  Gui, %FlashGN2%:Color, %BK%
 Else
  Gui, %FlashGN2%:Color, %BC%
Return
}
Trubbleguy
Posts: 8
Joined: 11 Jul 2014, 03:00

Re: WMPlayer.OCX How to take control of your Media

23 Apr 2016, 17:58

DJ.zip
(94.57 KiB) Downloaded 105 times
:think: Search your Windows folder and its sub folders for *.ico and *.ani files, you will find them in there somewhere....

Just remove any Notify() lines and it works fine, i mostly use notify when testing/debugging as it only shows on the right lower corner of screen when i run a script


i keep formatseconds.ahk in my Documents\Autohotkey\lib folder, sorry i missed that in my posting.....

Code: Select all

if A_Scriptname=formatseconds.ahk
{
msgbox % formatseconds(142.053)	
exitapp
}
FormatSeconds(NumberOfSeconds,delim="1")  ; Convert the specified number of seconds to hh:mm:ss format.
{
    time = 19990101  ; *Midnight* of an arbitrary date.
    time += %NumberOfSeconds%, seconds
    FormatTime, mmss, %time%, mm:ss
    if delim
    {
    stringreplace,mmss,mmss,:,m
    mmss=%mmss%s
	}
    return mmss  ; This method is used to support more than 24 hours worth of sections.
;    return NumberOfSeconds//3600 ":" mmss  ; This method is used to support more than 24 hours worth of sections.
}
Last edited by Trubbleguy on 23 Apr 2016, 18:20, edited 2 times in total.
carno
Posts: 205
Joined: 20 Jun 2014, 16:48

Re: WMPlayer.OCX How to take control of your Media

23 Apr 2016, 18:07

Thanks! Time format is now fixed and shows like in your screenshot. But I still don't get those blue circles on right and left for Stop/Pause/Play.
StanleyH

Re: WMPlayer.OCX How to take control of your Media

01 Dec 2017, 16:57

can you get the name of the file playing in windows 10 wmp?

Return to “Scripts and Functions”

Who is online

Users browsing this forum: AHK_user, Antoine, burque505, guest3456 and 37 guests