[D
	/LoadSW [P
		[A LoadFlag ]	% LoadFlag = False -> Check only if Files are existing 	
		
		/Result #1 def
		/MissingFile '' def	
		
		/SWFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplSWFileName add ApplTypeExt add def
		/SWFile SWFile '_V' add ApplSel.SWVersion cvs add 'S' add ApplSel.SWSubVersion cvs add def 
		ApplSel.SWBetaInfo '' ne [B
			/SWFile SWFile '_' add ApplSel.SWBetaInfo add def
		] if
		/SWFile SWFile '.HX3' add def   			
		
		
		/TreeFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplTreeFileName add  ApplTypeExt add def
		/TreeFile TreeFile '_V' add ApplSel.TreeVersion cvs add 'S' add ApplSel.TreeSubVersion cvs add def 
		ApplSel.TreeBetaInfo '' ne [B
			/TreeFile TreeFile '_' add ApplSel.TreeBetaInfo add def
		] if
		/TreeFile TreeFile '.HX2' add def
		
		/DefaultParFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplTreeFileName add ApplTypeExt add def
		/DefaultParFile DefaultParFile '_V' add ApplSel.TreeVersion cvs add 'S' add ApplSel.TreeSubVersion cvs add def 
		ApplSel.TreeBetaInfo '' ne [B
			/DefaultParFile DefaultParFile '_' add ApplSel.TreeBetaInfo add def
		] if
		/DefaultParFile DefaultParFile '.GR3' add def
		
		
		% check if files are existing
		Result [B
			SWFile FileExist not [B
				/Result #0 def 
				/MissingFile SWFile def
			] if
		] if
		Result [B
			TreeFile FileExist not [B
				/Result #0 def 
				/MissingFile TreeFile def
			] if
		] if
		Result [B
			DefaultParFile FileExist not [B
				/Result #0 def 
				/MissingFile DefaultParFile def
			] if
		] if
		
		Result LoadFlag and [B
			'Erasing application firmware sector...' log     
			4 TalkIntf.ClearInstanceAll
%			'Downloading application software...' log
			'Downloading ' SWFile add log
			SWFile dup loadobj exch PackInst:DownloadHX3File	
			'Downloading application parameter tree...' log     		
			TreeFile dup loadobj exch PackInst:DownloadHX2File		
			'Updating UPID list...' log
			TalkIntf.UpdateUPIDList
			TalkIntf.GetResult 0 ne [B 
				ResetDevice 
				10000 wait
			] if      			
			'Downloading application default parameters...' log
			DefaultParFile dup loadobj exch PackInst:DownloadGR3File					
		] if
		[A /MissingFile /Result]
	] 
]