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

Alias

This XFCN allows you to create, store aliases to files and folders in a stack (as 'alis' resources). They can then be resolved to find files, remount vols, etc

Alias XFCN. Version 1.1d2, by Sam Deane. Copyright ©1994 ULTRALAB. Compiled 16:54:45, 28/04/94. Debugging code included.


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

Description

The Alias Manager, introduced with System 7, makes it a lot easier to keep track of files or folders, even when they have been moved or renamed.

The Alias XFCN gives you access to most of the features of the Alias Manager.

If you have a file that your stack needs to refer to, you can use the make command to create an alias to it. The alias is stored in your stack in an alis resource. You can use the list command to get a list of all the alis resources stored in a stack.

Later when you want the file again, you can use the resolve command on one of the resources, which will attempt to find the file for you. If the file has been renamed or moved, the resolve command should still be able to find it. If the file was on a volume that is not mounted, the command will ask you to mount that volume, or even do it for you if it can.

If the resolve command fails to find the file, you can also use the find command to perform a more extensive (but time consuming) search.


Commands

make

This command lets you create an alias to a file, and store it in an alis resource in the current stack.

The syntax is:

  get Alias("make",<path> {,<name>})

The <path> parameter should be the path of the file to alias.

The optional <name> parameter can be used to tell the XCMD what name to give the alis resource.

The command returns the id of the new alis resource.

Example script for make

on mouseUp
  -- get new one
  answer file "File to make alias for?"
  if it is not empty then
    get alias("make",it,filename(it))
  end if
end mouseUp

function filename path
  set the itemDelimiter to ":"
  get last item of path
  set the itemDelimiter to comma
  return it
end filename

resolve

This command allows you to try to get the path for an alias. If the original file is off-line the resolve command will try to mount it for you, prompting if necessary for passwords, etc.

The syntax is:

  get alias("resolve",<name>)

The <name> parameter should contain the name or id of the alis resource to use.

Example script for resolve

on mouseUp
  get Alias("list")
  
  if it is not empty then
    get alias("resolve",line 1 of it)
    put it
  end if
end mouseUp

find

This command allows you to try to get the path for an alias. Unlike the resolve command, if the original file is off-line the find command will not try to mount it.

The syntax is:

  get alias("find",<name>)

The <name> parameter should contain the name or id of the alis resource to use.

Example script for find

on mouseUp
  get Alias("list")
  
  if it is not empty then
    get alias("find",line 1 of it)
    put it
  end if
end mouseUp

alternatives

This command allows you to do an extensive search for an alias which seems to have been lost. This can happen when a file is moved from one volume to another, or deleted completely then restored from a backup.

The syntax is:

  get alias("alternatives",<name>)

The <name> parameter should contain the name or id of the alis resource to use.

If one or more likely files are found, the result of this search will be returned as a comma delimited list of paths to them.

Example script for alternatives

on mouseUp
  get Alias("list")
  
  if it is not empty then
    answer alias("alternatives",line 1 of it)
  end if
end mouseUp

list

This command returns a list of all the alis resources present in the current stack.

The syntax is:

  get Alias("list")

Example script for list

on mouseUp
  answer alias("list")
end mouseUp

remove

This command can be used to remove unwanted alis resources.

The syntax is:

  get Alias("remove",<name>)

The <name> parameter should contain the name or id of the alis resource to remove.

Example script for remove

on mouseUp
  get alias("list")
  
  if it is not empty then
    get alias("remove",line 1 of it)
  end if
end mouseUp

update

This command allows you to update an old alis resource, to change the file that the resource is pointing at.

The syntax is:

  get Alias("update",<name>,<path>)

The <name> parameter should contain the name or id of the alis resource to update.

The <path> parameter should contain the new path for to alias to point at.

Example script for update

on mouseUp
  get Alias("list")
  if it is not empty then
    put it into oldAlias
    
    answer file "Which file?"
    if it is not empty then
      put alias("update",oldAlias,it)
    end if
  end if
end mouseUp

finder

This command allows you to resolve finder alias files.

The syntax is:

  get Alias("finder",<path>)

The <path> command should be a path to a finder alias file. The result of this will be the true path name of the file that the alias represents.

Example script for finder

on mouseUp
  answer "Path to resolve"
  if it is not empty then
    put alias("finder",it)
  end if
end mouseUp

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

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