;; CLI Quarterback runner.
;;
;; Format:  scripit qb [source] [dest1] [dest2]
;;
;; e.g.     scripit qb dh2: df0: df1:
;;
;; Note:  all argument are optional except for the filename.
;;
;; A Scripit script by Khalid Aldoseri.
;; Needs Scripit version 1.20 or above.


begin
select wait 200 ABORT

if #argcount > 3                ;Did user supply more than 3 args?
con echo "Too Many Args!"       ;Yes.  Complain,
end                             ;and quit.
endif

run "dr:Backup/Quarterback"     ;Run QuarterBack

$source = "DH0:"                ;default source device
$dest1  = "DF0:"                ;default destination device # 1
$dest2  = "DF1:"                ;default destination device # 2

if #argcount >= 1               ;Did user supply 1 or more args?
$source = $arg[1]               ;yes, copy first arg into $source
endif

if #argcount >= 2               ;Did user supply 2 or more args?
$dest1  = $arg[2]               ;yes, copy second arg into $dest1
endif

if #argcount == 3               ;Did user supply 3 args?
$dest2  = $arg[3]               ;yes, copy third arg into $dest2
endif

con text "Restoring FROM: " $source " TO: " $dest1 " + " $dest2 $lf

select window QuarterBack       ;wait until the QB window shows up
wait
gadget Restore                  ;click on Restore gadget
wait
gadget "" 0,1,0,0 $source       ;insert $source into gadget #1
gadget "" 0,2,0,0 $dest1        ;insert $dest1  into gadget #2
gadget "" 0,3,0,0 $dest2        ;insert $dest2  into gadget #3
wait 10
gadget proceed                  ;click on Proceed gadget
