How to create an Empty Playlist File on Mac?

Hello everyone, I'm working on a Music Player script, I was able to play a file via the default player as when we doubleclick on a file. The problem is I have no control over the Player, so to "stop" a file I could play a "silent" mp3, one with 1 second of silence in it for example. I discarded the idea since I had to distribute this silent.mp3 file along with the script. A better option is to play a "playlist", since playlist files are text only, I could create them an empty playlist file on the fly...
so, the question is, what's the default playlist extension on a mac? and how to create one on the Mac?
in windows the default player is Windows Media Player, the default playlist file extension is *.wpl.
here's the contents of an empty playlist
<?wpl version="1.0"?>
<smil>
    <head>
        <meta name="Generator" content="Microsoft Windows Media Player -- 12.0.7601.18150"/>
        <meta name="ItemCount" content="0"/>
        <title>empyPlaylist</title>
    </head>
</smil>
here's the script, so far Windows only, at least to stop the file being played.
//  script.name = musicPlayer_Windows.jsx;
//  script.needs = I need to create an Empty Playlist File for the Mac, that will play on the default music player when executed
// carlos canto, 10/12/2014
var w = new Window('dialog', 'Music Player');
var btnFile = w.add('button', undefined, 'Select an *.mp3 file to play...');
var lblSong = w.add('edittext', undefined, '');
lblSong.characters = 30;
var btnPlay = w.add('button', undefined, 'Play');
var btnStop = w.add('button', undefined, 'Stop');
var btnClose = w.add('button', undefined, 'Close');
btnPlay.enabled = btnStop.enabled = false;
var emptyPlaylist = getEmptyPlaylist ();
btnFile.onClick = function () {
    var file = File.openDialog ("Select File to Play...", '*.mp3', false);
    lblSong.text = file.displayName;
    lblSong.file = file;
    btnPlay.enabled = btnStop.enabled = true;
btnPlay.onClick = function () {
    lblSong.file.execute();
    $.sleep (300);
    BridgeTalk.bringToFront('estoolkit');
btnStop.onClick = function () {
    emptyPlaylist.execute();
    $.sleep (300);
    BridgeTalk.bringToFront('estoolkit');
btnClose.onClick = function () {
    w.close();
w.show();
// this function creates an Empty Playlist file (Windows) on the fly, this file will be used to "stop" a playing file
// I need a similar function for Mac
function getEmptyPlaylist () {
    var desk = Folder.desktop;
    var f = new File(desk+'/emptyPlaylist.wpl');
    if (!f.exists) {
        var s_emptyPlaylist = (new String("<?wpl version=\"1.0\"?>\n<smil>\n    <head>\n        <meta name=\"Generator\" content=\"Microsoft Windows Media Player -- 12.0.7601.18150\"/>\n        <meta name=\"ItemCount\" content=\"0\"/>\n        <title>empyPlaylist</title>\n    </head>\n</smil>\n"));
        f.encoding = 'utf-8';
        f.open('w');
        f.write(eval(s_emptyPlaylist));
        f.close();
    return f;
thanks in advance
Carlos

hmm...I think it's going to be more complicated than I thought.
correct, this script targets the ESTK, it is part of a larger Illustrator script, which doesn't have doScript either...I would go with applescript as last resort. I think going with the playlist file is easier.
based on your comment I realized users might change their default players, so on Windows I'm going to change the playlist file from *.wpl to the more universal *.m3u, I guess whatever decent player made the default, supports this file.
so, will an *.m3u playlist file play on the default mac player (itunes) when executed?
File("~/Music/iTunes/iTunes Media/Music/emptyPlaylist.m3u").execute(); // will this play on itunes?
I noticed that the *.m3u file can be blank, it will still "play" when executed() and effectively "stops" any music file currently being played...if this happens on Mac also, that's what I'm after.
thanks for helping Dirk.

Similar Messages

  • How to create subdirectories in playlist, ipod classic

    I am not familiar how to create subdirectories in Playlists in iPod Classic. Of course I have to user iTues software but I don't know how to create. Please guide me if anybody knows how to create subdirectories.
    I want like this (like windows how subdirectories are look)
    Classical
    Dindufa
    Zazimba
    Thank you,
    grb

    To expand on that further, putting playlists within folders and/or folders within folders creates multiple levels of playlist organization. However, this only works in auto-sync mode, so if you manually manage your Classic the folder structure will not transfer over.

  • How to create database from .sql file

    how to create database from .sql file..?? i put the sintax query in a sql file.. and i want to call it in java code..
    ho to do it..??

    why do you want to do this from java?
    i just don't see the point.
    find your dba and have him/her run it for you

  • How to create and sign CAB files info on Supplement Option

    To all Supplement Option subscribers:
    At the supplement option for iDevelopment Accelerators, I uploaded a zip with detailed info on how to create and sign CAB files (necessary when you are running your application on the Native IE Java Virtual Machine).
    Not all functionality provided to you through JInitiator will work (e.g. WebUtil doesn't) but the way how to make and sign a CAB file will become more easy.
    Cheers,
    Marc Vahsen
    Headstart Team

    This defeats the purpose of trying to centralize SAP-related web resources on the SAP server. Typically IIS/Apache or other non-SAP servers are under the control of IT and not the SAP BASIS group.
    We simply would like to have a centralized location to store static web files so that they are not overwritten during Portal support pack applications.

  • How to create and read text file using LabVIEW 7.1 PDA module?

    How to create and read text file using LabVIEW 7.1 PDA module? I can not create a text file and read it.
    I attach my code here.
    Attachments:
    File_IO.vi ‏82 KB

    Well my acquisition code runs perfect. The problem is reading it. I can't seem to read my data no matter what I do. My data gets saved as a string using the array to string vi but I've read that the string to array vi (which I need to convert back to array to read my data) does not work on the pda. I'm using version 8.0. So I was trying to modify the program posted in this discussion so that it would save data from my DAQ. I did that but I still can't read the data after its saved. I really don't know what else to do. All I need to do is read the data on the pda itself. I can't understand why I'm having such a hard time doing that. I found a possible solution on another discussion that talks about parsing the strings because of the bug in the "string to array" vi. However, that lead me to another problem because for some reason, the array indicators or graphs don't function on the pda. When i build the program to the pda or emulator, the array indicators are faded out on the front panel as if the function is not valid. Does this kind of help give a better picture of what I'm trying to do. Simply read data back. Thanks.

  • How to create a new excel file using Excel Destination when Destination file not exists.

    how to create a new excel file using Excel Destination when Destination file not exists.

    Just need to set an expression for excel connectionstring and set delay validation to true and it will create it on the fly.
    The expression should return the full path with dynamic filename in each case.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to create a split zip file?

    Hi,
    Does anybody know how to create a split zip file using only Java?
    Lets say I have a file that compressed has a size of 10MB and I need to split it into small files of 1MB each... and then be able to open and uncompress it using winzip or any other compressing tool.
    I know how to create a zip file using java.util.zip but I cannot split it...
    Thanks,
    Ignacio

    IgnacioKriche wrote:
    Thanks for the philosophical advice...
    Can anyone help me? Does anyone know if Java API java.util.zip can split a zip file?I'm 99.9 % sure that there is nothing in the Java ZIP APIs to do this but I'm 100% sure I can't be certain.

  • How can I import iPhone Garageband Files to Mac Garageband?

    How can I import iPhone Garageband Files to Mac Garageband? I've found lots of threads about this but no direct answers/how to.
    Thanks

    With the latest build of GarageBand on the device, move to the My Songs view, tap the Edit button at top right, select the shaking song you want to export, then tap the sharing arrow symbol at top left, tap iTunes, then GarageBand.
    Connect the device to iTunes, select it in the left-hand column, then select the Apps tab. You should find the exported file in the File Sharing area of the GarageBand app and from there you can copy it to your computer, then open it with the GarageBand application.
    tt2

  • Simple ques.: how to open new empty editor file in Xcode 4.0?

    I use Xcode 4.0 as an editor for stand-alone C++ programs.  In earlier versions, I  would just open a new empty file (cmd-shift-N, I think; the new file option, which was just cmd-N, gave me something else) and start typing. But in v. 4.0, I haven't found the option to do this.  Under File->New, it only offers me the option of new project or new workspace.  There is an option for new file, but it's grayed out.  So what I have to do now, to get a new empty editor file, is open an existing C++ program in Xcode, delete the contents, and save it under a new name.

    Alas, that doesn't work either (I had already tried that).  When I click on the Empty Icon I don't get an empty file.  Instead, I get a dialog box asking me to create a project.  Then when it's finished I get this:
    Now, once I've done this, THEN I can do (because it's no longer grayed out) File/New/New File/Other/Empty (so this, at least, now explains why my submenu looked different from K T's: he must already have had a project created, while I had not).  But besides having all these unnecessary steps (since I have no interest in creating a project), it still doesn't give me just the simple text editor I used to be able to get; instead I get this more complicated-looking window with what looks like a debugger, which I'm not using:
    On the other hand, if I open one of my existing C++ programs in XCode, then I do get just exactly the type of text editor window I used to be able to get just by directly doing cmd-shift-N.    So does anyone know how to get to this directly, without creating a project, etc.?:

  • How to create and save playlist using JMF?

    Hello i m new to JMF. Can anyone tell me how to create and save a playlist of media files using JMF.
    also how can i play .DAT files using JMF?
    Does JMF supports AVI,Asf files?

    Hello i m new to JMF. Can anyone tell me how to create and save a playlist of media files using JMF.
    also how can i play .DAT files using JMF?
    Does JMF supports AVI,Asf files?

  • How to create a data load file from Excel !!!

    Hi All,
    I'm new to HFM and would like to load data into an HFM application. As I have an Excel file with all the data. When I'm directly loading the data it throws an error saying "No section has been specified to determine if this is data, description or line item detail". How can I convert this excel file into proper format (.dat) file understandable by HFM ?

    There are several ways to get this data into HFM.
    1) FDM - best option if you have it
    2) Webforms/Data Grids
    3) HsSetValue formulas in Excel
    4) DAT file loads
    5) JVs, etc
    If you wish to use DAT files created via Excel, you will likely want to use Excel VBA macros to create your DAT file to load. We do this on occasion for special projects and it works quite well. What you can do is set up an Excel file with your data inputs to look however you want, then link your POV members and amounts to another tab (we commonly call this the Export tab and it is set up in an HFM-friendly format).
    Create a macro to write a DAT file to a specified location using data from the Export tab. The DAT file will need to be formatted as below. For a specific sample, you can extract data from your HFM app and see the format.
    !Data
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Scenario;Year;Period;View;Entity;Value;Account;ICP;Custom1;Custom2;Custom3;Custom4;Amount
    Brush up on Replace, Merge, or Accumulate load options in the HFM Admin and User Guides, then upload your new DAT file.

  • How to create a custom ear file and deploy it onto a freshly created oc4j

    Hi,
    Wanted to know that how should i go about creating a custom EAR file or for that matter any application and deploy it onto a test oc4j instance created within the 10.1.3 Home of Oracle Apps R12.
    I believe in a standalone Application server installation it is quite simple to deploy an application by creating an oc4j instance using the AS console ,but not very sure about how to go about it in Oracle Apps .
    N.B:I have been able to create a test oc4j instance by the name of Test and able to start and stop it using the opmn of 10.1.3 oracle home.
    Any help in this regard will be appreciated.

    Hi,
    can you please post this question to one of the Apps forums if your main concern is to deploy applications in the context of Oracle Apps?
    It seems that you don't have a problem in creating the EAR file in JDev.
    Frank

  • How to create parameter and control file like filename + date

    Hello there
    I am trying to create parameter and control file with following command
    in SQLPLUS
    create pfile='/u03/oradata/WEBDB/backup/initWEBDB.ora' from spfile;
    In RMAN
    copy current controlfile to '/u03/oradata/WEBDB/backup/cf_longterm.cpy';
    how can I put date at the end of filename like
    initWEBDB8jan06.ora and cf_longterm8jan06.cpy
    Thanks in advance
    Lionel

    ASM is reliable but a smart DBA is very careful. If ASM is doing mirroring this is like RAID doing mirroring. What happens if you accidentally delete one copy ... the other one disappears instantly. Not a good idea.
    With respect to redo logs you need a minimum of three groups, two members, and one thread per instance. So a 2 node cluster should, at a minimum have 12 physical files.
    Not mirroring the redo logs, assuming multiple members, is not as critical.

  • How to create and save a file in flex web application ?

    Hi,
          I want to create and save a file form flex web application. Is it possible ?
    I have done some googling and found that its only possible through file referece, which needs some serverside implementation be called.
    Is it not possible with file reference to create and save file directly ?
    Can any one suggest how to over come this.
    Thanks in advance.

    Alex,
    code written with the Flex Builder 3 libraries will certainly run in Flash Player 10. However, what you need is not so much the capabilities of FP10 but the library functionalities of the Flex 4 package. And I think that Flex 4 code will only run in FP10 and not 9 (but haven't tested this as at work we have not yet been permitted to upgrade, so there is not a lot of point going for Flex 4!).
    Richard

  • How to create Exe From Data files

    my requirement is very much similar to registration of file extension.
    lets say if you have a file with extension .xyz then you can decide which program should invoke .xyz but instead of any other extension i need that extension of my file should be .exe
    and when user double clicks on this exe files the file should get opened with my own program, but if the file is true .exe (i.e. Created by some other program) then it should not get invoked by my program...
    i dont know how to do this but i know this is possible
    e.g. Flash can create an exe files from their .swf files which when opened run using flash player (but it doesnt get fooled by any .exe file. also flash exe files have different icons)
    similarly winzip can create self extracting exe files from .zip files
    can anybody help me out
    the files i am trying to create will have numeric data in spreadsheet format and when launched the player will show the data in animated format.
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog

    i think i will briefly describe the things; what exactly i want to acheive
    my client will have one application which will acquire data and log them into files. but he want to distibute these files to other people who will not have the application developed by me.
    he wants that file should show the reports in specific way. but to see those reports end user should not be required to install any specific application.
    i know that this thing is possible. as per msdn developer can include any data (text, graphics, audio, video etc.) inside exe in the form of resource file. (and there are programs are avaiable on internet which allow to extract, edit, add resource files inside exe)
    what i dont know right now is how i can access the resource file inside exe
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog

Maybe you are looking for

  • Install software for Deskjet 2540 will not load on Windows XP Home edition SP3 machine

    I have successfully connected a new Deskjet 2540 printer to a Windows 7 machine, and IPAD Air, and an XP Pro laptop. I cannot get the install software to load on and XP Home edition SP3 machine. I have tried all of the HP remedies that I can find, ov

  • Blackmagic Intensity Pro Card Not Recognized

    I've got a Mac Pro 1,1 running OS 10.7.3 and FCP 10.0.3. FCP X doesn't recognize the card. I have FCP 6.0.6 running under 10.6.8. FCP and the card get along A-OK. Anyone have any troubleshooting guidance?

  • Disapearing emails in Mail ...

    Hi, For a few months now, or maybe since I upgraded to MobileMe and to IMAP accounts, messages seems to be vanishing in Mail for I do not know the reason.  I am unable to say what is going wrong or what exactly I am doing wrong. When I read that Mobi

  • Increase screen resolution in terminal (no X Server)

    Hi When you start ArchLinux, you enter in 'terminal mode' (how do you call it?), where you are asked username and password, then you usually type 'startx' to launch your DE. Yesterday, I was installing NVidia drivers and for some reasons, the screen

  • Rational Rose product and Forte

    Has anyone used Rational Rose products and Forte? Could you post a short summary that explains how easy/hard it is to work with and whether or not the reverse engineering features work well? To unsubscribe, email '[email protected]' with 'unsubscribe