Sivakatirswami wrote:
> on mouseUp
> put the directory & "proxyPrefs.txt" into tPath
> put tPath into msg
> put "204.148.111.2" & ":"& "8080" into url ("file:"&tPath)
> end mouseUp
>
> The above works
It shouldn't. The url should be ("file://" & tPath) - note the double
slashes.
But even if it did work, you are writing to a different file than the
one you think you are writing to.
If the current directory is (for example) "MyDisk/Myfolder/MySubfolder",
then the preferences file you are writing to is
"MyDisk/MyFolder/MySubfolderproxyPrefs.txt" instead of
"MyDisk/MyFolder/MySubfolder/proxyPrefs.txt" - in other words, you are
creating a file called "MySubfolderproxyPrefs.txt" in your parent
directory, instead of a file "proxyPrefs.txt" in your current directory.
> but, if I try to add a sub-directory to the path:
>
> on mouseUp
> put the directory & "/data/proxyPrefs.txt" into tPath
> put tPath into msg
> put "204.148.111.2" & ":"& "8080" into url ("file:"&tPath)
> end mouseUp
>
> this doesn't work. Why?
If you change the url to ("file://" & tPath) it should work (assuming
folder "data" exists).
> Any insights, not only to the above problem but to saving
> preferences in general will be appreciated. Thanks
On a Mac, you should be writing preference files to the "Preferences"
folder in the system folder. You may need to use an external command to
have a bullet-proof method of getting the name of the system folder,
because hard disks on the Macintosh can have any name.
On Windows, you should write to "C:/Windows/file" or
"C:/Windows/Config/file".
Under Linux, and probably most (all?) other Unixes, you should write to
a hidden file in the user's home directory. Assuming Metacard honours
the Unix shortcut "~", you can use "~/.file" or "~/.MyApplication/file".
If Metacard doesn't understand "~", you might need to play around with
the shell() function to query the operating system for the user's home
directory. shell("ls -d ~") should work.
I think someone made a feature request for a function to return the name
of the system folder under any platform at some stage? What is the
progress on that?
--
Steven D'Aprano
==========================================
M.B. Sales Pty Ltd Ph: +61 3 9460-5244
A.C.N. 005-964-796 Fax: +61 3 9462-1161
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.