Build settings for Mac OSX - feedback

J. Landman Gay jacque at hyperactivesw.com
Thu Jul 8 20:56:46 CDT 2010


Steve King wrote:

> The execution bit. Interestingly, this wasn't needed. I just dragged the
> bundle over (as created by Rev using guidance from Jacqueline) and double
> clicked the executable and it ran all on its own!

Cool. Do you know which version of OS X he's running? I wonder if that 
makes a difference.

> 
> The problem. My application is built to save two files (text) with
> extensions SAC and SACp. These are saved (in windows) in a folder under my
> documents so I use specialfolderpath for this. The files save though not
> quite in the right place, but this is probably due to some minor fix I need
> to make with specialfolders.

They should work identically, except on OS X the folder is called 
"Documents" instead of "My Documents". If you put the function's return 
value into a variable and use it that way, it should behave exactly as 
it does on Windows.

> The problem is loading them back. When I use
> the ask prompt, the saved file is present in the dialogue box but in light
> grey so I can't select it (click on it) to load it. I have another file
> (preferences) that the program saves and loads itself and interestingly this
> works seemlessly, so it seems to be only a problem when using the dialogue.
> Is it something to do wioth doc types and extensions? In the builder I
> declared Type and extension as SAC, SACP.

Since you're asking the use to choose an existing file, you mean the 
"answer file" command, right? The "ask file" command is for creating new 
files.

The dimming is probably due to the file selectors you're passing in 
answer file. The syntax that works on both platforms is:

   answer file <prompt> with type "<File tag>|SAC,SACp|SACSACp"

The last bit is the file types you put in your plist, with no spaces 
between. They don't need spaces or delimiters because all file type 
codes are exactly 4 characters. But -- big but -- the "SAC" type is only 
three characters so it won't work. You can have different Mac file types 
from their equivalent Windows extensions. If you add another character 
to SAC you don't necessarily have to add it to the Windows extension too.

Also, unless you've actually created your files with those file types 
assigned, the file dialog may not recognize them anyway, and they'll be 
dimmed as you describe.

You can either change your scripts to write files with the correct file 
types before you create them, or you can leave off the file specifier in 
the "answer file" command and hope your users choose the right kind of 
file. You could do some error checking when the file opens in that case 
to see if they did.

To save your files with a Mac file type, add this line somewhere before 
you do any file saving operations:

  set the filetype to "SACp" -- or SAC, but add another character

This also works with regular open/write/close file commands. It does not 
work with stacks; to set the filetype of a stack, use the stackFileType 
in the same way. You can set the filetype once on openstack and it will 
stay that way until you change it. You don't need it before every file 
save unless each one needs a different file type. Windows and Linux will 
ignore the command, it's Mac-only.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list