
! script name: edit.d/editscript
! topic: read script files that may be edited

!A
!A NAME:
!A
!A 	Select Script
!A
!A DESCRIPTION:
!A
!A 	This script will read a script file for editing.
!A
!B INSTRUCTIONS:
!B
!B 	DIRECTORY NAME: The selection box with the available list of
!B 		DIRECTORIES will automatically appear for a selection
!B 		to be made.
!B
!B 	INPUT SCRIPT FILE NAME: The selection box with the SCRIPT FILES
!B 		available for the specified script directory will
!B 		automatically appear for a selection to be made.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: edit script")

DIM Destination$[256],Answer$[256]
DIM Name$[256]
DIM Dir$[256],D_label$[256],F_label$[256],Choice$[256],Mask$[32]
DIM Editor$[256]

Stat= NamedVarStr("file editor",WsSystemVars,"notepad.exe",Editor$)
Flip_file= NamedVarVal("flip crlf",WsSystemVars,0)

Dir$="/usr/weber/ascrpt/"
D_label$="DIRECTORY"
Choice$="DIRECTORY SELECTED"
F_label$="FILES"
Choice$="FILE TO OPEN"
Mask$="All Files (*.*)|*.*||"

Start:!
Stat=UserFileBox(Dir$,Mask$,D_label$,Sub_label$,F_label$,Choice$,"Synergy")
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT SCRIPT FILE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$= "CANCEL" THEN Leave

Stat=EditFile(Editor$,Answer$,Flip_file)

Leave:!
LowerSelectBox
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
