"Answer File" open file dialog not working for Mac Build
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
"Answer File" open file dialog not working for Mac Build
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
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
Re: "Answer File" open file dialog not working for Mac Build
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:
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
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"
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
Re: "Answer File" open file dialog not working for Mac Build
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:
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)
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|"
If yes, hm, usually macOS will ask if your app can access that folder (here Desktop folder)
Re: "Answer File" open file dialog not working for Mac Build
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.
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.
Re: "Answer File" open file dialog not working for Mac Build
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.
I changed it to: specialFolderPath("home") and it seems to be working better now.
Re: "Answer File" open file dialog not working for Mac Build
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|"
...
Re: "Answer File" open file dialog not working for Mac Build
I just ran this in the message box:
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...
Code: Select all
answer file "Please select an image file." with specialfolderpath("desktop") with type "|jpg,jpeg,gif,png|"
Re: "Answer File" open file dialog not working for Mac Build
booee wrote:
Here's the code I use below, which works in LiveCode, but does NOT do anything in my build.