dragData["files"] problem

Sivakatirswami katir at hindu.org
Sun May 28 05:32:23 EDT 2006


hmmmm. not so fast! (smile) I'm  working with sound  files daily ...

For  the "Keep It Simple Fan Club"... try this,
known to  work ..... for .mp3, .wav, .aiff, .m4a sound files on the Mac

Make new  stack:

create player... set height to 17 pixels, loc locations... name  it  
"Listen"

Now:

create new field... call it "dropAudio" (or whatever)

put this script into that field.

on dragEnter
   set the acceptDrop to true
end dragEnter

on dragDrop
   put  dragData["files"] into tPath
   set the clipboarddata["text"] to tPath ## I often want that path  
for other reasons...
      stop player "Listen"
     replace " " with "%20" in tPath
     set the filename of player "Listen" to ("file://"&tPath)
     start player "Listen"
end dragDrop

Viola! (Big Violin!) Mp3 Player...  11 lines of code...

Disclaimers: no error trapping, assumes a single  valid QT playable  
file drop,  and doesn't handle  special characters... works here with  
file names as long as:

09_law of another chance 5-21-61 discipline begets freedom  
6/18/61.aiff.mp3


I have about 6 different "flavors" of Rev  mp3 players... used in  
various contexts for different  tasks.

Sivakatirswami

Further disclaimer --! Aiyo! (lamentations of dispair in Tamil) Long  
file names not recommended  on the Mac if you can avoid them, as  
there are other issues with dealing with long file  names that are  
*not* solvable like the QT player assignment is... and Rev *really,  
really* needs to fix this. Worst case scenario I'm experiencing now  
is using "Save As" in a template stack and then users, type in a 42  
char filename....and the result is an un readable, un processable   
file  name with some  hash string. in the file name.






On May 26, 2006, at 9:12 AM, Garrett Hylltun wrote:

> Much appreciate all the information and efforts on this from everyone.
>
> It does explain the problems I've been having making an MP3 Player  
> for myself.
>
> I believe that this isn't just a dragData issue either, as I've had  
> problems with trying to load files into the "player" with long file  
> names on OS X.
>
> Well nix the MP3 player for me.  :-(
>
>
> Thanks,
> -Garrett




More information about the Use-livecode mailing list