Jump to content

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

Practical working scripts


  • Please log in to reply
No replies to this topic
col simpson
  • Members
  • 3 posts
  • Last active: Feb 26 2014 08:09 PM
  • Joined: 08 Jan 2013

This post makes all my scripts available for any comment.

They were written for the experience and as practical widgets when using Windows.

ahk version 1.0.48.5 (2009)

http://colsworld.net...t/ahkscript.zip

 

Example:

This is an easy to use playlist writer (.m3u) usable by most players.

/*
1.0.48.5
written for AHK compiler ( http://www.autohotkey.com/ ) - tested winXp - email me at [email protected] for comments or bugs - col simpson
*/
; ------------------------------------AUTO-EXEC------------------
#NoEnv
SetBatchLines -1
ListLines Off
#SingleInstance force
IfNotExist, %a_mydocuments%\My Playlists
FileCreateDir, %a_mydocuments%\My Playlists 
gui, font, s8 w400 cblack, Microsoft Sans Serif
Gui, Color, EFEFDB
gui,  +toolwindow 
gui,font,s8
gui,margin,15,15
gui,add,text,vnul1 xm ym ,Playlist name :
gui,add,button,vnul2 x+3 yp-3,%a_space%%a_space%%a_space%%a_space%%a_space%%a_space%%a_space%File%a_space%%a_space%%a_space%%a_space%%a_space%%a_space%%a_space%
gui,add,button,vadply x+15 ,%a_space%%a_space%Add to Playlist%a_space%%a_space%
gui,add,text,xm y+3,Creating list in...
gui,add,text,vindic xm y+2 w250 ,
gui,add,text,xm y+2,in My Documents\My Playlists
gui, font, s8 w400 underline cblack, Microsoft Sans Serif
gui,add,text,ghelp x20 y+5 cblue,Help
gui, font, normal
gui,show,,%a_space% Playlist Maker.
guicontrol,disable,adply
onexit,guiclose
return

buttonNewlist:
buttonFile:
fileselectfile,plname,,%a_mydocuments%\My Playlists,Select a list to add tracks - or create a new Playlist.,(*.m3u)
if plname=
return
lstdisp=
lstdispfull=
SplitPath, plname,,,ext
if ext=
plname:=plname ".m3u"
IfnotExist, %plname%
fileappend,,%plname%
FileRead, lstdispfull, %plname%
stringreplace,lstdispfull,lstdispfull,`n,|,all
loop,parse,lstdispfull,|
{
SplitPath, a_loopfield,item
lstdisp:=lstdisp item "|"
}
gui,4:destroy
gosub displ
gosub indicator
return
;--------------------------------------ADD TO LIST-----------------------
buttonAddtoPlaylist:
FileSelectFile, items, m 8,%a_mydocuments%, Select File(s) to add to Playlist (use 'Ctrl' or 'Shift' to multi-select),
if items=
return
gui,submit,nohide
dpath=
ilist=
loop,parse,items,`r`n
{
if a_index=1
{
dpath=%a_loopfield%
stringright,isslsh,dpath,1
if isslsh=\
stringtrimright,dpath,dpath,1
}
else
{
ilist:=ilist dpath "\" a_loopfield "`r`n"
lstdisp:=lstdisp a_loopfield "|"
}
}
Fileappend,%ilist%, %plname%
gui,4:destroy
gosub displ
return

;---------------------------------------------------------
indicator:
if plname=
{
guicontrol,,indic,
guicontrol,disable,adply
return
}
guicontrol,enable,adply
SplitPath, plname,plnameshort
guicontrol,,indic,%plnameshort%
guicontrol,,nul2,NEW list
return
;----------------------------------------------------------------------------------------
guiclose:
exitapp
return

4guiclose:
gui,4:destroy
return

5guiclose:
gui,5:destroy
return

displ:
gui, 4:font, s9 w400 cblack, Microsoft Sans Serif
Gui, 4:Color, EFEFDB
Gui, 4:margin, 10,10
gui,4: +toolwindow +owner -caption 0x800000
SplitPath, plname,plnameshort
gui,4:add,text,xm ym,%a_space%Playlist "%plnameshort%"
gui,4:add,text,xm y+2, %a_space%  These are the files currently SAVED in this list -
gui, 4:add, listbox,xm y+5 w380 r30 ReadOnly, %lstdisp%
WinGetPos , xxx, yyy, www, hhh, %a_space% Playlist Maker.
xxx:=xxx+www+11
gui, 4:show, x%xxx%, %a_space%  Current Playlist - "%plname%".
send {end}
return

help:
IfWinexist, %a_space%  Guide to editing...
{
gosub 5guiclose
return
}
Gui, 5:Color, EFEFDB
gui, 5:font, s9 w400 cblack, Microsoft Sans Serif
Gui, 5:margin, 10,10
gui,5: +toolwindow +owner +owndialogs 
gui, 5:add, text,ym w380, .m3u playlists will work for any player (WindowsMedia, Winamp, VLC, MediaPlayerClassic, etc). Right-click the .m3u file, > Open with > Choose program to choose default player.`n  To edit the playlist right-click the .m3u file, > Open with > C:\Windows\Notepad.exe.`n  You can cut and paste full lines to re-order, delete or add entries - even copy another list and paste it in.`n  Each line is a playlist entry and must contain the full path to the file (any audio or video).`n  If the media files are stored at a location that may change (e.g USB Drive), the playlist may not work. You could use Edit > Replace to change the Drive letter of all entries.`n  If you want Windows to show what file-types all your files are - in 'explorer' go to View > Folder options > View tab and untick 'Hide extensions for known file types'.`n                                    Col Simpson.
WinGetPos , xxx, yyy, www, hhh, %a_space% Playlist Maker.
xxx-=405
gui, 5:show, x%xxx%, %a_space%  Guide to editing...
return