Jump to content

clubreseau

Members
  • Content Count

    33
  • Joined

  • Last visited

Everything posted by clubreseau

  1. I use delphi 10.4 I create a button and inside I add WebBrowser1.Navigate('https://www.aliexpress.com/'); to make it simple and test it. and I got a many javascript error how i can fix this. thank you ror
  2. clubreseau

    create a popupmenu from a SQL

    How to create a popupmenu from a SQL loop with categories and sub-categories, and at the end of my loop add 2 items to all Level_Depth 3. please I am a novice would be nice if you can give me a some code how to do.
  3. clubreseau

    create a popupmenu from a SQL

    Someone can help me ? How I can insert some subcategory Item in Category CRÉÉ on that code ? var Mi, Mx, My: TMenuItem; tblIDParent, tblIDCat : integer; tblName :string; begin tbl.SQL.Text:='SELECT c.id_category, c.id_parent, c.level_depth, cl.name FROM category AS c LEFT JOIN category_lang AS cl ON c.id_category = cl.id_category WHERE c.id_parent >= 2 ORDER BY c.id_category'; tbl.open; tbl.First; while not tbl.eof do begin tblIDCat := tbl.Fields[0].AsInteger; tblIDParent := tbl.Fields[1].AsInteger; tblName := tbl.Fields[3].AsString; if tbl.Fields[1].AsString = '2' then begin Mi := TMenuItem.create(popupmenu1); Mi.Caption := tblName; Mi.Tag := tblIDCat; popupmenu1.Items.add(Mi); end; if tbl.Fields[2].AsString = '3' then for var i := 0 to Popupmenu1.items.count - 1 do if Popupmenu1.items[i] is TMenuItem then if TMenuItem(Popupmenu1.items[i]).tag = tblIDParent then begin MI := TMenuItem.create(TMenuItem(Popupmenu1.items[i])); MI.Caption := tblName; MI.Tag := tblIDCat; TMenuItem(Popupmenu1.items[i]).Add(mi); Mx := TMenuItem.create(TMenuItem(Popupmenu1.items[i])); Mx.Caption := 'AJOUTER'; Mx.Tag := tblIDCat; Mx.OnClick := ONCLIK_ADD; Mi.Add(mx); Mx := TMenuItem.create(TMenuItem(Popupmenu1.items[i])); Mx.Caption := 'CRÉE'; Mx.Tag := tblIDCat; Mx.OnClick := ONCLIK_CREATE; Mi.Add(mx); end; tbl.next; end;
  4. clubreseau

    create a popupmenu from a SQL

    I fix it, than with AutoHotkeys property of the popup menu to maManual, Now my only problem, I want to add submenu to category DEL do you now how ?
  5. clubreseau

    create a popupmenu from a SQL

    I fix it, than with AutoHotkeys property of the popup menu to maManual, Now my only problem, I want to add submenu to category DEL do you now how ?
  6. clubreseau

    create a popupmenu from a SQL

    I fix it, than with AutoHotkeys property of the popup menu to maManual, Now my only problem, I want to add submenu to category DEL do you now how ?
  7. clubreseau

    create a popupmenu from a SQL

    Work perfect thank you How I can create subcategory to category DEL ?
  8. clubreseau

    create a popupmenu from a SQL

    Work perfect thank you only 1 problem on my onclick STR_PCAPTION := TMenuItem((Sender as TMenuItem).parent).caption; showmessage(STR_PCAPTION); all my category and subcategory start by &andthename ? How I can get the original name without & and how I can create subcategory to category DEL ?
  9. clubreseau

    Auto Fill the form

    Hi, I use TedgeBrowser and I want when I go to this page https://login.aliexpress.com/ that write my email and password automatically someone can explain or show me a part of code how to do it. thank you
  10. clubreseau

    remove part of string and compare

    Hi, Question 1 I have a listbox with full or URL like http://test.com/demo.php https://test.com/demo.php http://www.test.com/demo.php if my string have somethink like https://test.com/test/test.php then do not add in listbox1 because test.com are in the listbox1. maybe the solution is to remove http:// and https:// at the begining until first / and after compare to see. Question 2 I have a listbox with 3000 URL when I press the button to paste all items from listbox to memo, its feeze and take time. Someone have the solution for long text for memo. Thank you, please im visual need a demo of part of code.
  11. clubreseau

    remove part of string and compare

    You rock ! last question what is the commande to delete line in url.txt ?
  12. clubreseau

    remove part of string and compare

    its the opposite I would like.. delete url in listbox1. search in url.txt all duplicated remove in lixtbo1. in my listbox1 i have already 1000 URL, i dont want to load url from url.txt I want he look in URl.txt if line in litbox1 are in url.txt then delete the line in listbox.
  13. clubreseau

    remove part of string and compare

    sorry I misspoke then.
  14. clubreseau

    remove part of string and compare

    domain = http://welcome.com/hi.html the root or this domain is welcome.com remove http:// until /
  15. clubreseau

    remove part of string and compare

    this is my code and not working trying to loook into files and delete all duplicated URL in listbox1. procedure TForm1.DELETEURLClick(Sender: TObject); var Index : Integer; Dict : TDictionary<String, Integer>; URL : String; Domain : String; Value : Integer; sl : TStringList; ix : Integer; begin sl := TStringList.Create; Dict := TDictionary<String, Integer>.Create(100000); try ListBox1.Items.BeginUpdate; try for Index := ListBox1.Items.Count - 1 downto 0 do begin URL := ListBox1.Items[Index]; sl.LoadFromFile('C:\Users\myname\Documents\Url.txt'); ix := sl.IndexOf(URL); if URL = '' then begin ListBox1.Items.Delete(Index); continue; end; Domain := ExtractDomain(Trim(UpperCase(ix.ToString))); if Dict.TryGetValue(Domain, Value) then begin // Domain already found, delete from ListBox ListBox1.Items.Delete(Index); continue; end; // Domain not seen before, add to dictionary and don't remove from list Dict.Add(Domain, 0); end; finally ListBox1.Items.EndUpdate; end; finally FreeAndNil(Dict); sl.Free; end; end; function ExtractDomain(const URL : String) : String; var I, J : Integer; begin I := Pos('://', URL); if I <= 0 then I := 1 else Inc(I, 3); J := Pos('/', URL, I); if J <= 0 then begin Result := Copy(URL, I, MAXINT); Exit; end; Result := Copy(URL, I, J - I); end; thank you SIR !
  16. clubreseau

    remove part of string and compare

    Thank you its work perfectly ! How to convert it, to look at a file called url.txt that contain URL, and delete all duplicate domains in my listbox1 ? and like your code I want its look only domain root. If domain root are in Url.txt delete the entire URL in listbox1. Thank you
  17. clubreseau

    remove part of string and compare

    I have a listbox with full or URL like http://test.com/demo.php https://test.com/demo.php http://www.test.com/demo.php if my string have somethink like https://test.com/test/test.php then do not add in listbox1 because test.com are in the listbox1. maybe the solution is to remove http:// and https:// at the begining until first / and after compare to see. someone have a solution to delete duplicate domain in my listbox1 ?
  18. clubreseau

    remove part of string and compare

    the function do not delete all duplicate domain in listbox1 ? function ExtractDomainName(const Url: string): string; var FirstChar, LastChar, Len: Integer; begin Result := ''; FirstChar := Pos('://', Url); LastChar := Pos('/', Url, FirstChar + 3); if FirstChar = 0 then FirstChar := 1 // means no protocol there, so we adjust for the first char else FirstChar := FirstChar + 3; // to compensate the length of "://" if LastChar = 0 then LastChar := Length(Url) + 1; // adjust for the last char, add 1 for Len calculation if FirstChar >= LastChar then Exit; // we have broken an empty URL or broken one Len := LastChar - FirstChar; SetLength(Result, Len); Move(Url[FirstChar], Result[1], Len * SizeOf(Char)); end;
  19. clubreseau

    remove part of string and compare

    Im confused ! then the fastest way is ? someone tell me to use tstringlist ?
  20. clubreseau

    remove part of string and compare

    why this freeze the APP and take 1 minut to load 10K of items ? procedure TForm1.Button1(Sender: TObject); begin Form1.Memo1.Lines := Form2.Listbox1.Items; end;
  21. clubreseau

    remove part of string and compare

    I use this to Load 10K of Items from listbox1 to Memo1 and it take 4 minut to see items in memo1 and the APP Freeze. here my code procedure TForm1.Button1(Sender: TObject); var i:integer; begin Memo1.lines.BeginUpdate; try for i := 0 to ListBox1.Items.Count -1 do Memo1.Lines := ListBox1.Items; finally Memo1.lines.EndUpdate; end; end;
  22. clubreseau

    Need help with IDhttp and Thread

    Hi, Here is what I would like to do. a simple Form with a Tlistbox which would contain several URLs with a TButton and a TMemo. To make it simple, I try as quickly as possible to go to all the URLs of my listbox and take the source page of each URL in my listbox and if in the page the word Welcome is there. then insert the url in the Tmemo I have watched several tutorials that talk about Thread and Parallel Programming Library I can't seem to do this. I'm trying from this tutorial https://stackoverflow.com/questions/37123765/how-to-use-threads-with-idhttp-in-delphi-10 but it doesn't work. Could someone give me a piece of code that will do the job. Thank you and sorry for mu english
  23. clubreseau

    Need help with IDhttp and Thread

    Thank You Kryvich everything are perfect. The windows not feezing anymore, and the loop are going fast. Thank you for your time !
  24. clubreseau

    Need help with IDhttp and Thread

    Your code is Perfect only 1 problem, the windows freeze when the app run, can we fix this ? Someone respond me this... It freezes the main thread (where UI of your app is running) and thus you may feel it's frozen. Move your task into a worker thread
  25. clubreseau

    Need help with IDhttp and Thread

    the code freeze the windows sometime, when I have more then 10 url in listbox. that why need no more then 5 per time
×