1. I use this code to auto sell any grey quality items automaticly:

     local frame = CreateFrame("Frame")  
     frame:RegisterEvent("MERCHANT_SHOW")  
     frame:SetScript("OnEvent", function()  
     --sell trash  
         local bag, slot, item  
         for bag = 0, 4 do  
             if GetContainerNumSlots(bag) > 0 then  
                 for slot = 1, GetContainerNumSlots(bag) do  
                     item = GetContainerItemLink(bag, slot)  
                     if item and select(3, GetItemInfo(item)) == 0 then --item is "poor" (gray) quality  
                         UseContainerItem(bag, slot)     
                     end 
                 end  
             end  
         end  
    

    I was wondering is there anyway to have it Print me a message and say something like "Vendor:Sold all grey items for "in here I would like the total money made selling the greys". (doesnt have to be each individual item sold but a total of all greys sold to vendor)

    This might work:

     local frame = CreateFrame("Frame")  
     frame:RegisterEvent("MERCHANT_SHOW")  
     frame:SetScript("OnEvent", function()  
         --sell trash  
         local totalValue = 0
         for bag = 0, 4 do  
             if GetContainerNumSlots(bag) > 0 then  
                 for slot = 1, GetContainerNumSlots(bag) do  
                     local item = GetContainerItemLink(bag, slot)  
                     if item and select(3, GetItemInfo(item)) == 0 then --item is "poor" (gray) quality  
                         UseContainerItem(bag, slot)     
                         local value = select(11, GetItemInfo(item))
                         totalValue = totalValue + value
                     end 
                 end  
             end
             print("Sold items to vendor for " .. totalValue) 
         end) 
    

    I tried this code but when I sold a grey to vendor I got these messages:

    Sold items to vendor for 0

    Sold items to vendor for 12500

    Sold items to vendor for 12500

    Sold items to vendor for 12500

    Sold items to vendor for 12500

    If I sold one item or a stack of 3 gives same messages.

    Then you'll need to do further calculation about how many items are in the stack, and how much you made from it. You might look at tekJunkSeller.. it does this and might have the code to get the amount sold, I'm not sure.

    Your help is much appreciated, I looked at tekJunkSeller's code almost the same as what I'm using and it doesn't have any print message code. I'll post on more websites, and see what I can come up with.

    Thank You

    Well you can get all the information from here.. I just don't have the time to write the code for you.

    GetContainerItemInfo can tell you how many items are in the stack you are selling.

    GetItemInfo can tell you how much each individual item in the stack will sell for.

    The two of those and simple math/programming can get you what you desire.