lib/screen-recorder/window.rb
#
# Returns a list of available window titles for the given process (application) name.
#
# @return [Array]
#
# @example
#   ScreenRecorder::Window.fetch_title('chrome')
#   #=> ["New Tab - Google Chrome"]
Returns a list of available window titles for the given process (application) name.
Returns a list of available window titles for the given process ( application ) name .
def window_title_for(process_name)
        raise NotImplementedError, 'Only Microsoft Windows (gdigrab) supports window capture.' unless OS.windows?
        titles = `tasklist /v /fi "imagename eq #{process_name}.exe" /fo list | findstr  Window`
                   .split("\n")
                   .map { |i| i.gsub(FILTERED_TITLES, '') }
                   .reject(&:empty?)
        raise Errors::ApplicationNotFound, "No open windows found for: #{process_name}.exe" if titles.empty?
        warn_on_mismatch(titles, process_name)
        ScreenRecorder.logger.debug "Retrieved titles: #{titles}"
        titles
      end
def window_title_for ( process_name ) raise NotImplementedError , 'Only Microsoft Windows (gdigrab) supports window capture.' unless OS . windows? titles = ` tasklist /v /fi "imagename eq  #{ process_name } .exe" /fo list | findstr  Window ` . split ( "\n" ) . map { | i | i . gsub ( FILTERED_TITLES , '' ) } . reject ( & :empty? ) raise Errors :: ApplicationNotFound , "No open windows found for: #{process_name}.exe" if titles . empty? warn_on_mismatch ( titles , process_name ) ScreenRecorder . logger . debug "Retrieved titles: #{titles}" titles end
Returns a list of available window titles for the given process (application) name.
Returns a list of available window titles for the given process ( application ) name .
None
Array
process_name
<not_specific>
example
:Window.fetch_title('chrome') #=> ["New Tab - Google Chrome"]
: Window . fetch_title ( ' chrome ' ) # = > [ " New Tab - Google Chrome " ]