home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-04-25 | 9.5 KB | 425 lines |
- 'This program was created by: Kenneth Kowalewski
- ' 5172 Westlake
- ' Dearborn Heights, MI 48125
- ' U.S.A.
- '
- ' Any contributions are accepted but not necessary, I would like to hear
- ' about any comments or suggestions for this program. The coding is not
- ' very professional. This is my first AMOS program!
- '
- ' I am placing this program in the public domain as of August 29,1991
- '
- ' Utility to give free space on disks,
- ' delete files, make directories,
- ' rename files and show mounted devices.
- '
- ' Create menu with zones
- '
- 'If you move this prog off the ta disk remove the line below or
- 'change it to the name of the new disk.
- '
- Dir$="Totally_amos_may_92:source_progs/diskute"
- Dim ITEM$(6)
- SELECTIONS
- '
- ' Copyright notice
- '
- _SMALL_COPYRIGHT[225]
- '
- Procedure _SMALL_COPYRIGHT[YDISPLAY]
- '
- Auto View Off
- '
- Screen Open 7,320,24,16,0 : Curs Off : Flash Off : Cls 0
- Screen Display 7,,-100,,
- Load "copyright_sprite.abk"
- Paste Bob 260,3,1
- Paper 0 : Pen 7 : Print At(1,1);"This program was written using"
- Get Sprite Palette
- View : Wait Vbl
- '
- For Y=1 To Screen Height/2
- Screen Display 7,,YDISPLAY+Screen Height/2-Y,,Y*2
- Screen Offset 7,,Screen Height/2-Y
- View : Wait Vbl
- Next
- '
- Wait 100
- '
- For Y=Screen Height/2 To 0 Step -1
- Screen Display 7,,YDISPLAY+Screen Height/2-Y,,Y*2
- Screen Offset 7,,Screen Height/2-Y
- View : Wait Vbl
- Next
- '
- Screen Close 7
- Auto View On
- '
- End Proc
- '
- MAIN:
- While CHOSEN<1
- X=Mouse Zone
- K=Mouse Key
- If K<>0 Then CHOSEN=X
- Wend
- '
- Bell
- Wait 20
- On CHOSEN Proc AMOUNT,XPUNGE,MAKE,CHANGENAME,MOUNTED,FINISHED
- CHOSEN=0
- Goto MAIN
- '
- ' Procedures start here.
- Procedure SELECTIONS
- Shared ITEM$()
- ' Change the 200 in the screen open command to 256 on a PAL system
- Screen Open 0,640,200,16,Hires
- Curs Off
- Cls 0
- Paper 14
- Flash 14,"(019,200)(028,75)(037,75)(046,75)(055,75)(064,75)(073,75)(082,75)(091,200)(082,75)(073,75)(064,75)(055,75)(046,75)(037,75)(028,75)"
- Reserve Zone 6
- Pen 0
- Print " Disk Utility "
- Cup
- Print " by Ken Kowalewski "
- Cdown
- Cdown
- Cdown
- Paper 0
- Pen 4
- For R=1 To 6
- Read ITEM$(R)
- Centre Zone$(ITEM$(R),R)
- Cdown
- Cdown
- Next R
- Data "1. Number of bytes available on disk. "
- Data "2. Delete a file from the disk. "
- Data "3. Create a new directory on disk. "
- Data "4. Rename a file on the disk. "
- Data "5. List all mounted devices. "
- Data "6. Return to the AMOS Editor. "
- Cdown
- Cdown
- Paper 0
- Pen 12
- Cline
- Centre "Place pointer on selection and press button."
- Wind Save
- End Proc
- '
- ' Within Procedure AMOUNT are the names for Df0: through Dh1:
- ' Each is named three times in If statement blocks
- ' You may change any of these If blocks to reflect your system
- '
- Procedure AMOUNT
- Wind Open 1,144,50,42,12,1
- If Exist("Df0:")
- Dir$="Df0:"
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- F=Dfree
- S$=Str$(F)
- Centre "Space available on DF0:"+S$
- End If
- If Exist("DF1:")
- Cdown
- Dir$="DF1:"
- F=Dfree
- S$=Str$(F)
- Centre "Space available on DF1:"+S$
- End If
- If Exist("DF2:")
- Cdown
- Dir$="DF2:"
- F=Dfree
- S$=Str$(F)
- Centre "Space available on DF2:"+S$
- End If
- If Exist("DF3:")
- Cdown
- Dir$="DF3:"
- F=Dfree
- S$=Str$(F)
- Centre "Space available on DF3:"+S$
- End If
- If Exist("Dh0:")
- Cdown
- Dir$="Dh0:"
- F=Dfree
- S$=Str$(F)
- Centre "Space available in Dh0:"+S$
- End If
- If Exist("Dh1:")
- Cdown
- Dir$="Dh1:"
- F=Dfree
- S$=Str$(F)
- Centre "Space available in Dh1:"+S$
- End If
- Pen 3
- Cdown
- Cdown
- Centre "Click mouse to continue..."
- M=0
- While M=0
- M=Mouse Click
- Wend
- Wind Close
- End Proc
- Procedure XPUNGE
- XPUNGE:
- F$=Fsel$("**","","Locate File. Double-click on","File to be Deleted.")
- If F$="" Then Pop Proc
- Wind Open 1,24,50,74,7,1
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- Centre "Delete--> "+Pen$(4)+F$
- Pen 3
- Cdown
- Cdown
- Centre "Is this correct? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- If A$="Y"
- Clw : Kill F$ : Pen 0 : Home : Cdown : Centre F$+" was deleted." : F$="" : Cdown : Cdown
- Else
- If A$="y"
- Clw : Kill F$ : Pen 0 : Home : Cdown : Centre F$+" was deleted." : F$="" : Cdown : Cdown
- Else
- If M=1
- Clw : Kill F$ : Pen 0 : Home : Cdown : Centre F$+" was deleted." : F$="" : Cdown : Cdown
- End If
- End If
- End If
- Pen 3
- Cline
- Centre "Delete Another? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- Wind Close
- If A$-"Y"
- M=0 : A$="" : Goto XPUNGE
- Else
- If A$="y"
- M=0 : A$="" : Goto XPUNGE
- Else
- If M=1
- M=0 : A$="" : Goto XPUNGE
- End If
- End If
- End If
- End Proc
- Procedure MAKE
- DRECTORY:
- F$=Fsel$("","","Locate level for directory.","Type name at prompt, then hit RETURN.")
- If F$="" Then Pop Proc
- Wind Open 1,24,50,74,7,1
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- Centre "New Directory--> "+Pen$(4)+F$
- Pen 3
- Cdown
- For POSITION=Len(F$) To 1 Step -1
- If Mid$(F$,POSITION,1)="/"
- POSITION=Len(F$)-POSITION : DNAME$=Right$(F$,POSITION) : POSITION=1
- Else
- If Mid$(F$,POSITION,1)=":"
- POSITION=Len(F$)-POSITION : DNAME$=Right$(F$,POSITION) : POSITION=1
- End If
- End If
- Next POSITION
- Cdown
- Centre "Is this correct? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- If A$="Y"
- Clw : Mkdir F$ : Pen 0 : Home : Cdown : Centre "Directory--> "+DNAME$+" was created." : F$="" : Cdown : Cdown
- Else
- If A$="y"
- Clw : Mkdir F$ : Pen 0 : Home : Cdown : Centre "Directory--> "+DNAME$+" was created." : F$="" : Cdown : Cdown
- Else
- If M=1
- Clw : Mkdir F$ : Pen 0 : Home : Cdown : Centre "Directory--> "+DNAME$+" was created." : F$="" : Cdown : Cdown
- End If
- End If
- End If
- Pen 3
- Cline
- Centre "Create Another? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- Wind Close
- If A$="Y"
- M=0 : A$="" : Goto DRECTORY
- Else
- If A$="y"
- M=0 : A$="" : Goto DRECTORY
- Else
- If M=1
- M=0 : A$="" : Goto DRECTORY
- End If
- End If
- End If
- End Proc
- Procedure CHANGENAME
- CHGNAME:
- F$=Fsel$("**","","Locate file to be renamed,","then double-click on filename.")
- If F$="" Then Pop Proc
- Wind Open 1,24,50,74,7,1
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- Centre "Path of old name--> "+Pen$(4)+F$
- Cdown
- Locate 8,
- Pen 0
- Curs On
- Input "Enter new filename--> "+Pen$(4);NNAME$
- Curs Off
- For POSITION=Len(F$) To 1 Step -1
- If Mid$(F$,POSITION,1)="/"
- POSITION=Len(F$)-POSITION : DNAME$=Right$(F$,POSITION) : POSITION=1
- Else
- If Mid$(F$,POSITION,1)=":"
- POSITION=Len(F$)-POSITION : DNAME$=Right$(F$,POSITION) : POSITION=1
- End If
- End If
- Next POSITION
- Clw
- Cdown
- Pen 0
- Centre "Change "+Pen$(4)+DNAME$+Pen$(0)+" to "+Pen$(4)+NNAME$
- Pen 3
- Cdown
- Cdown
- Centre "Is this correct? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- If A$="Y"
- Clw : C$=F$-DNAME$ : Rename F$ To C$+NNAME$ : Pen 0 : Home : Cdown : Centre "The change has been made." : F$="" : Cdown : Cdown
- Else
- If A$="y"
- Clw : C$=F$-DNAME$ : Rename F$ To C$+NNAME$ : Pen 0 : Home : Cdown : Centre "The change has been made." : F$="" : Cdown : Cdown
- Else
- If M=1
- Clw : C$=F$-DNAME$ : Rename F$ To C$+NNAME$ : Pen 0 : Home : Cdown : Centre "The change has been made." : F$="" : Cdown : Cdown
- End If
- End If
- End If
- Pen 3
- Cline
- Centre "Rename Another? [Y/N]"
- M=0
- A$=""
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- Wind Close
- If A$="Y"
- M=0 : A$="" : Goto CHGNAME
- Else
- If A$="y"
- M=0 : A$="" : Goto CHGNAME
- Else
- If M=1
- M=0 : A$="" : Goto CHGNAME
- End If
- End If
- End If
- End Proc
- Procedure MOUNTED
- Wind Open 1,144,30,42,19,1
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- S$=Dev First$("*")
- Print Space$(10);S$
- Cup
- Do
- S$=Dev Next$
- If S$="" Then Exit
- Print Space$(10);S$
- Cup
- Loop
- Pen 3
- Cdown
- Centre "Click mouse to continue..."
- M=0
- While M=0
- M=Mouse Click
- Wend
- Wind Close
- End Proc
- Procedure FINISHED
- A$=""
- M=0
- Wind Open 1,144,50,40,6,1
- Curs Off
- Paper 6
- Clw
- Cdown
- Pen 0
- Centre "Return to AMOS"
- Pen 3
- Cdown
- Centre "Are you sure? [Y/N]"
- While A$="" and M=0
- M=Mouse Click
- A$=Inkey$
- Wend
- If A$<>"Y"
- If A$<>"y"
- If M<>1
- Wind Close
- Pop Proc
- Wait 40
- End If
- End If
- End If
- For B=50 To 75 Step 5
- Bell B
- Wait B/5+1
- Next B
- Wind Close
- Flash Off
- Fade 7
- Wait 55
- Edit
- End Proc