Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

mp3 player using bass.dll with option to set Album Cover Art


  • Please log in to reply
11 replies to this topic
closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
Thanks to Toralf's bass.ahk library and Tic's Gdip.ahk library it is relative simple to make a mp3 player like a widget.

Posted Image

I only used it together with the font Mistral that is used in some microsoft office installations.The mistral.ttf is in the zip file it is a smaller free version.

Updated on 27 05 2011 !

The zip file containing all code ,bass.dll and demo art/mp3 is here:
<!-- m -->https://ahknet.autoh...nh00/player.zip<!-- m -->

It contains .ahk code file but also an .exe created using autohotkey_L unicode so it will be able to read and display unicode titles from the playlist.


I am to lazy to write a manual so better take a look at the code or just click around till you have it working :)

The cover art is only set if it has the same name as the mp3 and is in the coverart subdir.The image must be 81x81 but there is a function at the end of the code for resizing.

Ferry
  • Members
  • 37 posts
  • Last active: Mar 21 2014 10:12 AM
  • Joined: 18 May 2008
Looks really cool. I was looking for a way to get back to the main screen after adjusting the volume. Took me some time to understand that i had to move the mousepointer from the player. :roll:

Apart from that i really love this little mp3 player. 8)

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
If you use autohotkey_l ansi version (unicode does not work!) you get an error from the bass.ahk library.

You only need to remove the quotation marks in line 394

38 BASS_ERROR_DECODE   the channel is a "decoding channel"

@Ferri

It was intentional i was bored to have to click on a button when just changing the volume so just leaving the gui would reset it to the main menu. :)

Originally hovering over the loudspeaker would enter the option menu but that proved to have side effects.

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
Arigatou SooyKe :)

screencast unicode version (by sooyke :) )
<!-- m -->http://www.screenr.com/PBI<!-- m -->


very funny :) thanks for testing and your comments you will find the final unicode version here i still have to look into the playlist problem:

<!-- m -->https://ahknet.autoh...nh00/player.zip<!-- m -->

update: the problem is that the playlist must be saved in UTF-8 so you have to change the setting when you "save as" :oops:

updated the player.zip to be able to read the playlists as UTF-8 and in winxp the trayicon was not visible replaced it with standard ahk trayicon.

michika
  • Members
  • 1 posts
  • Last active: Sep 04 2011 06:11 AM
  • Joined: 30 May 2011
woow really cool!

If i add some japanese anime theme songs they are not displayed as japanese ....how come?

The demo playlist is displayed properly ???

Is there a playlist editor somewhere ?

Thanks!

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008

are not displayed as japanese


Do you mean they just ascii with ???????? characters in it?

Are the files properly displayed in windows explorer?

You need to save playlist as UTF-8 format.I corrected the encoding in the latest version but if the coding was wrong it would give the error "file not found" so that looks different.

There is no editor in the code,there are two debug leftovers CtrlF2 gives a message box with the current playlist (or folder list) and Ctrl+Alt+F2 adds the current playing song to the default playlist ( there is a message box Hi just to confirm that something is happening :) )

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
Playlist editor for mp3 player added and removed some bugs.I have a lot of filenames with japanese characters so the player is made with ahk_L unicode and compiled to exe so it can be used on any system.

There are two exe files player.exe and playlist_editor.exe the last one is run when rightclicking the player window.It can also be run directly.


It also has a cover art editor embedded to resize clipboard image to cover art and set the correct filename.

screenshot:

<!-- m -->https://ahknet.autoh...nh00/player.png<!-- m -->


download:

<!-- m -->https://ahknet.autoh...nh00/player.zip<!-- m -->


The player is adapted to receive commands from the editor so the old player version will not respond to the play command from the editor.But it can be used standalone.

The playlists are plain text files but they need to be saved in UTF-8 format.(Even NotePad has this option)

If you forget you get file not found error even if the files are there.

There is a file exist check that can be enabled in the traymenu to verify that the files in the playlist are really there and accessible this can take some time if network places are involved!

The ahk code is here:

<!-- m -->https://sites.google... ... ditor-code<!-- m -->


<!-- m -->https://sites.google... ... layer-code<!-- m -->

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
Update for playlist_editor.ahk.Improved the quality of the cover_art after resizing it.

If you use ahk_basic remove the line:
FileEncoding,UTF-8 ;remove if used with AHK_basic or AHK_L ansi

This is only the updated code for the playlist_editor you need the player.ahk and associated files/images (see provious post) too!!


#SingleInstance, Force
#NoEnv
SetBatchLines, -1

; Uncomment if Gdip.ahk is not in your standard library

;Thanks to Tic for his work creating the gdip library http://www.autohotkey.com/forum/topic32238.html
#Include, Gdip.ahk



;-----------------------------------------------------------------------------------------------
FileEncoding,UTF-8  ;remove if used with AHK_basic or AHK_L ansi
;-----------------------------------------------------------------------------------------------







If !pToken := Gdip_Startup()
{
    MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
    ExitApp
}
OnExit, Exit




h=440
w=470
n=12
m=61 ;distance to first line

IfNotExist, i_playlisteditor.ini
{
IniWrite,0, i_playlisteditor.ini, parameters, check
IniWrite,1, i_playlisteditor.ini, parameters, tooltip
sleep 1000
}

IfExist, i_playlisteditor.ini
{
IniRead,enable_check, i_playlisteditor.ini, parameters, check
IniRead,enable_help, i_playlisteditor.ini, parameters, tooltip
}



Menu, Tray,add,enable file_exist check, enable_check
Menu, Tray,add,enable tooltip, enable_tooltip
Menu, Tray,add,exit ,exit
Menu, Tray, nostandard

image_dir=%a_scriptdir%\images

status_page=1

font =arial
If !hFamily := Gdip_FontFamilyCreate(Font)
{
MsgBox,  Font error! exit app!
exitapp
}

playlistfullfilename=%a_scriptdir%\playlist\playlist_default.txt

image_notmarked=%image_dir%\notmarked.png

image_marked=%image_dir%\marked.png

image_arrowr=%image_dir%\arrowr.png

image_arrowl=%image_dir%\arrowl.png

image_save=%image_dir%\save.png

image_buttons=%image_dir%\buttons2.png

image_close=%image_dir%\close.png

pnotmarked:=Gdip_CreateBitmapFromFile(image_notmarked)
pmarked:=Gdip_CreateBitmapFromFile(image_marked)
pnotmarked:=Gdip_CreateBitmapFromFile(image_notmarked)
parrowr:=Gdip_CreateBitmapFromFile(image_arrowr)
parrowl:=Gdip_CreateBitmapFromFile(image_arrowl)
psave:=Gdip_CreateBitmapFromFile(image_save)
pbuttons:=Gdip_CreateBitmapFromFile(image_buttons)
pclose:=Gdip_CreateBitmapFromFile(image_close)

Gui, 1:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner 
Gui, 1: Show, NA x0 y0
gui +lastfound
hwnd := WinExist()


hbm := CreateDIBSection(w,h)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
pGraphics := Gdip_GraphicsFromHDC(hdc)

pBrush := Gdip_BrushCreateSolid(0xde000000)
pBrush_b := Gdip_BrushCreateSolid(0xff000000)
pPen:=Gdip_CreatePen(0xff000000,1)
pPen1:=Gdip_CreatePen(0xff383838,1)
pPen2:=Gdip_CreatePen(0xff000000,2)
Gdip_FillRectangle(pGraphics, pBrush, 0, 0, w,h)
UpdateLayeredWindow(hwnd, hdc,0,0,w,h)

WinMove, ahk_id %hwnd%,,100,200

OnMessage(0x200,"WM_Move"), OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x201, "WM_LBUTTONDOWN")
VarSetCapacity(TME,16,0), NumPut(16,TME,0), NumPut(2,TME,4), NumPut(hwnd,TME,8)

gosub read_playlist
gosub redraw_gui



if enable_check
menu, tray, ToggleCheck,enable file_exist check

if enable_help
menu, tray, ToggleCheck,enable tooltip




Return


;---------------- ---------------- ---------------- ---------------- ---------------- 


WM_MOVE( wParam, lParam, Msg ) {
   Global TME
   global status_set
   global alert_leave
   global enable_help
   x:=lParam &0xFFFF, y:=lParam>>16


   DllCall( "TrackMouseEvent","uint",&TME )
   SetTimer, show_t,300
   alert_leave=1
   
if !enable_help
return
if y between 400 and 425
    {
    if x between 20 and 53
    {
    status_set=010000
    return
    }
    if x between 74 and 107
    {
    status_set=100000
    return
    }
    if x between 184 and 207
    {
    status_set=001000
    return
    }
    if x between 233 and 257
    {
    status_set=000100
    return
    }
    
    if x between 273 and 305
    {
    status_set=000010
    return
    }
    if x between 413 and 450
    {
    status_set=000001
    return
    }
    status_set=0
    }
else
status_set=0
}

show_t:
gosub set_title
if !alert_leave
SetTimer, show_t,off
return 

OnMouseLeave(){
global alert_leave
alert_leave=0
return
}



set_title:
title=

Gdip_SetClipRect(pGraphics, 0, 372, 470, 20)
Gdip_SetCompositingMode(pGraphics, 1)

Gdip_FillRectangle(pGraphics, pBrush, 0, 0, w,h)
if !(status_set=000000)
Gdip_FillRectangle(pGraphics, pBrush_b, 0, 0, w,h)

Gdip_SetCompositingMode(pGraphics, 0)

if (status_set="100000")
title=OPEN      +SHIFT  create playlist from folder       +CTRL add playlist file
if (status_set="010000")
if (status_set="010000")
title=SAVE TO          +SHIFT  remove unmarked songs from display
if (status_set="001000")
title=PLAY selected songs
if (status_set="000100")
title=RESET reload original data                  +CTRL set current data as original
if (status_set="000010")
title=SEARCH   Space separator for OR function (air blue    will list files with air or blue)
if (status_set="000001") 
title=SET ART   +SHIFT  set imagefile to clipboard +CTRL show clipboard (if image)
if (!status_set or !alert_leave)
title=

Options = x5 y375 w460 cff2E95FC Center NoWrap r4 s12
rc:=Gdip_TextToGraphics(pGraphics, title, Options, font)

UpdateLayeredWindow(hwnd, hdc)
Gdip_ResetClip(pGraphics)

return


enable_check:
enable_check :=!enable_check
IniWrite,%enable_check%, i_playlisteditor.ini, parameters, check
menu, tray, ToggleCheck, enable file_exist check
return

enable_tooltip:
enable_help :=!enable_help
IniWrite,%enable_help%, i_playlisteditor.ini, parameters, tooltip
menu, tray, ToggleCheck, enable tooltip
return

show_clipboard:
pBitmap_t:=Gdip_CreateBitmapFromClipboard()

if (pBitmap_t=-2)
{
msgbox error %pBitmap% no image data
gosub 4guiclose
}
Width := Gdip_GetImageWidth(pBitmap_t), Height := Gdip_GetImageHeight(pBitmap_t)
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap_t)
gui, 4: color,black
Gui, 4: Add, Picture, x10 y+30 w%Width% h%Height% 0xE hwndImage
Gui, 4: Show, AutoSize
SetImage(Image, hBitmap)
Gdip_DisposeImage(pBitmap_t)
return

set_to_clipboard:
FileSelectFile, file,,,Load imagefile to clipboard,(*.bmp;*.png;*.gif;*.jpg;*.jpeg)

if errorlevel
{
msgbox error set will exit
exit
}

pBitmap_temp:=Gdip_CreateBitmapFromFile(File)
Gdip_SetBitmapToClipboard(pBitmap_temp)
gdip_disposeimage(pBitmap_temp)
sleep 300
Gosub, show_clipboard
return



4guiclose:
Gdip_DisposeImage(pBitmap_t)
gui,4: destroy
exit
return


search:
gui,2: +toolwindow
gui,2:add,edit,w250 h20  gsearch hwndhwnd_search
gui,2:add,button,xp+270 gsearch_start
gui,2:show,na ,searchplaylist

WinGet, hwnd_search,ID,searchplaylist
WinActivate, searchplaylist
return


2guiclose:
gui,2:destroy
return



trigger_player:
status_play=1
file_to_save=%a_scriptdir%\playlist\playlist_edited.txt

gosub get_selected

if record_data=
{
MsgBox, no files selected
gosub reset
exit
}
gosub get_songfile

IfExist, %file_to_save%
FileDelete, %file_to_save%
Sleep 200
FileAppend, %temp%,%file_to_save%
sleep  200

gui,3:add,edit,w120 h20
gui,3:show,na x-200  ,plaiereditwindow

status_play=0
return


set_coverart:
if getkeystate("shift")
goto set_to_clipboard
if getkeystate("ctrl")
goto show_clipboard

record_data_cover:=record_data

loop,parse,record_data,`n
cover_n:=A_Index
counter2=0
selected_file=

loop %cover_n%
{
filepath=
marker:=get_marker(A_Index,record_data)
if marker
{
counter2++
marker=0
}
}
if counter2>1
  {
  msgbox %counter2% selected files.Please select only one!
  exit
  }
if (counter2=0)
  {
  msgbox no selected song found will exit
  exit
  }
loop %cover_n%
{
filepath=
marker:=get_marker(A_Index,record_data)
if marker
  {
  filepath:=get_filename(A_Index,record_data)
  break
  }
}
gosub get_selected
gosub redraw_gui

if !check_clipboard()
error_text=There is no image data on the clipboard!!!!
else
error_text=

text_2=
    (
    selected file = %filepath%
        
    Continue to set/resize clipboard image as cover_art?
    )
msgbox,4,, %text_2%
IfMsgBox,no
  {
  gosub reset_cover_selection
  exit
  }
text_2=
    (
    %error_text%
    
    Please set the image you want as coverart on the clipboard before next step !!
    
    
    The image will be autosized to 82 82 pixels.
    )
msgbox,1,,%text_2%
IfMsgBox,no
  {
  gosub reset_cover_selection
  exit
  }
if !check_clipboard()
  {
  MsgBox, no image data found  !!! exit
  gosub reset_cover_selection
  exit
  }
SplitPath, filepath,,,,outfilename
source_file=clipboard
out_file=%a_scriptdir%\coverart\%outfilename%.png
convert_resize(source_file,out_file,"k_fixed_width_height","81|81","0xde000000")
gosub reset_cover_selection
return

reset_cover_selection:
record_data:=record_data_cover
record_data_cover=
gosub redraw_gui
return



check_clipboard(){
pBitmap_:=Gdip_CreateBitmapFromClipboard()
Gdip_DisposeImage(pBitmap_)
if (pBitmap_=-2)
return 0
else
return 1
}

guicontextmenu:
inputbox ,page,goto page number,input page to go to!,,200,120,500
if errorlevel
exit
if (page<1)
page=1
if (page>pages)
  {
  msgbox last page = %pages%
  status_page:=pages
  }
else
status_page:=page
Gosub, redraw_gui
return

search_start:
n=0
record_data_search=
controlgettext,search_string,,ahk_id %hwnd_search%
if (search_string="")
exit
StringReplace, search_string,search_string,%a_space%,`,,all
Loop, parse,record_data,`n
  {
    StringSplit, array,A_LoopField,|
    
    if array2 contains %search_string%,
    record_data_search .=a_loopfield "`n"
    counter++
    n++
  }
record_data:=record_data_search
record_data:=set_marker(record_data)
status_page=1
gosub get_pages
gosub redraw_gui
return

reset:
if getkeystate("ctrl")
  {
  msgbox,4,destroy original data_set!!,Take current selection as base data_set?
  IfMsgBox, Yes
  record_data_original:=record_data
  exit
  }
record_data:=record_data_original
gosub get_pages
status_page=1
Gosub, redraw_gui
return

guidropfiles:
drop_list=
outext=
record_data_drop=
Loop, parse, A_GuiEvent, `n
  {
  splitpath,A_LoopField,,,outext,outfilename
  if (outext="mp3")
  record_data_drop .=a_loopfield "|" outfilename "|" marker "|" "`n"
  }
StringTrimRight, record_data_drop,record_data_drop,1
record_data .= record_data_drop "`n"
record_data_original:=record_data
gosub redraw_gui
return

read_playlist:
list=
marker=0
record_data_or=
record_data=
status_page=1
loop,read,%playlistfullfilename%
  {
  If (A_LoopReadline!="")
    {
    list .=((A_Index=1) ? "" : "`n") a_loopreadline 
    n:=A_Index
    }
  }
gosub make_database
gosub get_pages
return


add_playlist:
FileSelectFile, playlistfullfilename,,%a_scriptdir%\playlist,Add files of PlayList ,playlist  (*.txt)
if errorlevel
exit
record_data_list=
loop,read,%playlistfullfilename%
{
If (A_LoopReadline!="")
  {
  splitpath,A_LoopReadline,,,outext,outfilename
  if (outext="mp3")
  record_data_list .=A_LoopReadline "|" outfilename "|" marker "|" "`n"
  }
}
record_data .= record_data_list "`n"
record_data_original:=record_data
gosub redraw_gui
return


create_folderlist:
list=
record_data=
FileSelectFolder, selected_folder,*C:\,,create mp3list from folder

loop,%selected_folder%\*.mp3

list .=A_LoopFileFullPath "`n"
gosub make_database
gosub get_pages
status_page=1
record_data:=set_marker(record_data)
gosub redraw_gui
return


make_database:
record_data=
loop,parse,list,`n
{
SplitPath, a_loopfield,outfilename

if enable_check
    {
    IfNotExist, %A_LoopField%
    Continue
    }

If (A_LoopField!="")
  {
  record_data .=a_loopfield "|" outfilename "|" marker "|" "`n"
  n:=A_Index
  }
}
record_data_original:=record_data
return



redraw_gui:
gosub get_pages

points=10,48|460,48|460,370|10,370|10,48
m=61
counter=0

Gdip_SetCompositingMode(pGraphics, 1)
Gdip_FillRectangle(pGraphics, pBrush, 0, 0, w,h)
Gdip_SetCompositingMode(pGraphics, 0)
Gdip_DrawImage(pGraphics, parrowr, 130, 5, 30, 40)
Gdip_DrawImage(pGraphics, parrowl, 5, 5, 30, 40)
Gdip_DrawImage(pGraphics, pbuttons, 0,390,470,42)
Gdip_DrawImage(pGraphics, pclose, 434,5,30,30)
Gdip_DrawLines(pGraphics, pPen2, Points)
Gdip_SetCompositingMode(pGraphics, 0)

loop 15
{
counter++

pos:=pos2i(counter)
songname:=get_songname( pos,record_data)

if (songname !="")
{

x1:=15 ,x2:=w-45
y1:=y2:=57+20*(A_Index-1)

if A_Index>1
  {
  Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
  y1:=y1+1
  y2:=y1
  Gdip_DrawLine(pGraphics, pPen1, x1, y1, x2, y2)
  }
ym:=y1+3
marker:=get_marker(pos2i(counter),record_data)

if (marker=0)
  {
  status_image:=pnotmarked
  Gdip_DrawImage(pGraphics, status_image, x2+10, ym, 15, 15)
  }
else
  {
  status_image:=pmarked
  Gdip_DrawImage(pGraphics, status_image, x2+10, ym, 15, 15)
  }
Options = x25 y%m% w380 cffffffff Left NoWrap r4 s12
rc:=Gdip_TextToGraphics(pGraphics, SubStr(songname,1,50), Options, font)
}
m +=20

}
page_display=%status_page%/%pages%
Options = x30 y17 w100 cffffffff Center NoWrap r4 s16
rc:=Gdip_TextToGraphics(pGraphics,page_display, Options, font)

UpdateLayeredWindow(hwnd, hdc)
return


get_selected:
n=0
record_data_temp=
loop,parse,record_data,`n
{
StringSplit, array,A_LoopField,|
  if array3
  {
    record_data_temp .=  A_LoopField "`n"
    n++
  }
}
StringTrimRight, record_data_temp,record_data_temp,1
record_data :=record_data_temp
if status_play
status_page=1
gosub redraw_gui
return

get_songfile:
temp=
loop,parse,record_data,`n,`r
{
StringSplit, array,A_LoopField,|
If (A_LoopField!="")
temp .= array1 "`n"

}
stringtrimright,temp,temp,1
return


load:
if getkeystate("shift")
goto create_folderlist

if getkeystate("ctrl")
goto add_playlist

FileSelectFile, playlistfullfilename,,%a_scriptdir%\playlist,,playlist or single (*.txt; *.mp3)
if errorlevel
exit
pages=0
gosub read_playlist
gosub redraw_gui
return

save:
status_page=1
gosub get_selected
gosub get_songfile

if getkeystate("shift")
exit

if (temp="")
{
msgbox no files selected !!
gosub reset
return
}

fileselectfile,file_to_save,S 24,,,Text Documents (*.txt)
status_page=1
SplitPath, file_to_save,,,outext

if (outext<>"txt")
file_to_save=%file_to_save%.txt

IfExist, %file_to_save%
FileDelete, %file_to_save%
Sleep, 500
FileAppend, %temp%,%file_to_save%
gosub redraw_gui
record_data:=clear_marker(record_data)
gosub redraw_gui
return

_update:
record_data:=toggle_marker(pos2i(status_pos),record_data)
gosub redraw_gui
return 



page_add:
if (status_page <= pages-1)
status_page++
gosub redraw_gui
return

page_min:
if (status_page >= 2)
status_page--
gosub redraw_gui
return


get_pages:
Loop, parse,record_data,`n
n:=A_Index

a:=mod(n,15)
b:=floor(n/15)

if (a>0) and (b<=0)
pages:=1
else
pages:=b+1
return

toggle_marker(index,list){
Loop, parse,list,`n
{
if (A_Index=index)
  {
  StringSplit, array,A_LoopField,|
  status:=((array3=0) ? 1 : 0)
  new_field:=array1 "|" array2 "|" status "|"
  list_ .=new_field "`n"
  }
else
If (A_LoopField!="")
list_ .=A_LoopField "`n"
}
return list_
}

clear_marker(list){
  Loop, parse,list,`n
  {
  If (A_LoopField!="")
  {
  StringSplit, array,A_LoopField,|
  new_field:=array1 "|" array2 "|" "0|"
  list_ .=((A_Index=1) ? "" : "`n") new_field 
  }
  }
  return list_
  }

^a::
record_data:=set_marker(record_data)
gosub redraw_gui
return


^+a::
record_data:=clear_marker(record_data)
Gosub, redraw_gui
return


set_marker(list){
  Loop, parse,list,`n
  {
  If (A_LoopField!="")
  {
  StringSplit, array,A_LoopField,|
  new_field:=array1 "|" array2 "|" "1|"
  list_ .=((A_Index=1) ? "" : "`n") new_field 
  }
  }
  return list_
  }



get_marker(index,list){
  Loop, parse,list,`n
  if (A_Index=index)
    {
    StringSplit, array,A_LoopField,|
    break
    }
  return array3
  }

get_songname(index,list){
  Loop, parse,list,`n
  if (A_Index=index)
    {
    StringSplit, array,A_LoopField,|
    break
    }
  return array2
  }

get_filename(index,list){
  Loop, parse,list,`n
  if (A_Index=index)
    {
    StringSplit, array,A_LoopField,|
    break
    }
  return array1
}


set_marker_1(index,list){
  Loop, parse,list,`n
  if (A_Index=index)
    {
    StringSplit, array,A_LoopField,|
    new_field:=array1 "|" array2 "|" "1|"
    list_ .=new_field "`n"
    }
  else
  list_ .=A_LoopField "`n"
  return list_
  }

set_marker_0(index,list){
  Loop, parse,list,`n
  if (A_Index=index)
    {
    StringSplit, array,A_LoopField,|
    new_field:=array1 "|" array2 "|" "0|"
    list_ .=new_field "`n"
    }
  else
  list_ .=A_LoopField "`n"
  return list_
  }



pos2i(pos){
  global status_page
  s:=status_page-1
  a:=pos+s*15
  return a
  }




WM_LBUTTONDOWN(wParam, lParam)
{
    global

    
    Xe := lParam & 0xFFFF
    Ye := lParam >> 16
  
    
    
    
if ye<30
{

if xe between 10 and 35
{
gosub page_min

exit
}
if xe between 125 and 150
{
gosub page_add

exit
}

if xe between 434 and 464
{
gosub exit

exit
}

}

if ye between 400 and 425
{

if xe between 20 and 53
{
gosub save
exit
}

if xe between 74 and 107
{
gosub load
exit
}

if xe between 273 and 300
{
gosub search
exit
}

if xe between 233 and 257
{
gosub reset
exit
}

if xe between 184 and 200
{
gosub trigger_player
sleep 2000
gui,3:destroy
exit
}

if xe between 413 and 450
{
gosub set_coverart
exit
}



}

if ye between 57 and 380
{    

if ye between 57 and 77
{
status_marker1 :=!status_marker1
status_pos=1

gosub _update
exit
}
if ye between 77 and 97
{
status_marker2 :=!status_marker2
status_pos=2

gosub _update
exit
}
if ye between 97 and 117
{
status_marker3 :=!status_marker3
status_pos=3

gosub _update
exit
}
if ye between 117 and 137
{
status_marker4 :=!status_marker4
status_pos=4

gosub _update
exit
}
if ye between 137 and 157
{
status_marker5 :=!status_marker5
status_pos=5

gosub _update
exit
}
if ye between 157 and 177
{
status_marker6 :=!status_marker6
status_pos=6

gosub _update
exit
}
if ye between 177 and 197
{
status_marker7 :=!status_marker7
status_pos=7

gosub _update
exit
}
if ye between 197 and 217
{
status_marker8 :=!status_marker8
status_pos=8

gosub _update
exit
}
if ye between 217 and 237
{
status_marker9 :=!status_marker9
status_pos=9

gosub _update
exit
}
if ye between 237 and 257
{
status_marker10 :=!status_marker10
status_pos=10

gosub _update
exit
}
if ye between 257 and 277
{
status_marker11 :=!status_marker11
status_pos=11

gosub _update
exit
}
if ye between 277 and 297
{
status_marker12 :=!status_marker12
status_pos=12

gosub _update
exit
}
if ye between 297 and 317
{
status_marker13 :=!status_marker13
status_pos=13

gosub _update
exit
}
if ye between 317 and 337
{
status_marker14 :=!status_marker14
status_pos=14

gosub _update
exit
}
if ye between 337 and 357
{
status_marker15 :=!status_marker15
status_pos=15

gosub _update
exit
}
}

PostMessage, 0xA1, 2

}


convert_resize(source_file,out_file,function="",value=1,color="0xff000000"){



if (source_file="clipboard")
pBitmapFile :=Gdip_CreateBitmapFromClipboard()
else
pBitmapFile :=Gdip_CreateBitmapFromFile(source_file)

Width := Gdip_GetImageWidth(pBitmapFile), Height := Gdip_GetImageHeight(pBitmapFile)
ratio=1
if (function = "k_ratio")
{
ratio:=value
w:=width*ratio
h:=height*ratio
}
if (function = "k_width")
{
ratio:=value/width
w:=width*ratio
h:=height*ratio
}
if (function = "k_height")
{
ratio:=value/height
w:=width*ratio
h:=height*ratio
}

if (function = "k_fixed_width_height")
{
stringsplit,out,value,|
wf:=out1
hf:=out2

if !wf or ! hf
{
msgbox error in value parameter for fixed width and height

return
}

if (width>wf)
{
r1:=wf/width

  w:=wf
  h:=height*r1
  
    if (h>hf)
    {
    r2:=hf/h
    w:=w*r2
    h:=hf
    }
}
else
{
if (width<wf) and (height<hf)
{
w:=width
h:=height
}
else
{
r1:=hf/height

  h:=hf
  w:=width*r1
  
    if (w>wf)
    {
    r2:=wf/w
    w:=wf
    h:=hf*r2
    }
}
}
}

if (function = "k_fixed_width_height")
pBitmap := Gdip_CreateBitmap(wf, hf)
else
pBitmap := Gdip_CreateBitmap(w,h)

G := Gdip_GraphicsFromImage(pBitmap)
Gdip_SetSmoothingMode(G, 4)
Gdip_SetInterpolationMode(G, 7)

if (function = "k_fixed_width_height")
{
pbrush:=Gdip_BrushCreateSolid(color)
Gdip_FillRectangle(G, pBrush, 0, 0, wf, hf)

x:=floor((wf-w)/2)
y:=floor((hf-h)/2)
}
else
{
x=0
y=0
}



Gdip_DrawImage(G, pBitmapFile, x, y, w, h, 0, 0, Width, Height)
Gdip_SaveBitmapToFile(pBitmap, out_file)
if (function = "k_fixed_width_height")
Gdip_DeleteBrush(pBrush)
Gdip_DisposeImage(pBitmapFile)
Gdip_DisposeImage(pBitmap)
Gdip_DeleteGraphics(G)

}





Exit:
Gdip_DisposeImage(image_notmarked)
Gdip_DisposeImage(image_marked)
Gdip_DisposeImage(image_arrowr)
Gdip_DisposeImage(image_arrowl)
Gdip_DisposeImage(image_save)
Gdip_DisposeImage(image_close)
Gdip_DisposeImage(image_buttons)

Gdip_DeleteBrush(pBrush)
Gdip_DeleteBrush(pBrush_b)
Gdip_DeletePen(pPen)
Gdip_DeletePen(pPen1)
Gdip_DeletePen(pPen2)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(pGraphics)

Gdip_Shutdown(pToken)
ExitApp
Return


  • Guests
  • Last active:
  • Joined: --
Thanks the editor is really useful ,if found there is a small bug when you drag and drop a file in the listing the filename has no extension.But saving the playlist is ok the filenames are correct.

I have a small request if you update it to include a per page "mark all" button ,Ctrl-a will mark the whole listing but selecting parts would be easier on a page by page marking.

Thanks :)
Michika

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008

small bug when you drag and drop a file


Thanks will take a look at it .I planned to have a look at the search and select function too (realtime updating of list).

I will look at the mark per page . :)

closed
  • Members
  • 509 posts
  • Last active: Jan 14 2012 06:14 PM
  • Joined: 07 Feb 2008
Updated the playlist editor and removed the bug.

screenshot:
<!-- m -->https://ahknet.autoh...ist__editor.png<!-- m -->


- removed the bug
- search and select view is updated "as you type"
- mark/unmark for page added

Zip file contains all ahk code (basic and ahk_l)and compiled exe versions using ahk unicode .

<!-- m -->https://ahknet.autoh...nh00/player.zip<!-- m -->

  • Guests
  • Last active:
  • Joined: --
the link is broken. If anyone have, please upload .thanks.