DefaultFolder. Should I use it?
Jeanne A. E. DeVoto
jeanne at runrev.com
Sun Dec 16 01:54:10 EST 2001
At 5:24 AM -0800 12/15/2001, Bruce Lewis wrote:
>I want to click on a link and show an image by reference to an external file.
>In my old HyperCard stack, I just use the name of the file and HyperCard
>finds it. If HyperCard can't find the file, it gives a dialogue to select
>it. Once selected, it can find the image later.
>HyperCard records file paths on a card in the home stack. I assume it then
>checks all of these until it finds the file. It seems pretty fast.
>How would I replicate this in Revolution?
I haven't written this, but it seems you could use the file name as the
linkText, and something like this to check whether the file is in the
defaultFolder, then ask the user if the file isn't found:
get the linkText of the clickChunk
if there is no file it then
answer file "Where is the image?"
if the result is not empty then exit to top
set the filename of image "My Image" to it
To replicate HyperCard's file paths functionality, I'd expand the first two
lines of the above to concatenate each stored file path with the filename
in the linkText, and ask the user only if there's no such file in any of
the paths. Then when you ask the user, you can strip the last component
(the file name) off the returned path, and store the resulting path along
with the other file paths. These paths could be stored in a stack and read
into a global on launch (which is what HC does), or stored in a text file
in the Prefs folder, or whatever.
Sorry, this isn't a complete worked-out solution but it may give you an
idea of how to get started...
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - Power to the Developer!
More information about the Use-livecode