home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
ONLINE
/
TE2_134T
/
te2inst.003
/
ChDir.scr
< prev
next >
Wrap
Text File
|
1997-07-03
|
2KB
|
64 lines
;; --------------------------------------------------------------------------
;; ChDir.scr -- TE/2 Script Language Script File
;; Copyright (C) 1991-94 Oberon Software, Mankato, MN
;;
;; Permission is granted to registered TE/2 users to use this
;; script without restriction. If you modify this script and
;; subsequently redistribute it, please note the modifications
;; in the comment area. If you do redistribute this this
;; script you must also provide the accompanying CHDIRSCR.DOC.
;;
;; Author: Brady Flowers
;; Date: 2 June, 1991
;;
;; This script will present the user with a dialog box which will display
;; the Current Working Directory and prompt for a new directory. If the
;; new path contains a drive indicator, the drive is changed also.
;;
;; See the file CHDIRSCR.DOC for more information.
;;
;; --------------------------------------------------------------------------
global string cwdLast ; GLOBAL string buffer containing prev response
string newDir ; Temporary work string for current response
integer dlgHandle ; Handle to dialog window
integer hadError = FALSE ; Error flag
;; --------------------------------------------------------------------------
program
; Open the dialog window, place the Current Working Directory information
; and prompt in it and query the user for a response.
dlgHandle = OpenDialog(4, 4, 10, 76, DLogNormAttr)
StrPut(5, 6, DLogNormAttr, "Current Path is: %s", curdir)
StrPut(6, 6, DLogNormAttr, "Enter new path spec:")
newDir = StrGet(cwdLast, 8, 6, 68, 255, DLogEdAttr, DLogEdHiAttr)
; Examine the response. It will be the empty string if the user exited
; the input by typing ESCape. Otherwise, check for a colon as the second
; character and change disks as well as directories.
if strlen(newDir)
cwdLast = newDir
if ASCIIVal(substr(newDir, 1, 1)) == ':'
hadError = !ChDisk(newDir)
if hadError == FALSE
if strlen(newDir) > 2
hadError = !ChDir(newDir)
endif
endif
else
hadError = !ChDir(newDir)
endif
endif
CloseDialog(dlgHandle)
; If there was any sort of error, inform the user here
if hadError
ErrorMsg("Error! Cannot change current directory to:", newDir)
endif
end