#******************************************* # MacVersion = 1.3 # MacDescription = Know your Local Maine Cacher Challenge # MacAuthor = David aka brdad # MacFileName = LocalMECacher.gsk # MacUrl = #******************************************* CancelFilter MacroFlag type=clear range=all SHOWSTATUS Msg="Flagging all caches..." #Set all Macro flags except on non-caches MFILTER Where=CacheType = 'A' OR CacheType = 'B' OR CacheType = 'C' OR CacheType = 'E' OR CacheType = 'I' OR CacheType = 'M' OR CacheType = 'O' OR CacheType = 'R' OR CacheType = 'T' OR CacheType = 'U' OR CacheType = 'V' OR CacheType = 'W' OR CacheType = 'X' OR CacheType = 'Z' IF $_FilterCount > 0 MacroFlag type=set range=filter ELSE MSGOK Msg="No valid caches found!" Cancel EndIf SHOWSTATUS Msg="Clearing owned caches..." MFILTER Where=IsOwner IF $_FilterCount > 0 MacroFlag type=clear range=filter EndIf SHOWSTATUS Msg="Clearing unfound archived caches..." MFILTER Where=not found and status='X' IF $_FilterCount > 0 MacroFlag type=clear range=filter EndIf SHOWSTATUS Msg="Clearing caches found before 2010-01-01..." MFILTER Where=found And FoundByMeDate < date('2010-01-01') IF $_FilterCount > 0 MacroFlag type=clear range=filter EndIf SHOWSTATUS Msg="Clearing Owners with less than 3 cache types..." #Get List of OwnerIds which have less than 3 cache types $_sql = "Select OwnerId From (Select Count(Distinct(CacheType)) As Types, OwnerId, OwnerName From CachesAll Where MacroFlag=1 Group By OwnerId Having Types < 3)" $result = Sqlite("sql",$_sql,"") # Format result for list $result = Replace(Chr(10),"|",$result,TRUE) $result = Replace(Chr(13),"",$result,TRUE) $result = "'" + $result + "'" #Clear the macro flags for those owners $_sql = "g_regex($result,OwnerId)" SHOWSTATUS Msg="Filtering GSAk grid..." Mfilter where=$_sql IF $_FilterCount > 0 MacroFlag type=clear range=filter ELSE MSGOK Msg="Cannot find any hiders hiding 3 different types of caches!" EndIf MFILTER Where=MacroFlag SQLSORT OrderBy="OwnerName" COLLATE NOCASE Asc, "CacheType" Asc