How can I trigger a Citrix event handler if an incorrect window is returned by the Citrix Server? The introduction of Citrix support in SilkPerformer also saw the introduction of a Citrix Event Handler which can be used to specifically catch a Citrix interrupt during script execution. You can add a Citrix interrupt to the BDF script by using the function "CitrixAddInterrupt" which on certain window events (creations, activations, destructions, and caption changes) will check the interrupt specifications; when an interrupt specification matches an occurred event, then an interrupt will be thrown. To catch an interrupt the function "CitrixGetActInterrupt" needs to be executed in the event handler. Below is a sample BDF script which contains an event handler which will throw an error and exit the process if an incorrect Window (a window other than "ICA Seamless Host Agent") is created during replay of the Citrix BDF script. //---------------------------------------------------------------------- // Recorded 04/29/2005 by SilkPerformer Recorder v7.0.0.2364 //---------------------------------------------------------------------- benchmark SilkPerformerRecorder use "Kernel.bdh" use "CitrixAPI.bdh" dclevent handler Handler1 var nInterrupt, nWindow : number ; nStyle, nPos : number ; sCaption : string ; begin CitrixGetActInterrupt(nInterrupt, nWindow); CitrixGetWindowCaption(nWindow, sCaption); Writeln (sCaption); nPos := StrSearch(sCaption, "Seamless " , STR_SEARCH_FIRST); if nPos = 0 then CitrixGetScreen(sCaption+ ".bmp" ,nWindow, 10,10,350,150 ); RepMessage( "Error Message: \"Screenshot is incorrect!\"" , SEVERITY_PROCESS_EXIT); end end Handler1; dcluser user VUser transactions TInit : begin ; TMain : 1 ; var hWnd6 : number ; hWnd8 : number ; dcltrans transaction TInit begin end TInit; transaction TMain var begin CitrixInit( 800 , 600 ); CitrixAddInterrupt(INTERRUPT_WindowCreate, "ICA Seamless Host Agent" , MATCH_Exact); CitrixSetClientName( "SP_Recorder" ); CitrixConnect( "server1", "username" , "password" , "companydomain", COLOR_256); CitrixWaitForLogon(); hWnd6 := CitrixWaitForWindowCreation( "ICA Seamless Host Agent" , MATCH_Exact, 0x94C800C4, 0, 0, 390, 223 ); CitrixWaitForWindow(hWnd6, EVENT_Activate); CitrixWaitForWindowCreation( "Program Manager"); CitrixMouseClick( 194 , 198 , hWnd6, MOUSE_ButtonLeft); CitrixWaitForWindow(hWnd6, EVENT_Destroy); CitrixDisconnect(); end TMain; Old KB# 18046
↧