Saving snapshots to files
Robert Brenstein
rjb at rz.uni-potsdam.de
Fri Mar 12 03:46:41 EST 2004
Marc,
>Moin, Wilhelm,
>
>I am trying to learn "Transcript" and I still seem to learn better
>by looking at working code, if the documentation is as incompatible
>to my brain as Revolution's doc is.
>
>> put char (LastSlash + 1) to Laenge of LongDateiName into Dateiname
>> put char 1 to (LastSlash - 1) of LongDateiName into NewDirectory
>
>This smells like "basename" and "dirname" to me. Aren't these
>standard function available in Revolution?
Nop, no such functions. But these values are so trivial to extract
that no special functions are needed. Instead of locating the
LastSlash (which presumably was done walking down chars from the end
or using offset in a loop), it is simpler to
set the itemDelimiter to slash
put last item of LongDateiName into Dateiname
put item 1 to -2 of LongDateiName into NewDirectory
and if LongDateiName is fetched using sth line
put the long name of this stack into LongDateiName
and then cleaning the it from extra word and quotes, the same can be
done with a single line
put char 2 to -2 of (word 2 of the long name of this stack) into LongDateiName
>I would like to have a list of standard-functions listed against
>their Revolution versions (repeating the discussion about
>"reinventing the wheel"), perhaps this also would help those list
>members that try to port C-code to Transcript?
You can use functionnames() to get a list of all Rev functions and
make matching yourself :)
>Your routine to search for slashes might run into trouble if the
>user wanted to include slashes in his filename, it would have to
>take care of the platform (I guess) and eventually even look out for
>quotation marks (as slashes in filenames are allowed everywhere as
>long as they are escaped correctly).
>
It is not possible to have slashes in a filepath that is acquired
through answer file or ask file. Slashes are always! used as
directory delimiter. Getting slashes into names is possible but
system-specific. On Mac, which normally uses colons for delimiting,
the way to get slashes in names is to use colon in the file path
within Rev.
Robert
More information about the use-livecode
mailing list