 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Serenity
Joined: 07 Nov 2004 Posts: 1271
|
Posted: Thu Mar 24, 2005 5:12 pm Post subject: Create Playlist - Explorer shell menu extension |
|
|
Here is a simple script that creates an .m3u playlist file via the Explorer shell menu. If the user right-clicks on a folder, it will create an m3u list based on the audio files inside that folder. If the user right-clicks on a file, it will create an m3u list based on audio files that reside in the files current directory.
This script can be installed uncompiled by specifying the path to AutoHotkey.exe in the command line. Sample registry keys required to link it to the shell menu are posted below along with the source code.
Recognised audio formats:
WAV,AIFF,AIF,IFF,SVX,SND,AU,VOC,CUE,OGG,MPC,MP+,MPP,MP3,MP2,MP4,M4A,AAC,FLAC,FLA,APE,MAC,WV,SPX,SID,CDA
Changelog:
* updated to write full path to audio files in m3u file
* updated to work with a wide range of audio formats
* updated to only create an m3u file if audio files exist in current directory
* script updated to get path details from clicked-on item
* script now titles the created .m3u file with the name of the directory it was created in
| Code: | splitpath, 1, file, dir
filegetattrib, attr, %1%
if attr contains D ; launched from a directory
{
m3u = %dir%\%file%\%file%.m3u
loop, %dir%\%file%\*.*
{
splitpath, A_LoopFileName, , , ext
if ext in WAV,AIFF,AIF,IFF,SVX,SND,AU,VOC,CUE,OGG,MPC,MP+,MPP,MP3,MP2,MP4,M4A,AAC,FLAC,FLA,APE,MAC,WV,SPX,SID,CDA
{
filelist = %filelist%%A_LoopFileLongPath%`n
count++
}
}
if count = ; no audio files found
return
sort, filelist
filedelete, %m3u%
fileappend, #EXTM3U`n%filelist%, %m3u%
}
else ; launched from a file
{
; get the current folder for the m3u name:
stringsplit, array, dir, \
folder := array%array0%
m3u = %dir%\%folder%.m3u
loop, %dir%\*.*
{
splitpath, A_LoopFileName, , , ext
if ext in WAV,AIFF,AIF,IFF,SVX,SND,AU,VOC,CUE,OGG,MPC,MP+,MPP,MP3,MP2,MP4,M4A,AAC,FLAC,FLA,APE,MAC,WV,SPX,SID,CDA
{
filelist = %filelist%%A_LoopFileLongPath%`n
count++
}
}
if count = ; no audio files found
return
sort, filelist
filedelete, %m3u%
fileappend, #EXTM3U`n%filelist%, %m3u%
}
return |
Compiled:
| Code: | REGEDIT4
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist]
@="Create Playlist"
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist\command]
@="\"x:\\path to exe\\create m3u.exe\" \"%1\"" |
Uncompiled:
| Code: | REGEDIT4
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist]
@="Create Playlist"
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist\command]
@="\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\" \"x:\\create playlist.ahk\" \"%1\"" |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
sociableorg Guest
|
Posted: Sun Nov 26, 2006 9:13 pm Post subject: Regedit help |
|
|
Hi,
First off, thanks for posting the wonderful script. I was trying to use the registry entry script you posted for the shell extensions, but am having a problem running that script. I have saved the following into a file called playlistregedit.reg:
--------------------------------------------------------------
REGEDIT4
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist]
@="Create Playlist"
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist\command]
@="\"x:\\path to exe\\create m3u.exe\" \"%1\""
--------------------------------------------------------------
I have changed the path in the script to point to m3u.exe.
Now I execute regedit /s playlistregedit.reg
I am getting an error "Cannot import playlistregedit.reg: Error opening file".
Appreciate your help! |
|
| Back to top |
|
 |
reg Guest
|
Posted: Mon Nov 27, 2006 11:41 am Post subject: |
|
|
Good stuff!!
Now, how to delete the reg entry please?
(only for test, the script is really good)  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Mon Nov 27, 2006 12:04 pm Post subject: |
|
|
Technically, that's not an Explorer shell menu extension, real one require to do a Com DLL...
That doesn't remove the usefulness of your script, of course.
I can't answer sociableorg, except to double-check the format of the file. Perhaps ensure it is pure Ascii, not encoded in Unicode.
reg, to delete a reg entry, just put a minus sign (a dash, an hyphen) after the opening brace:
| Code: | REGEDIT4
[-HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist] |
Mmm, I didn't knew this AllFileSystemObjects, this is useful to know. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
reg Guest
|
Posted: Mon Nov 27, 2006 9:30 pm Post subject: |
|
|
Thank you, PhiLho!
Maybe you know also how to create in the Explorer shell menu the initial underlined, like
&createMp3....
createMp3...
Thanks in advance. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Tue Nov 28, 2006 12:56 pm Post subject: |
|
|
Well, you gave the answer yourself:
[HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\Create Playlist]
@="Create &Playlist"
Put the & wherever you want. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
reg Guest
|
Posted: Tue Nov 28, 2006 7:06 pm Post subject: |
|
|
Thank you, PhiLho.
I'm prudent with .reg!  |
|
| Back to top |
|
 |
insert an icon in the con Guest
|
Posted: Wed Nov 29, 2006 3:32 pm Post subject: |
|
|
Last but not least, is there any way to insert an icon in the context menu (appskey)?
Thanks in advance. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Wed Nov 29, 2006 5:13 pm Post subject: |
|
|
No, you have to write a real shell extension for that (AFAIK). _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
pandoRa Guest
|
Posted: Tue Jan 16, 2007 3:41 am Post subject: Bug/Function? |
|
|
it's nothing major, just - when I select several files at once and then try to create a playlist it crashes the Explorer :)
Is there any possibilitie to work around that?
I realy like that script, it'd be nice for selections to work |
|
| Back to top |
|
 |
Andras Guest
|
Posted: Fri Jan 26, 2007 9:02 pm Post subject: sub menus |
|
|
Hi there folks,
I really like this solution,
But could you tell me if there is a possibility to make submenus under a shell extension in the explorer menu?
Just like WinZIP does have more options.
Thanx,
Andras |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Sat Jan 27, 2007 8:14 am Post subject: |
|
|
AFAIK, just by playing with the registry, no.
WinZip and others create real shell extensions, ie. plug-ins relying on Com interface (the ActiveX kind, not the com port!) to communicate with the shell (Explorer). This is beyond current AHK capabilities. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Andras Guest
|
Posted: Sat Jan 27, 2007 10:22 am Post subject: submenus |
|
|
I thought it would be easier.
Thanks for the answer anyway
bye |
|
| Back to top |
|
 |
cracksloth Guest
|
Posted: Sun Mar 04, 2007 4:13 am Post subject: randomize |
|
|
| does anyone know how to tweak this script so that the playlist is randomized? |
|
| Back to top |
|
 |
Newb42 Guest
|
Posted: Mon Mar 05, 2007 9:54 pm Post subject: Cannot get it to work |
|
|
| I am relatively new to autohotkey but even so, for the life of me I cannot get this script to work correctly. Every time I launch the create playlist option on a music folder it does nothing. It probably is something stupidly simple that I am overlooking but any help would be appreciated. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|