/* StoreDebug.cid
**
**
**
** This script will assist in debuging problems you might have
** in running or installing or configuring GS CallerID.
**
** Run this script and follow the on screen instructions.
*/

options results


/* This next line should store the FULL path and file name of the
** CallerID program.                                                       */


say 'StoreDebug.cid'
say ''
say ''
oops=0
if Show('P','CID') then do
	say 'Closing GS CallerID...'
	Address CID
	Quit
	shell command 'Wait 5'
end
path='/'
say 'Loading GS CallerID...'
if open(infile,'S:CallerID.cfg','r') then do
	text=translate(readln(infile),'=',' ')
	do while length(path)=0 & ~eof(infile)
		if upper(word(text,1))='PATH' then path=word(text,words(text))
		text=translate(readln(infile),'=',' ')
	end
end
if right(path,1)~=':' & right(path,1)~='/' then path=path||'/'

file=''
if exists(path'CallerID') then file=path'CallerID'
if exists('sys:WBStartup/CallerID') then file='sys:WBStartup/CallerID'
if length(file)=0 then do
	say ''
	say ''
	say 'Sorry! Unable to locate GS CallerID.'
	shell command 'wait 5'
	say ''
	say 'Be sure you have run the Install script or a copy of GS CallerID'
	say 'is in your SYS:WBStartup directory.'
	shell command 'wait 5'
	say ''
	say 'You can then run this script again'
	shell command 'wait 10'
	exit
end

shell command 'run <>NIL: 'file' >sys:CallerID.debug'
try=0
do while ~show('p','CID') & try<20
	shell command 'wait 1'
	try=try+1
end
if try=20 then do
	say ''
	say ''
	say 'Sorry! Unable to control GS CallerID.'
	shell command 'wait 5'
	say ''
	say 'Be sure you have closed all copies of GS CallerID that may'
	say 'be running. This script will start the program as needed.'
	shell command 'wait 10'
	exit
end

address CID
Debug 1
say ''
say ''
SimCall 'Private/Blocked' 'Simulated Call For Testing'
calls=3
say 'You may stop this program by quiting GS CallerID at any time.'
say ''
say 'For the best test, please wait for 2 or 3 calls to come in'
say 'before you stop the test.'
do while show('P','CID') & calls>0
	shell command 'wait 10'
end
say ''
say ''
say ''
say 'GS CallerID has been closed.'
say ''
say 'The file SYS:CallerID.Debug has been created. Please send this'
say 'information to Glenn J. Schworak at one of the following...'
say ''
say '          glenn@g-world.com                   InterNet'
say ' or       1:3406/32                           FidoNet'
say ' or       312:3000/1                          E!Net'
say ' or       1710 Lee St SE * Salem, OR 97302    US Mail'
shell command 'wait 30'

exit
