Delphied 0 Posted March 2 (edited) The Delphi newb is back with another issues. I can't for the life of me fine the error in my code. I have a bunch of errors and when I add another end; it still have two errors: Unknown Directive TfrmMdp. Code below and please be gentle as I am just learning Delphi. unit MDP_Appleu; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, VidGrab, Vcl.StdCtrls, FileCtrl, Winapi.ShellAPI, DosCommand, IOUtils; type TfrmMdp = class(TForm) vgApple: TVideoGrabber; btnRecord: TButton; btnStopRecord: TButton; btnLogs: TButton; btnExe: TButton; Label1: TLabel; Label2: TLabel; edtLogs: TEdit; edtExe: TEdit; Label3: TLabel; Label4: TLabel; edtDeviceId: TEdit; btnExtract: TButton; dosDeviceId: TDosCommand; Label5: TLabel; edtDeviceName: TEdit; Label6: TLabel; edtHardwareModel: TEdit; Label7: TLabel; edtIccid: TEdit; Label8: TLabel; edtImei: TEdit; Label9: TLabel; edtPhoneNum: TEdit; Label10: TLabel; edtIos: TEdit; Label11: TLabel; edtSerial: TEdit; procedure FormCreate(Sender: TObject); procedure btnRecordClick(Sender: TObject); procedure btnStopRecordClick(Sender: TObject); procedure btnLogsClick(Sender: TObject); procedure btnExeClick(Sender: TObject); procedure btnExtractClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } procedure ExtractionCommand(BatFile : string; TempFileName : string; TempLogName : string); public { Public declarations } end; const SELDIRHELP = 1000; var frmMdp: TfrmMdp; VidPath, LogPath, ExePath, IDeviceInfo : string; ExeSet, LogSet : Boolean; implementation {$R *.dfm} procedure TfrmMdp.btnRecordClick(Sender: TObject); begin VidPath := 'C:\'; if FileCtrl.SelectDirectory(VidPath, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then begin vgApple.StoragePath := VidPath; vgApple.VideoSource := vs_VideoCaptureDevice; vgApple.VideoDevice := vgApple.VideoDeviceIndex('USB Video'); // sets device to the usb hdmi vgApple.RecordingInNativeFormat := False; vgApple.RecordingMethod := rm_ASF; // recording to asf vgApple.TextOverlay_String := 'FA-JL10-2025_001'; // need to change so the name is the same as the current FA vgApple.AutoFilePrefix := 'FA-JL10-2025_001_'; vgApple.StartRecording(); frmMdp.Color := clRed; end else ShowMessage('You Must Select a Save Location'); end; procedure TfrmMdp.btnStopRecordClick(Sender: TObject); begin vgApple.StopRecording; frmMdp.Color := clGray; end; procedure TfrmMdp.btnExeClick(Sender: TObject); begin ExePath := 'C:\'; if FileCtrl.SelectDirectory(ExePath, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then begin edtExe.Text := ExePath; ExeSet := True; if ExeSet and LogSet then btnExtract.Enabled := True; end else ShowMessage('You Must Select a Path for EXEs'); end; procedure TfrmMdp.ExtractionCommand(BatFile : string; TempFileName: string; TempLogName: string); var Lines : TStrings; Line, FileName, LogName, BatFileName : string; begin BatFileName := BatFile; FileName := TempFileName; LogName := TempLogName; Lines := TStringList.Create; try Lines.Add(ExePath + '\' + FileName + ' > ' + LogPath + '\' + LogName); Lines.SaveToFile(BatFileName); Lines.LoadFromFile(BatFileName); finally Lines.Free; end; procedure TfrmMdp.btnExtractClick(Sender: TObject); begin IDeviceInfo := 'ideviceinfo.bat'; ExtractionCommand(IDeviceInfo, 'ideviceinfo.exe', 'ideviceinfo.log'); dosDeviceId.CommandLine := ExePath + '\' + IDeviceInfo; dosDeviceId.Execute; end; procedure TfrmMdp.btnLogsClick(Sender: TObject); begin LogPath := 'C:\'; if FileCtrl.SelectDirectory(LogPath, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then begin edtLogs.Text := LogPath; LogSet := True; end else ShowMessage('You Must Select a Location for Logs'); end; procedure TfrmMdp.FormClose(Sender: TObject; var Action: TCloseAction); begin DeleteFile(ExePath + '\ideviceinfo.bat'); end; procedure TfrmMdp.FormCreate(Sender: TObject); begin vgApple.LicenseString := blanked for security; end; end. Edited March 2 by Delphied Share this post Link to post
Delphied 0 Posted March 2 I'll add when I comment out this code: procedure TfrmMdp.ExtractionCommand(BatFile : string; TempFileName: string; TempLogName: string); var Lines : TStrings; Line, FileName, LogName, BatFileName : string; begin BatFileName := BatFile; FileName := TempFileName; LogName := TempLogName; Lines := TStringList.Create; try Lines.Add(ExePath + '\' + FileName + ' > ' + LogPath + '\' + LogName); Lines.SaveToFile(BatFileName); Lines.LoadFromFile(BatFileName); finally Lines.Free; end; All the issues go away Share this post Link to post