access to application files

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
thebelg
Posts: 24
Joined: Thu Nov 01, 2012 8:51 pm

access to application files

Post by thebelg » Tue Nov 13, 2012 1:04 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: access to application files

Post by jmburnod » Tue Nov 13, 2012 2:12 pm

Hi thebelg,

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

Best regards
Jean-Marc
https://alternatic.ch

thebelg
Posts: 24
Joined: Thu Nov 01, 2012 8:51 pm

Re: access to application files

Post by thebelg » Tue Nov 13, 2012 2:24 pm

Thanks jean-Marc for this hint, but how can I now access ths file in the application
play audiofile sample.wav

???

Best Regards

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: access to application files

Post by Klaus » Tue Nov 13, 2012 3:24 pm

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

thebelg
Posts: 24
Joined: Thu Nov 01, 2012 8:51 pm

Re: access to application files

Post by thebelg » Tue Nov 13, 2012 4:07 pm

Hallo Klaus,

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

thebelg (cames from belgium but lives in germany)

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: access to application files

Post by Klaus » Tue Nov 13, 2012 4:10 pm

Ah, alles klar :)

thebelg
Posts: 24
Joined: Thu Nov 01, 2012 8:51 pm

Re: access to application files

Post by thebelg » Wed Nov 14, 2012 7:02 am

Hallo Klaus,

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

Regards (schöne Grüße)

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: access to application files

Post by Klaus » Wed Nov 14, 2012 12:01 pm

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

Post Reply