Smart Rule Engine

Organize Desktop Icons with Regex & Scripts

Define sorting rules once. Let RuleDock automatically organize new files into the right fences forever.

Why Manual Sorting is Broken

Every time you download a file, take a screenshot, or receive a document, it lands on your desktop. Before you know it, you're spending 10 minutes every week dragging icons into folders.

RuleDock's rule engine eliminates this tedious work. Create rules that match file patterns, and new icons automatically go where they belong.

Rule Types

RuleDock supports multiple rule types, from simple to advanced:

📁 Extension Match

Match files by their extension. Perfect for sorting images, documents, or executables.

.png → Design Fence
.docx → Documents Fence
.exe → Applications Fence

🔤 Name Contains

Match files whose names contain specific keywords.

*invoice* → Finance Fence
*backup* → Archives Fence

📂 Path Contains

Match files based on their full path. Useful for shortcut organization.

*\Games\* → Gaming Fence
*\Work\* → Work Projects

🎯 Regex Pattern

Full regex support for complex matching. Perfect for numbered files and patterns.

^Screenshot_\d{8}
.*_v\d+\.\d+\.exe$

DSL Expressions: Maximum Power

For complex sorting logic, RuleDock provides a Domain-Specific Language (DSL) that lets you combine multiple conditions.

DSL Expression Examples
# Sort design files by extension AND path
ext in ['.png', '.jpg', '.psd', '.ai'] and path contains 'Design'

# Match either executables OR installers
ext == '.exe' or ext == '.msi'

# Exclude system files from matching
ext == '.txt' and path != 'C:\Windows'

# Complex name matching
name contains 'report' and ext in ['.pdf', '.xlsx']

DSL Operators

Operator Description Example
== Exact match (case-insensitive) ext == '.pdf'
!= Not equal path != 'C:\Temp'
contains String contains substring name contains 'backup'
in [...] Value in list ext in ['.jpg', '.png']
and Both conditions must be true ext == '.exe' and name contains 'setup'
or Either condition is true ext == '.doc' or ext == '.docx'

Rule Priority & Conflict Resolution

When multiple rules match a single icon, RuleDock uses configurable conflict resolution:

  • Highest Priority - The rule with the highest priority number wins
  • First Match - The first matching rule in the list wins

You can set priorities in the rule editor, allowing fine-grained control over which rules take precedence.

Regex Safety: Timeout Protection

Complex regex patterns can sometimes cause catastrophic backtracking (ReDoS). RuleDock protects against this with a 200ms timeout on all regex evaluations. If a pattern takes too long, it's automatically skipped.

Safe Regex Configuration
// Internal timeout protection
private static readonly TimeSpan RegexTimeout = TimeSpan.FromMilliseconds(200);

try {
    return Regex.IsMatch(value, pattern, RegexOptions.IgnoreCase, RegexTimeout);
} catch {
    return false; // Safely skip problematic patterns
}

Getting Started with Rules

  1. Open RuleDock and go to Settings → Rules
  2. Click Add Rule
  3. Choose a rule type (Extension, Contains, Regex, or Expression)
  4. Enter your pattern and select the target fence
  5. Set priority if needed
  6. Save and watch your desktop organize itself!

Ready to Automate Your Desktop?

Download RuleDock and create your first sorting rule in minutes.

Download RuleDock Free