1 Oct '14 - 13:13 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Adding files to the playlist from the command line  (Read 8956 times)
Timo
Posts: 1


« on: 31 Jan '07 - 15:41 »
Reply with quoteQuote

I guess the title of the thread says it all. You can open files from the command line, but can you add them to the playlist? I know there's an option so that all opened files are added to the playlist, but I don't want to use it.
Logged
Ian @ un4seen
Administrator
Posts: 16938


« Reply #1 on: 31 Jan '07 - 17:57 »
Reply with quoteQuote

Nope, I'm afraid not. Currently, the only way is to use DDE (command="[list(filename)]") or enable the "Add tracks to list" option.
Logged
nod5
Guest
« Reply #2 on: 20 Aug '08 - 21:14 »
Reply with quoteQuote

Can someone give a more detailed example on how to send that DDE command?
Say that I want to add the file C:\music\file.mp3
Do I need to use it in combination with some of the regular key+number DDE commands, as described on this page
http://support.xmplay.com/article.php?id=17

Alternatively, are there any key+number DDE commands for enabling/disabling the "add tracks to list" option? If there is, then we could send enable command, add files through command line and then send disable command.

Alternatively, how about the old request about some way to add tracks through command line. It would be the simplest way :-)
Logged
Dotpitch
Posts: 2716


« Reply #3 on: 20 Aug '08 - 22:43 »
Reply with quoteQuote

I think we've discussed that some time ago... (actually, about a year ago in this thread).

DDE is just a way of communicating between programs, so you'll need a program to send the messages to XMPlay. Tsorovan posted a fixed version of DDE_run here, a program that is operated from the commandline to send DDE commands to any other program.

DDE_run usage:
-s  Specify service name
-t  Specify topic
-n  Specify the name of program to run if connection fails
-c  Specify command to execute on server. Up to 10 allowed.

In this case, the service is XMPlay, the topic is System, the program is your xmplay.exe (with full path) and the command is the command you want to issue to XMPlay.
For example:
DDE_run -s XMPlay -t System -n "c:\program files\xmplay\xmplay.exe" -c key80
This will send key80 to XMPlay (play/pause), or launch xmplay.exe if it's can't find a running XMPlay. You can add files to XMPlays playlist by using the command [list(%file%)], or open files with [open(%file%)] and replace the current playlist, where %file% is the full filepath and filename. You can send one file at a time.

Note that DDE is an outdated system (it was introduced in Windows 2.0 in 1987), so I'm not sure how long it'll stay around.
Logged
nod5
Guest
« Reply #4 on: 21 Aug '08 - 22:05 »
Reply with quoteQuote

Thanks! I made a small tool autohotkey that handles the adding. The .exe and source (.ahk) are attached as a zip in the following thread: http://www.donationcoder.com/Forums/bb/index.php?topic=7832.msg125469#msg125469

;-----------------------------------
; autohotkey script for silently adding to Xmplay playlist through DDE
;  takes file(s)/folder(s)/playlist(s) as input parameter
; - drop input on AHK_xmplay_input_to_playlist_DDEML.exe or
; - pass input as quote enclosed, space separated command line parameters
;  (use no end slash for folders!)
;   example: C:\AHK_xmplay_input_to_playlist_DDEML.exe "C:\musicfolder" "C:\music2\song.mp3"
;
; made by nod5
; using DDEML by sean, http://www.autohotkey.com/forum/topic19169.html
;-----------------------------------
Logged
amit
Posts: 721


« Reply #5 on: 22 Aug '08 - 01:14 »
Reply with quoteQuote

Thanks. It helps a lot.

Can you make another one which plays files instantly instead of adding them to the playlist?
Logged
nod5
Guest
« Reply #6 on: 22 Aug '08 - 10:41 »
Reply with quoteQuote

Amit, If you mean that the files should replace the previous playlist and then play, then just use the command line support built into Xmplay: http://support.xmplay.com/article.php?id=35

"c:\XMPlay.exe" "c:\Music\Garbage - Supervixen.ogg"
Logged
amit
Posts: 721


« Reply #7 on: 23 Aug '08 - 14:14 »
Reply with quoteQuote

I have tried a few times adding a button to totalcmd to play/add files in xmplay. I only succeeded adding them with your new tool. I thought it might be fairly easy to change the DDE command to play instead of add and recompile it.

I don't have the knowledge to do so hence my request from you Smiley
Logged
nod5
Guest
« Reply #8 on: 24 Aug '08 - 01:40 »
Reply with quoteQuote

just to be clear, do you ask for
1. to add tracks to the playlist without replacing previous playlist tracks and then start playing or
2. to add tracks to the playlist replacing previous playlist tracks and then start playing

I 1, then I can make a command line switch for it.
If 2, then the built in xmplay feature can already do that, just make sure to set it up correctly. If you can set up a button to pass command line parameters to my tool then the same should be possible for xmplay.
example:
my tool: C:\AHK_xmplay_input_to_playlist_DDEML.exe %1
xmplay: C:\program files\xmplay\xmplay.exe %1
(where %1 would be some variable; maybe not %1 in totalcmd but something like that I suppose)
Logged
amit
Posts: 721


« Reply #9 on: 24 Aug '08 - 09:55 »
Reply with quoteQuote

I am reffering to the second option: replacing the current playlist and play.

The command line doesn't work for me. not even in the most basic way : "path\xmplay.exe" "path\file.ext"
Logged
nod5
Guest
« Reply #10 on: 24 Aug '08 - 14:08 »
Reply with quoteQuote

You must be doing something wrong - that command line option works perfectly fine. Maybe you're missing a quote somewhere?

To change the DDE command in my script do this:
1. edit .ahk script source: replace "[list" with "[open" .
2. save and recompile (install autohotkey, right click .ahk, select "compile", done)

It will however then NOT work as it should if you use it with both files and a folder as input. Only the files or the folder - not both - will be played.
Logged
amit
Posts: 721


« Reply #11 on: 24 Aug '08 - 15:59 »
Reply with quoteQuote

Thanks. I will try it.
Logged
amit
Posts: 721


« Reply #12 on: 24 Aug '08 - 20:39 »
Reply with quoteQuote

By using %P%S parameters in Totalcmd it works perfectly , even when selecting folders and files together .

If its OK with you nod5 and there are no copyright issues I can upload it here .
Logged
nod5
Guest
« Reply #13 on: 27 Aug '08 - 16:13 »
Reply with quoteQuote

I'm glad that it works! Sure, you are free to modify and use the parts of the script that I wrote in any way for for any purpose. You could perhaps post it with a somewhat changed filename to avoid confusion and also post the source for those that prefer to compile by themselves. The DDEML function is from @ autohotkey forums btw, so anyone makling something proprietary using that might need permission from him. Very unlikely in this context though.
Logged
nod5
Guest
« Reply #14 on: 27 Aug '08 - 16:15 »
Reply with quoteQuote

I lost a word above. It should've been: "DDEML function is from Sean @ autohotkey forums "
Logged
amit
Posts: 721


« Reply #15 on: 29 Aug '08 - 17:19 »
Reply with quoteQuote

Here is the modification for the small dde command line tool nod5 has kindly created. It works similarly to  the original but instead of adding files to playlist it replaces the playlist with new files and plays them.

It is created with AutoHotKey script.

In the zip file you will find the compiled dde tool ("AHK_xmplay_replace_playlist_DDEML\AHK_xmplay_replace_playlist_DDEML.exe") and its source.

* AHK_xmplay_replace_playlist_DDEML.zip (196.45 KB - downloaded 7 times.)
Logged
nod5
Posts: 1


« Reply #16 on: 30 Aug '08 - 08:41 »
Reply with quoteQuote

Nice!
Though, I get the problem I described earlier: if I select a few audio files and also a subfolder (with more audio files) the changed script then doesn't put all of them on the list.

example: imagine I have these files

C:\music\file1.mp3
C:\music\file2.mp3
C:\music\file3.mp3
C:\music\subfolder\file4.mp3
C:\music\subfolder\file5.mp3

If I then drag and drop

C:\music\file1.mp3
C:\music\file2.mp3
C:\music\file3.mp3
C:\music\subfolder\

onto the modded script, it then first clears the playlist, then adds file4-file5 but then immediately after that clears the playlist again and adds and plays file1-3. This is caused by the script using a temporary .pls file to speed things up and .pls files doesn't seem to support including folders so I had to let the script add folders as a separate step.

If it somehow works for you even in these cases then I'm happy though puzzled  Smiley
Logged
amit
Posts: 721


« Reply #17 on: 30 Aug '08 - 10:09 »
Reply with quoteQuote

I am using totalcmd with the parameters %P%S. These parameters send the full path and filenames (when there are spaces it adds quotation marks) of selected items. I think that choosing a folder sends actually the sub-folder resident filenames instead of the folder path itself. That is why when mixing folders and files together in this situation cause no problem.
Logged
Tsorovan
Posts: 1247


« Reply #18 on: 9 Jul '09 - 20:32 »
Reply with quoteQuote

[I'm an idiot, hadn't updated the locate32 database today]
« Last Edit: 9 Jul '09 - 20:53 by Tsorovan » Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines