Page 1 of 1

access to application files

Posted: Tue Nov 13, 2012 1:04 pm
by thebelg
Currently I am trying to port an old Windows application (written in toolbook) to Livecode (for Apple and Windows).
In our application we use nearly 400 Audiofiles. One solution is to load the Audiofiles with "file -> import as Control -> audio File..." in the Application.
But so I will get an application of nearly 800 MB.
I would like to load the needed Audios at runtime. But how can I access the files, because I do not now the Installation location of the Application, and How can I give the Files to the Application (???? File -> Standalone application Settings -> Copy Files)
Thanks

Re: access to application files

Posted: Tue Nov 13, 2012 2:12 pm
by jmburnod
Hi thebelg,

The files in the copy files pan are in a folder of the package:
Contents/MacOS

Best regards
Jean-Marc

Re: access to application files

Posted: Tue Nov 13, 2012 2:24 pm
by thebelg
Thanks jean-Marc for this hint, but how can I now access ths file in the application
play audiofile sample.wav

???

Best Regards

Re: access to application files

Posted: Tue Nov 13, 2012 3:24 pm
by Klaus
Hi thebelg(ium?)

I would create a little function that returns the correct path to that folder:

Code: Select all

function fStandAloneFolder
  ## The stack that is "turned" into a standalone on OSX will "live" in the MacOS folder as described by Jean-Marc
  ## I use EFFECTIVE, so it will also work for SUBSTACKS, who do not have a filename of their own!
  put the effective filename of this stack into tFileName
  set itemdel to "/"

  ## We only need the FOLDERNAME
  delete item -1 of tFileName

  ## This will also delete the last SLASH, so we add it again to make the fiction ready-to-use!
  return tFileName & "/"
end fStandAloneFolder
Use it like this:
...
## AUDIOCLIP not audiofile!
play ac (fStandAloneFolder() & "your_sound.wav")
## or if you have the files in a subfolder "sounds"
play ac (fStandAloneFolder() & "sounds/your_sound.wav")
...

Best

Klaus

Re: access to application files

Posted: Tue Nov 13, 2012 4:07 pm
by thebelg
Hallo Klaus,

thanks for your answer. I will test it an give you a replay

thebelg (cames from belgium but lives in germany)

Re: access to application files

Posted: Tue Nov 13, 2012 4:10 pm
by Klaus
Ah, alles klar :)

Re: access to application files

Posted: Wed Nov 14, 2012 7:02 am
by thebelg
Hallo Klaus,

I've just tested your tip, and it works fine (on Mac and Windows).

Regards (schöne Grüße)

Re: access to application files

Posted: Wed Nov 14, 2012 12:01 pm
by Klaus
Dag or Bonjour thebelg,
thebelg wrote:I've just tested your tip, and it works fine (on Mac and Windows).
that was the plan! 8)
thebelg wrote:Regards (schöne Grüße)
Groetjes or au revoir

Klaus