news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

Version

This XFCN allows you to get and set the version information that the Finder uses when a user chooses "Get Info" on your stack.

Version XFCN. Version 1.1d1, by Sam Deane. Copyright ©1994 ULTRALAB. Compiled 16:59:30, 28/04/94.


[last exit to hypercard] [externals index] [download Version]

Description

When a user selects a file in the finder, and chooses "Get Info.." from the file menu, the finder looks in the file to see whether it contains any 'VERS' resources. If it finds resources with id numbers 1 and 2, it uses the information to fill in some of the fields in the info window that it displays.

The top of the info window looks something like this

            <filename>
            <about group of files>

    Kind: <kind of file>
    Size: <size of file>

   Where: <full file path>

 Created: <date that file was created>
Modified: <date that file was last updated>
 Version: <about this file>

The Version XFCN allows you to get and set the value of the <about group of files> and <about this file> entries. It also allows you to get and set a number of other fields which exist within the VERS resources, but which are not directly used by the Finder.

Handy Hints

WHICH STACK'S RESOURCES?

The XFCN operates on the current stack.

To get the version number of a particular stack, you could use the following handler:

  function StackVersion name
    -- don't let anyone see where we're going!
    lock screen
    set the lockRecent to true
    set the lockMessages to true

    -- remember where we are and go to stack we're interested in
    push this card
    go stack name

    -- do the version stuff...
    get Version()
 
    -- put things back as they were
    pop card
    set the lockMessages to false
    set the lockRecent to false
    unlock screen

    -- return the version stuff
    return theStuff
  end StackVersion

A similar handler could be used to set the version number of a stack.


Commands

numbers

The numbers command lets you get or set the numerical version number stored one of the VERS resources. The syntax is:

  get Version("numbers",<place> { ,<value>})

The <place> parameter should be either "stack" or "group", depending on which resource you want to change.

If the XFCN is called without the optional <value> parameter, it sets the resource to the new value. If the XFCN is called without the <value> parameter, it just returns the current value of the resource.

Version numbers are specified in the standard apple format which I have interpreted as: <major>.<minor> {.<bug fix>} {<status> <build>}

For example:

1.0       release 1
1.1       release with minor changes from 1.0
1.1.1     release fixing bugs in 1.1

1.0d23    development build 23
1.0a21    alpha build 21
1.0b3     beta build 3

Example script for numbers

on mouseUp
  get Version(numbers,stack)
  answer "The version of this stack is:" & it
end mouseUp

country

The country command lets you get or set the country code stored in one of the VERS resources. The syntax is:

  get Version("country",<place> { ,<value>})

The <place> parameter should be either "stack" or "group", depending on which resource you want to change.

If the XFCN is called without the optional <value> parameter, it sets the code to a new value. If the XFCN is called without the <value> parameter, it just returns the current value.

Example script for country

on mouseUp
  get Version(country,stack)
  answer "The country code for this stack is:" & it
end mouseUp

about

The about command lets you get or set the long string stored one of the VERS resources. The syntax is:

  get Version("about",<place> { ,<value>})

The <place> parameter should be either "stack" or "group", depending on which resource you want to change.

If the XFCN is called without the optional <value> parameter, it sets the resource to the new value. If the XFCN is called without the <value> parameter, it just returns the current value of the resource.

Example script for about

on mouseUp
  get Version(about,stack)
  answer "The about string for this stack is:" & it
end mouseUp

[last exit to hypercard] [externals index] [download Version]

This page was created automatically, on 25/03/1999 from version 3.0d4 of Last Exit To Hypercard.