"Answer File" open file dialog not working for Mac Build

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
booee
Posts: 41
Joined: Fri Mar 27, 2015 9:48 pm

"Answer File" open file dialog not working for Mac Build

Post by booee » Fri Feb 04, 2022 6:21 pm

I notice that the "Answer File" no longer works in my Mac build, which I made for the Mac App Store.
I'm not sure if it's a permissions issue, because Mac maybe no longer accepts specialFolderPath("desktop") or
if I'm using an outdated version of LiveCode and a more recent version fixes the issue (currently using 9.6.4)

Here's the code I use below, which works in LiveCode, but does NOT do anything in my build.
==========
set the defaultFolder to specialFolderPath("desktop")
put the defaultFolder into tStartDirectory

answer file "Please select an image file." with tStartDirectory with \
type "All Images|jpg,jpeg,gif,png|JPEG,GIFf,PNGf" or \
type "JPEG Images|jgp,jpeg|JPEG" or \
type "GIF Images|gif|GIFf" or \
type "PNG Images|png|PNGf"
if it is not empty then

stam
Posts: 2600
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: "Answer File" open file dialog not working for Mac Build

Post by stam » Fri Feb 04, 2022 6:59 pm

Hi booee (fun fact - that autocorrects to booze ;) )
It is working... but you're may be falling foul of the syntax for multiple filetypes?

i'm not sure I understand what the 'OR' separated filetypes mean...
If you mean to include all filetypes in your call, then the first line is correct, ie:

Code: Select all

answer file "Please select an image file." with tStartDirectory with type "All Images|jpg,jpeg,gif,png|JPEG,GIFf,PNGf"
will enable selection of all specified filetypes in the answer dialog

So why include 'OR' statements for each individual filetype after this? Logically this seems strange, it's like saying "allow selection of all image file types, or allow selection of JPG, or allow selection of PNG etc.

If you're including these to allow selection of jpg, jpeg, gif, png, JPEG, GIFf, PNGf, then the first line suffices and the other lines are probably causing an error. What is it you're trying to do?

Stam

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "Answer File" open file dialog not working for Mac Build

Post by Klaus » Fri Feb 04, 2022 7:11 pm

This string will only be visible on Windows -> All Images
And the FILETYPEs are also deprecated on macOS since a long time, so we can leave that out, too:

Code: Select all

answer file "Please select an image file." with type "|jpg,jpeg,gif,png|"
Or do you mean you do not see that dialog at all in your runtime?
If yes, hm, usually macOS will ask if your app can access that folder (here Desktop folder)

booee
Posts: 41
Joined: Fri Mar 27, 2015 9:48 pm

Re: "Answer File" open file dialog not working for Mac Build

Post by booee » Fri Feb 04, 2022 7:45 pm

Interesting, I'll try some of those things to see if it helps...

However, yeah the problem is I don't even see the that dialog at all in your runtime of the application?
It works in LiveCode when I run from there, but not from the built app.
The macOS isn't even asking if your app can access that folder anymore. I remember it working last year, which is why I'm wondering if it's related to some OS updates.

booee
Posts: 41
Joined: Fri Mar 27, 2015 9:48 pm

Re: "Answer File" open file dialog not working for Mac Build

Post by booee » Fri Feb 04, 2022 7:59 pm

Looks like it just doesn't like the tStartDirectory to be specialFolderPath("desktop")

I changed it to: specialFolderPath("home") and it seems to be working better now.

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "Answer File" open file dialog not working for Mac Build

Post by Klaus » Fri Feb 04, 2022 8:07 pm

It is not neccessary to set "the defaultfolder" first, this will do:

Code: Select all

...
answer file "Please select an image file." with specialfolderpath("home") with type "|jpg,jpeg,gif,png|"
...

stam
Posts: 2600
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: "Answer File" open file dialog not working for Mac Build

Post by stam » Fri Feb 04, 2022 8:30 pm

I just ran this in the message box:

Code: Select all

answer file "Please select an image file." with specialfolderpath("desktop") with type "|jpg,jpeg,gif,png|"
and it worked just fine... (MacOS 12.1, LC 9.6.6 - and yes, with specialFolderPath("desktop")). If that is not working for you, there is something else going on, but it's not the answer file...

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "Answer File" open file dialog not working for Mac Build

Post by Klaus » Fri Feb 04, 2022 8:37 pm

booee wrote:
Here's the code I use below, which works in LiveCode, but does NOT do anything in my build.

Post Reply

Return to “Mac OS”