Autor Beitrag
5M17H
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

XP, Vista32, bald auch Vista64
PHP(3/5), Delphi(2), Java(1), C(3), C#(1)
BeitragVerfasst: Di 03.07.07 22:42 
Mit meinem Programm bin ich fast fertig. Allerdings kommt jetzt ein mieses Problem. Solang die Titelformation gleich bleibt, ist alles kein Problem, ändert sich das aber, aiai.
Beispiel:
Ich überwache Mozilla Firefox.
Muster := %WS%PN (%WS=Website; %PN=Programmname)
Titel := iGoogle - Mozilla Firefox.
Ausgabe Funktioniert:
Website: iGoogle;
Programm: Mozilla Firefox;

Titel := Delphi-Forum.de - Neues Thema schreiben - Mozilla Firefox;
Ausgabe Fehlgeschlagen;
Website := Delphi;
Programm := Forum.de - Neues Thema schreiben - Mozilla Firefox; und Absturz.

Da ist schon der Fehler. Schaut mal.
user defined image
An sich Interpretiert er richtig, das Trennzeichen ist ' - ' und wenn ich das in einen String umwandel ist es nur '-'. Wie kann ich die Leerzeichen beibehalten? Quellcodeunabhängig muss das sein.

Kann man die sachen irgendwie von Hinten angehen? So bekomm ich auf jeden Fall als erstes den Programmnamen oder halt den *.pas namen oder was auch sonst immer.

Ich pack das Aktuelle Prog einfach mal in den Anhang, ansich läufts sogar schon, nur mit diesem Fehler halt.
Einloggen, um Attachments anzusehen!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 03.07.07 22:48 
Moin!

Und was sollen wir jetzt mit der Exe anstellen? :nixweiss: Disassemblieren?! 8)

Wie wäre es denn mit den relevanten Code-Teilen, hm? :roll: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Di 03.07.07 23:02 
Die Leerzeichen werden eigentlich mit der Funktion "Trim" entfernt, ansonsten bleiben die da.
Schau mal ob du die ausversehens irgendwo eingebaut hast.
5M17H Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

XP, Vista32, bald auch Vista64
PHP(3/5), Delphi(2), Java(1), C(3), C#(1)
BeitragVerfasst: Di 03.07.07 23:06 
Die *.exe Datei ist nur dazu da das Ihr euch mal das Programm anschauen könnt.

Was für code willst du haben? Ich meine soll ich mal alle 800-900 zeilen hier reinkopieren oder wirst du genauer?

Ich kopier mal was, wo ich denke das es euch Helfen könnte.

ausblenden volle Höhe Der Timer
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
procedure TForm1.Timer1Timer(Sender: TObject);
var i, y, aktZeit, zwZeit : Integer;
    format, trennzeichen, titel, tmp, tmp1, tmp2 : string;
    schon : TStringList;
begin
  zwZeit := 0;
  schon := TStringList.Create;
  Timer1.Interval := strtoint(edit1.text)*1000;
  memo1.Clear;
  memo2.Clear;
  TProgramme.Anlegen(memo1);
  EnumWindows(@ProgrammnamenAusgeben,0);
  for I := 0 to strtoint(konfig.ReadString('Konfiguration', 'Einträge', '')) do
  begin
    if Pos(konfig.ReadString(inttostr(i), 'ProgrammTitel', ''), memo2.Text) > 0 then
    begin
      for y := 0 to memo2.lines.Count - 1 do
      begin
        if Pos(konfig.ReadString(inttostr(i), 'ProgrammTitel', ''), memo2.Lines[y]) > 0 then
        begin
          if (pos(konfig.ReadString(inttostr(i), 'ProgrammTitel', ''), schon.Text) = 0) then
          begin
            aktZeit := konfig.ReadInteger(inttostr(i), 'ProgrammLaufZeit', 0);
            aktZeit := aktZeit + strtoint(edit1.text);
            konfig.WriteInteger(inttostr(i), 'ProgrammLaufZeit', aktZeit);
            format := konfig.ReadString(inttostr(i), 'Formatierung', '');
            trennzeichen := konfig.ReadString(inttostr(i), 'Trennungszeichen', '');
            titel := memo2.Lines[y];
            schon.Add(titel);
            delete(titel, Pos(' [wird ausgeführt]', titel), Pos(' [wird ausgeführt]', titel)+18);
            while titel <> '' do
            begin
              if PosEx('%', format, 2)<>0 then
              begin
                tmp := copy(format, 1, PosEx('%', format, 2)-1);
                delete(format, 1, PosEx('%', format, 2)-1);
              end
              else
              begin
                tmp := copy(format, 1, length(format));
                delete(format, 1, length(format));
              end;
              if PosEx(trennzeichen, titel, 2) <> 0 then
              begin
                tmp1 := copy(titel, 1, PosEx(trennzeichen, titel, 2)-2);
                delete(titel, 1, PosEx(trennzeichen, titel, 2)+1);
              end
              else
              begin
                tmp1 := copy(titel, 1, length(titel));
                delete(titel, 1, length(titel));
              end;
              if konfig.ReadString(inttostr(i), tmp+'_'+tmp1, '') <> '' then
              begin
                zwZeit := strtoint(konfig.ReadString(inttostr(i), tmp+'_'+tmp1+'_Zeit', ''));
                zwZeit := zwZeit + strtoint(edit1.text);
                konfig.WriteString(inttostr(i), tmp+'_'+tmp1+'_Zeit', inttostr(zwZeit));
              end
              else
              begin
                zwZeit := 10;
                konfig.WriteString(inttostr(i), tmp+'_'+tmp1, tmp1);
                konfig.WriteString(inttostr(i), tmp+'_'+tmp1+'_Zeit', inttostr(zwZeit));
                tmp2 := konfig.ReadString(inttostr(i), tmp, '');
                konfig.WriteString(inttostr(i), tmp, tmp2+','+tmp1);
              end;
            end;
          end;
        end;
      end;
    end;
  end;
  schon.Free;
end;


ausblenden volle Höhe Die Protokollanzeige (Siehe Bild)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
procedure TForm1.Protokoll1Click(Sender: TObject);
var i : integer;
    dateien, tmp, format, tmp1, tmpX : string;
begin
  Form4.Label1.Caption := '';
  for I := 1 to strtoint(konfig.ReadString('Konfiguration', 'Einträge', '')) do
  begin
    format := konfig.ReadString(inttostr(i), 'Formatierung', '');

    Form4.Label1.caption := Form4.Label1.caption + 'Programm: ' + konfig.ReadString(inttostr(i), 'ProgrammTitel', '');
    Form4.Label1.caption := Form4.Label1.caption + #13 + 'Laufzeit: ' +  inttostr(konfig.ReadInteger(inttostr(i), 'ProgrammLaufZeit', 0));
    Form4.Label1.caption := Form4.Label1.caption + #13 + 'Formatierung: ' + format;
    Form4.Label1.caption := Form4.Label1.caption + #13 + 'Trennungszeichen: ' +  konfig.ReadString(inttostr(i), 'Trennungszeichen', '');
    while format <> '' do
    begin
      if PosEx('%', format, 2)<>0 then
      begin
        tmp := copy(format, 1, PosEx('%', format, 2)-1);
        delete(format, 1, PosEx('%', format, 2)-1);
      end
      else
      begin
        tmp := copy(format, 1, length(format));
        delete(format, 1, length(format));
      end;
      dateien := konfig.ReadString(inttostr(i), tmp, '');
      while dateien <> '' do
      begin
        if PosEx(',', dateien, 2)<>0 then
        begin
          tmp1 := copy(dateien, 2, PosEx(',', dateien, 2)-2);
          delete(dateien, 1, PosEx(',', dateien, 2)-1);
        end
        else
        begin
          tmp1 := copy(dateien, 2, length(dateien));
          delete(dateien, 1, length(dateien));
        end;
        tmpX := konfig.ReadString('Kategorien', tmp, '');
        Form4.Label1.caption := Form4.Label1.caption + #13 + tmpX +': ' + tmp1 + ' : '+  konfig.ReadString(inttostr(i), tmp+'_'+tmp1+'_Zeit', '');
      end;
    end;
    Form4.Label1.caption := Form4.Label1.caption + #13 + #13;
  end;
  Form4.Visible := true;
  Form4.Height := Form4.Label1.Height + 50;
  Form4.Button1.Top := Form4.Height - 50;
end;


Wenn ihr nochwas Braucht meldet euch, ich gehe jetzt noch 30 Puzzlen und dan schlafen.

MFG Oli
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Di 03.07.07 23:12 
Mit DelimitedText kannst du einen String in mehrere Strings teilen.
Delimiter gibt das/die Zeichen an, an denen der String zerteilt wird.
Schau dazu mal in der Hilfe und im Forum.
5M17H Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

XP, Vista32, bald auch Vista64
PHP(3/5), Delphi(2), Java(1), C(3), C#(1)
BeitragVerfasst: Do 05.07.07 13:13 
Problem gelöst.