Annoying ++

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
dalkin
Posts: 81
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Annoying ++

Post by dalkin » Sat Oct 12, 2019 12:47 am

I am loading sound files into a field and using the 'Play' command but setting the source of the sound files also drags in the DS_Store (invisible on a Mac) and for the life of me I can't get rid of it! I've tried the 'showInvisibles in various locations but to no avail. Screenshot and code attached:

on mouseUp
answer folder "Where are the sound files?"
if it is not empty then
set the defaultFolder to it
end if
put the files into field "playlist"
set the showInvisibles to false
end mouseUp

results in
Screen Shot 2019-10-12 at 10.26.53 am.png
If you're skating on thin ice you might as well dance.

dalkin
Posts: 81
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Annoying ++

Post by dalkin » Sat Oct 12, 2019 1:08 am

Ok. So now, without explanation, it works (as in not visible). The only thing that changed was that I moved the sound files to a new location. Weird. I'm leaving the post up though because if anyone else encounters this, the solution may be simply to move the source of the sound iles.
If you're skating on thin ice you might as well dance.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Annoying ++

Post by FourthWorld » Sat Oct 12, 2019 2:37 am

The showInvisibles property is for controls, not files. See the Dictionary entry:
https://livecode.com/resources/api/#liv ... invisibles

The .DS_Store file is created dynamically by the Finder to store folder-specific view preferences, such as whether list or icon mode, column widths for list mode, rect, etc. If you create a new folder and do not alter its appearance, a .DS_Store file may not be created.

To filter unwanted elements from a list, use the filter command. On macOS and Linux, files beginning with "." are not shown in lists by default, so to exclude those from the list returned from "the files" you could add a line to your handler:

Code: Select all

on mouseUp
   answer folder "Where are the sound files?"
   if it is not empty then
       set the defaultFolder to it
   end if
   put the files into tList
   filter tList without ".*"
   sort lines of tList
   put tList into field "playlist"
end mouseUp
Note that I also added a sort there. File listings obtained from "the files" are returned in whatever form the OS gives them to LC, which may or may not be sorted. Adding a sort there makes sure that what the user sees will be easy to navigate.

The filter command is very flexible, worth spending a moment with its Dictionary entry to learn the scope of what you can do with it:
https://livecode.com/resources/api/#liv ... ipt/filter
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dalkin
Posts: 81
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Annoying ++

Post by dalkin » Sat Oct 12, 2019 2:51 am

As always Richard, most grateful.
If you're skating on thin ice you might as well dance.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”