Forum > Beginners

code check

(1/2) > >>

scons:
I must forget something here, but I can't figure out what ... tried to add ";" to a few places but it still gives an error.

frm1.pas(103,7) Fatal: Syntax error, ";" expected but "identifier STATUSBAR1" found

Who can teel me what I forget ?

Thanks


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button3Click(Sender: TObject);var  sa: string;  sb: string;  sc: string;  myDateTime1 : TDateTime;  myDateTime2 : TDateTime;  myDateTime3 : TDateTime;  oldName, newName: string;  i, renameCount: integer;  NameA, nameB : string;begin  myDateTime1 := 0;  myDateTime2 := 42410;  myDateTime3 := now();  sc := FormatDateTime('dd.mm.yyyy', myDateTime3);  if myDateTime3<myDateTime2 then   begin    if (ListBox1.Count > 0) then     begin      renameCount:=0;      for i:=0 to ListBox1.Count-1 do        begin        if ExtractFileExt(ListBox1.Items[i])=('.txt') then          begin            NameA := (extractFilePath(Listbox1.Items[i]));            NameB := Copy((extractFileName(Listbox1.Items[i])),5,10);            oldName := ListBox1.Items[i];            newName := (NameA) + (Edit1.Text) + (NameB);            if RenameFileUTF8(oldName, newName) then               Inc(renameCount);          end        end      StatusBar1.SimpleText:=Format('  %d files renamed',[renameCount]);     end  else   begin     sleep(200);     ShowMessage('You waited too long' + sLineBreak + 'Expired at ' + sc);     sleep(200);     Close;   end;end;

taazz:

--- Quote from: scons on February 04, 2016, 08:58:24 pm ---I must forget something here, but I can't figure out what ... tried to add ";" to a few places but it still gives an error.

frm1.pas(103,7) Fatal: Syntax error, ";" expected but "identifier STATUSBAR1" found


--- End quote ---
Well the message is a bit cryptic but it does point you to the exact location you have the problem. What if I told you that the compiler expects a semicolon before the "StatusBar1.SimpleText:=Format(...." command. Will that help you find the missing semicolon?

scons:
thanks for your reply,

no, not really, if I put a ';' after the end before the Statusbar1, I get an error, If I put that ';' after the end that is before this end, I get an error, If I put a';' at both end's, I get an error.

So really I don't see it,

I looked at this page but it didn't get me any further.

FTurtle:
1. Line 32: Add ";" (it is not necessary, but make it a rule)
2. Line 33: Add ";" (necessarily)
3. Line 44: Add "end;"

After JEDI Code Format it will look:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button3Click(Sender: TObject);var  sa: string;  sb: string;  sc: string;  myDateTime1: TDateTime;  myDateTime2: TDateTime;  myDateTime3: TDateTime;  oldName, newName: string;  i, renameCount: integer;  NameA, nameB: string;begin  myDateTime1 := 0;  myDateTime2 := 42410;  myDateTime3 := now();  sc := FormatDateTime('dd.mm.yyyy', myDateTime3);  if myDateTime3 < myDateTime2 then  begin    if (ListBox1.Count > 0) then    begin      renameCount := 0;      for i := 0 to ListBox1.Count - 1 do      begin        if ExtractFileExt(ListBox1.Items[i]) = ('.txt') then        begin          NameA := (extractFilePath(Listbox1.Items[i]));          NameB := Copy((extractFileName(Listbox1.Items[i])), 5, 10);          oldName := ListBox1.Items[i];          newName := (NameA) + (Edit1.Text) + (NameB);          if RenameFileUTF8(oldName, newName) then            Inc(renameCount);        end;      end;      StatusBar1.SimpleText := Format('  %d files renamed', [renameCount]);    end    else    begin      sleep(200);      ShowMessage('You waited too long' + sLineBreak + 'Expired at ' + sc);      sleep(200);      Close;    end;  end;end;

scons:
no sorry, still no luck

Navigation

[0] Message Index

[#] Next page

Go to full version