Systemutil object in UFT

SystemUtil object can be used to perform below tasks
  • Close processes by Id, handle, name and window title
  • Close all processes opened by UFT using CloseDescendentProcesses method
  • launch the applications using Run method
  • block and unblock keyboard input using BlockInput and UnblockInput mehtod.

Closing the application

To close the application process by name, you can use below syntax. Below line of code will close the firefox process.
 
Systemutil.CloseProcessByName “firefox.exe”

Launching the application

  • First argument is the path to application binary.
  • Second argument is passed as argument to application itself.
  • Third argument can be used to specify the path of the binary.
  • Fifth argument can be used to specify the application window state.
 
SystemUtil.Run “iexplore.exe”, “www.softpost.org”
SystemUtil.Run “abc.txt”
SystemUtil.Run “iexplore.exe”, “”, “PathToIE”

Blocking and Unblocking Input in UFT

 
SystemUtil.BlockInput – blocks mouse and keyboard input
SystemUtil.UnBlockInput – unblocks mouse and keyboard input

Input is also unblocked when one of the below event occurs.
  • ctrl+alt+del key combination is pressed.
  • breakpoint is reached
  • test has ended
Complex problems, Simple Solutions