home *** CD-ROM | disk | FTP | other *** search
- /*
- ** AddIcon - Create an icon for the currently opened file.
- **
- ** Usage: AddIcon
- **
- ** This script accepts no arguments, but works for the current file.
- **
- ** Mike Haas, Sep 30, 1994
- **
- ** This file assumes that the user has created a directory called
- ** "sys:System/icons" and has created in there a Project-type icon file
- ** called "Text.info". The default tool for the icon should point
- ** to Textra. (I recommend "Unsnapshot"-ing the icon from Workbench...
- ** selected it and pull down "Icon, UnSnapshot"). This script uses that
- ** icon file as a model for all created icons.
- **
- ** Once the user has done this, he/she need only execute this script
- ** and a double-clickable Icon for the current text file will appear,
- ** launching Textra on that file when launched.
- */
-
- options results
-
- /*
- ** If you wish to change the place the icon is looked for, do it here.
- */
- IconFile = "sys:System/icons/Text.info"
-
- /*
- ** does the icon file exist?
- */
- result = open('iconf',IconFile,'R')
- if (result = 0) then do
- notify '"Cant find 'IconFile'"'
- exit
- end
- result = close('iconf')
-
- /*
- ** Put together the new icon file name
- */
- get file path
- NewFile = result
- get file name
- NewFile = overlay(result,NewFile,length(NewFile)+1)
- NewFile = overlay('.info',NewFile,length(NewFile)+1)
-
- /*
- ** Check if the NewFile exists already...
- */
- result = open('iconf',NewFile,'R')
- if (result = 1) then do
- notify '"Icon for this file already exists"'
- result = close('iconf')
- exit
- end
-
- /*
- ** Use the AmigaDOS copy command...
- */
- address command "copy quiet "IconFile" "NewFile
-