You need to have your AddOn do two things in its ToC:
- ## LoadOnDemand: 1
- ## LoadWith: Blizzard_AuctionUI
You are correct that the error is because the auction frame is not loaded, so you get nil errors. And if you want to access the auction UI when you are not visiting the auctioneer, well, I am not sure you can, but...
Lua Code:
if not IsAddOnLoaded("Blizzard_AuctionUI") then
LoadAddOn("Blizzard_AuctionUI")
end
-- now hook it and do stuff