program fernbedienung; {$mode objfpc}{$H+} {$DEFINE UseCThreads} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes, SysUtils, CustApp { you can add units after this }, lowlevelunit, irdecoderunit, gitupdateunit; type { tFernbedienung } tFernbedienung = class(tCustomApplication) protected procedure doRun; override; private irDecoder: tIRDecoder; inputDatei: string; watte,debug: boolean; public constructor create(theOwner: TComponent); override; end; { tFernbedienung } procedure tFernbedienung.doRun; var errorMsg: String; begin // quick check parameters errorMsg:=checkOptions('WdI:','Watte debug Input:'); if (errorMsg='') and not hasOption('I','Input') then errorMsg:='Erwarte Input: ''-I $Input'''; if errorMsg<>'' then begin showException(exception.create(errorMsg)); terminate; exit; end; inputDatei:=getOptionValue('I','Input'); watte:=hasOption('W','Watte'); debug:=hasOption('d','debug'); irDecoder:=tIRDecoder.create(inputDatei,extractfilepath(paramstr(0))+'befehle.konf',watte,debug); repeat repeat while irDecoder.zeileVerarbeitet do; until not irDecoder.befehlVerarbeitet; sleep(100); until false; irDecoder.free; // stop program loop Terminate; end; constructor tFernbedienung.create(theOwner: TComponent); begin inherited Create(TheOwner); stopOnException:=True; end; var application: tFernbedienung; begin application:=tFernbedienung.Create(nil); application.title:='Fernbedienung'; application.run; application.free; end.