Application

Callbacks and Conditional Logic

Methods for attaching custom logic that runs after data entry, when selectors match elements, or when selectors find no elements.

Methods for attaching custom logic that runs after data entry, when selectors match elements, or when selectors find no elements.

CallAfterFillIn registers a delegate that fires after each row of token data is consumed during a FillInFrom cycle. CallIfFound registers a delegate that fires when the selector locates matching UI elements. CallIfNotFound fires when no elements are found. PersistentCallIfFound and PersistentCallIfNotFound attach handlers that apply across all units of work for the lifetime of the application session. RemoveCallIfHandlerEverywhere removes a specific handler from all units of work at once.

Examples

GPAL Fluent: High-level fluent C# API

//CallIfFound and CallIfNotFound are evaluated each time the unit of work runs. They allow branching logic without breaking out of the fluent chain.

// Handle a 'Record Not Found' dialog conditionally GPAL.Application .Open("C:\MyApp\app.exe") .WithSelector(GPAL.Selector.WithAutomationID("lblError")) .CallIfFound((app, found, matched, sel) => { app.WithSelector(GPAL.Selector.WithAutomationID("btnOK")) .LeftClick(); return 0; }) .WithSelector(GPAL.Selector.WithAutomationID("txtSearch")) .FillInFrom(searchGrid) .CallAfterFillIn((app, grid) => { app.WithSelector(GPAL.Selector.WithAutomationID("btnSearch")) .LeftClick(); return 0; });