
! script name: featureitems.d/startreaditem

!A
!A NAME:
!A
!A 	Start webmon as a thread
!A
!A DESCRIPTION:
!A
!A 	This script starts the system when doing a thread.
!A	It is designed to do direct the system through several scripts 
!A	which do an execute all and then store the results in a file.
!A
!B INSTRUCTIONS:
!B
!B	THIS PROGRAM DOES NOT INTERACT WITH THE USER.
!B	IT IS CALLED AUTOMATICALLY IN A VARIATIONAL THREAD.
!B
!# see also - vthread.d/thread.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: startreaditem ")

DIM Header$[4000]
DIM A$[1024]
DIM Unit$[1024]
DIM Datestr$[1024]
DIM Fileheader$[1024]
DIM Pics_dir$[255]
DIM Execute_file$[512]
DIM Input_file$[512]
DIM Output_file$[512]


DEG
InitScriptLog
DeActivateUndo

Stat= TurnViewOff(1)
Stat= TurnViewOff(2)
Stat= TurnViewOff(3)
Stat= TurnViewOff(4)
DeleteAll
StdWorkplane

PRINT "STARTED WEBMON THREAD"
IF ARGC<2 THEN
        Execute_file$= ""
ELSE
  Num_param= ARGC-1
  IF Num_param = 2 THEN
	Input_file$= ARGV(1)
	V1=CreateVariable("var input file",WsSystemVars,Input_file$)
	PRINT "INPUT FILE: ",Input_file$
	Output_file$= ARGV(2)
	V1=CreateVariable("var output file",WsSystemVars,Output_file$)
	PRINT "OUTPUT FILE: ",Output_file$
  END IF
END IF

Stat= SetInchMetric(WsInch)

Pics_dir$="/usr/weber/ST/pics/"
V1=CreateVariable("startup script",WsSystemVars,"startup")
V1=CreateVariable("startup constants",WsSystemVars,"setconstants")
V1=CreateVariable("storage dir",WsSystemVars,"/usr/weber/ST/")
V1=CreateVariable("retrieve dir",WsSystemVars,"/usr/weber/ST/")
V1=CreateVariable("pics dir",WsSystemVars,Pics_dir$)
V1=CreateVariable("iges storage dir",WsSystemVars,"/usr/weber/ST/iges/")
V1=CreateVariable("dxf storage dir",WsSystemVars,"/usr/weber/ST/dxf/")

Stat= OutputString("pics_dir",Pics_dir$&CHR$(10),WsNewFile)
Stat= RemoveFile("temp")

Fileheader$= "signature"

Head=ReadUserData(9991,"HEADER",Fileheader$)
IF ValidGeometry(Head) THEN
	Units= CurrentUnits
	Unit$= RPT$("METRIC",Units= WsMetric)&RPT$("INCHES",Units=WsInch)
	stat= DateString(Datestr$)
	Versn= Systemversion
	OUTPUT A$ USING "#,5D.DD"; Versn
	Stat=PutUserString(Head,"SYNERGY:",A$)
	Stat=PutUserString(Head,"Creation date:",Datestr$)
	Stat=PutUserString(Head,"Units:",Unit$)
	Stat= UserDataString(Head,Header$)
	stat= FileHeader(Header$)
	stat= DeleteEntity(Head)
END IF
Leave1:!

 LOAD "setconstants:featureitems.d/readitem"

END

