Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534

    Star need help with code

    i want to delete the selected node from ini file... it only deletes from tree object but not from ini file... what am doing wrong

    Code:
    	SelectedTab = Tree.GetSelectedNode("Favorites_Panel");
    	TabDataTable = Tree.GetNode("Favorites_Panel", SelectedTab);
    	TabText = TabDataTable.Text
    if SelectedTab then
    	Tree.RemoveNode("Favorites_Panel", SelectedTab);
    	FavCount = Tree.GetChildCount("Favorites_Panel", "0");
    for node=1, FavCount do
    	FavDataTable = Tree.GetNode("Favorites_Panel", node);
    	Url = FavDataTable.Data
    	Name = FavDataTable.Text
    	INIFile.DeleteValue("AutoPlay\\Docs\\favorites.ini", Name, "Url", Url);
    end
    else
    end
    Last edited by jackdaniels; 04-23-2008 at 04:36 AM.

  2. #2
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    Quote Originally Posted by jackdaniels View Post
    i want to delete the selected node from ini file... it only deletes from tree object but not from ini file... what am doing wrong

    Code:
    	SelectedTab = Tree.GetSelectedNode("Favorites_Panel");
    	TabDataTable = Tree.GetNode("Favorites_Panel", SelectedTab);
    	TabText = TabDataTable.Text
    if SelectedTab then
    	Tree.RemoveNode("Favorites_Panel", SelectedTab);
    	FavCount = Tree.GetChildCount("Favorites_Panel", "0");
    for node=1, FavCount do
    	FavDataTable = Tree.GetNode("Favorites_Panel", node);
    	Url = FavDataTable.Data
    	Name = FavDataTable.Text
    	INIFile.DeleteValue("AutoPlay\\Docs\\favorites.ini", Name, "Url", Url);
    end
    else
    end

    I highlighted your problem in red and below is the fix

    Code:
    INIFile.DeleteValue("AutoPlay\\Docs\\favorites.ini", Name, Url)

  3. #3
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534
    thanks alot but it doesnt delete from ini file !!!

  4. #4
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    very odd it worked for me, ill look into it jack and get back wit you

  5. #5
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    your right jack it doesnt work everytime i just tried it again and no go [must be a bug cause its intermittent at best] but here's my workaround [shorter code too hope you dont mind ]

    Code:
    Selected = Tree.GetSelectedNode("Favorites_Panel");
    SelProps = Tree.GetNode("Favorites_Panel", Selected);
    if SelProps then
      Name = SelProps.Text
      Url = SelProps.Data
      INIFile.DeleteSection("AutoPlay\\Docs\\favorites.ini", Name);
      Tree.RemoveNode("Favorites_Panel", Selected);
    end
    will remove from tree and ini [granted if your making favs for a browser you should make it create the section in the ini file as its added.]

  6. #6
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534
    thanks alot TimeSurfer

  7. #7
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    the code i posted above is for your remove button.

    here is the new code for your edit button. i also added in error checking and such so that way you dont get null data [sent in a pm also]

    Code:
    Selected = Tree.GetSelectedNode("Favorites_Panel");
    SelProps = Tree.GetNode("Favorites_Panel", Selected);
    if SelProps then
      Name = SelProps.Text
      Url = SelProps.Data
      INIFile.DeleteSection("AutoPlay\\Docs\\favorites.ini", Name);
      NewName = Dialog.Input("Edit Favorite - Enter a name", "Please enter the name for the favorite: "..Name, "", MB_ICONQUESTION);
      if NewName ~= "CANCEL" then
        NewSite = {}
        NewSite.Text = NewName
        if NewName == "" then
          Dialog.Message("Error", "You must designate a name for your favorite, it cannot be blank.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
          NewName = Dialog.Input("Edit Favorite - Enter a name", "Please enter the name for the favorite: "..Name, "", MB_ICONQUESTION);
        end
        NewUrl = Dialog.Input("Edit Favorite - Specify the address", "Please enter a url address for: "..NewName, Url, MB_ICONQUESTION);
        if NewUrl ~= "CANCEL" then
          NewSite = {}
          NewSite.Text = NewName
          NewSite.Data = NewUrl
          if NewUrl ~= "" then
            Tree.SetNode("Favorites_Panel", Selected, NewSite);
          else
            Dialog.Message("Error", "URL must be defined and cannot be blank to add favorite.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
            NewUrl = Dialog.Input("Edit Favorite - Specify the address", "Please enter a url address for: "..NewName, Url, MB_ICONQUESTION);
          end
        end
      end
      if NewSite.Text ~= "" and NewSite.Data ~= "" then
        INIFile.SetValue("AutoPlay\\Docs\\favorites.ini", NewSite.Text, "Url", NewSite.Data);
      end
    end
    enjoy

  8. #8
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534
    thanks alot TimeSurfer u r a star

  9. #9
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    lol thanks, btw i just upgraded to rockstar rofl...

    heres your new apz m8, [i did remove a couple of your global functions as they werent needed anymore, and i did some customizing to one of em to make the favs display in a hierarchy when you 1st load it and when you add 1]

    enjoy lol love them smilies
    Attached Files

  10. #10
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534
    when i click edit and type nothing then click cancel , i get that error
    Attached Images

  11. #11
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    oops thats my fault, reposted and fixed. [i was trying to make it so u cant enter blank text lol, **** i wish ams had goto loops lol] problem was i put the conditional statement in wrong place lol
    Attached Files
    Last edited by TimeSurfer; 04-23-2008 at 10:58 AM.

  12. #12
    Join Date
    Mar 2007
    Location
    HeaveN
    Posts
    534
    thanks alot TimeSurfer that works perfect

Similar Threads

  1. Article: Using Authenticode Code Signing Certificates
    By Ted Sullivan in forum Setup Factory 8.0 Examples
    Replies: 4
    Last Post: 10-31-2007, 09:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts