Filtering Answer File...

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
Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Filtering Answer File...

Post by Traxgeek » Sun Sep 22, 2013 1:09 pm

me again :oops:

Still struggling on with trying to import files from outwith my app sandbox, but, in addition;

To try and reduce the unrelated 'clutter' that appears in the 'answer file' dialogue box I am trying to (pre-) filter the contents of said dialogue. Text, Application & Picture-types seem pretty easy but I'd like to filter 'zip' files.

I have read the help docs and looked at / played with the tutorials, so I'm pretty OK with the "of type...' and 'with filter..' requirements of the OSX and WIN platforms. In fact I have little problem (I think) with the Win platform, my problem arises with :
-1- OSX syntax for '.zip' file types - when I 'play' with filter syntax here, I either have all contents or nothing displayed :? . Any ideas please ?
-2- Android / iOS : is there a way to pass filters into the 'mobile pick...' structure or would I have to try and roll my own / accept that all files will be displayed ?

Thanks in advance.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

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

Re: Filtering Answer File...

Post by Klaus » Sun Sep 22, 2013 3:29 pm

Hi Trax,

1. use this for Mac and Win:
...
answer file "Select a ZIP archive:" with type "Zip archive|zip|"
put it into tSelectedZipFile
...

2. I don't think you can "abuse" mobilepickMedia/Photo/Contact" for anything else
but the supported filetypes as described in the dictionary.


Best

Klaus

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Filtering Answer File...

Post by Traxgeek » Sun Sep 22, 2013 3:54 pm

Thanks a million Klaus. One problem on it's way to being sorted !

These 'niggles' drive me mad !! I'd forgotten how tiring / frustrating it is to learn a new language - much appreciated.

Best Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Filtering Answer File... (Solved)

Post by Traxgeek » Sun Sep 22, 2013 4:36 pm

Aha - It appears my 'problem' revolves around trying to kick off the file selection process in a folder of my choice AND set the filter to be 'zip' :

--set a 'zip' filter
answer file "Select a ZIP archive:" with type "Zip archive|zip|" --works (like you kindly said) ;-)

--set a 'zip' filter where the filter can be parsed in via the handler
put "Zip archive|zip|" into sFilter --in reality this could be created locally, as part of a platform If/Then selection script, or be parsed in via the handler
answer file "Select a ZIP archive:" with type sFilter --also works (as it should, given your help above !)

--set the 'start-up' folder
answer file "Select a ZIP archive:" with sLastFolder --works just fine : where sLastFolder is extracted from the last selected file path

BUT... how to do them BOTH ?
answer file "Select a ZIP archive:" with sLastFolder with type sFilter --seems to work (for Mac OSX)
Not too sure yet / untested on Windows. All-in-all though, it's great.


EDIT :
seems that the syntax for Windows goes along the lines of filter = 'Image files, *.zip,*.jpg,*.gif,*.bmp,*.png' --the 'Image Files' appears to be both optional and (pretty much) whatever you like.
whereas the syntax for Mac is more : 'PICT|jpg,gif,bmp,png|'
I struggled over this for quite a while so thought it 'nice' to post my results back up here... This works for my Max OSX 10.8.4 and Windows XP SP3 platforms. Of course, if someones to add/amend/correct me - please feel free !

Thanks again Klaus.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Post Reply