---
title: "IR capture"
canonical: "https://docs.cuesystem.com/space/CVCHELP/555253841/IR%20capture"
format: markdown
---
> Macro (toc)

---

# IrCaptureToByteString

This function captures Ir data and saves them to the destination ByteString.** ** 

#### Syntax 

```visualbasic
Function IrCaptureToByteString(
  ByRef destination As ByteString, 
  Optional starttimeout As Time := :5.0, 
  Optional maxgaplength As Time := :0.5, 
  Optional maxirdatalength As Time := :0.5) 
As Boolean
```

#### Parameters 

destination 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination ByteString.  

starttimeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 5 seconds. It is the maximal timeout for waiting for the first Ir data burst. The value of this parameter must be in the range of 0 to 5 seconds.

maxgaplength 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 0.5 seconds. It is the maximal length of the valid gap in Ir data. The value of this parameter must be in the range of 0 to 4 seconds. 

maxirdatalength 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 0.5 seconds. It is the maximal duration of captured Ir data. The value of this parameter must be in the range of 0 to 2 seconds. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u>. It is True on success or False if an error occurs. 

A function GetLastError returns the error number. These errors can happen: <u>[500](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#500)</u>, <u>[501](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#501)</u>, <u>[502,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#502)</u> <u>[503](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#503)</u>, <u>[504,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#504)</u> <u>[505,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#505)</u> <u>[506,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#506)</u> <u>[507,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#507)</u> <u>[508,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#508)</u> <u>[509,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#509)</u> <u>[510,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#510)</u> <u>[511](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#511)</u>. 

# IrCaptureToFile

This function captures Ir data and saves them to a file.** ** 

#### Syntax 

```visualbasic
Function IrCaptureToFile(
  filename As Text, 
  Optional starttimeout As Time := :5.0, 
  Optional maxgaplength As Time := :0.5, 
  Optional maxirdatalength As Time := :0.5) 
As Boolean
```

#### Parameters* *

filename 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the destination file name.  

starttimeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 5 seconds. It is the maximal timeout for waiting for the first Ir data burst. The value of this parameter must be in the range of 0 to 5 seconds. 

maxgaplength 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 0.5 seconds. It is the maximal length of the valid gap in Ir data. The value of this parameter must be in the range of 0 to 4 seconds. 

maxirdatalength 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 0.5 seconds. It is the maximal duration of captured Ir date. The value of this parameter must the range of 0 to 2 seconds. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u>. It is True on success or False if an error occurs. 

A function GetLastError returns the error number. These errors can happen: <u>[500](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#500)</u>, <u>[501](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#501)</u>, <u>[502,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#502)</u> <u>[503](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#503)</u>, <u>[504,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#504)</u> <u>[505,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#505)</u> <u>[506,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#506)</u> <u>[507,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#507)</u> <u>[508,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#508)</u> <u>[509,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#509)</u> <u>[510,](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#510)</u> <u>[511](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/510525445/Command+errors#511)</u>.