Automation Connect IQ SDK

In PowerShell you will often use the sample using the above library.
First, use the Garmin SDK and a part of Jungle to execute the build.

# Since the description of AutomationConnectIQ.Lib is troublesome, make the following settings
using namespace AutomationConnectIQ.Lib;

# Creating SDK environment
$sdk = New-Object GarminSDK -Property @{
	Key = "developer_key" # Specify the developer key
# Load project file
$proj = New-Object Jungle("monkey.jungle")

# Build the project
# Executable is placed under bin under the project.
$sdk.BuildProgram($proj, "fr45")

# Build the project
# The execution format is specified by a parameter.(The example below is% TEMP%hoge.prg)
$sdk.BuildProgram($proj, "fr45", $env:temp + "hoge.prg")

# Build all devices
# The output file is% TEMP% devicename.prg
# Build logs are saved in% TEMP% output.txt
$filename = Join-Path $env:TEMP "output.txt"
$tw = New-Object System.IO.StreamWriter($filename, $false, [Text.Encoding]::GetEncoding("UTF-8"))
$sdk.Writer = $tw   # Set the output destination of logs generated in Garmin SDK
# Build all targets
foreach ($dev in $proj.Devices) {
    $tw.WriteLine($sdk.BuildProgram($proj, $dev, $(Join-Path $env:TEMP $dev".prg")))
$sdk.Writer = $null # Cancel log output (must be done before closing the output destination)
  • The 6th line is the implementation that specifies the developer key file when building.
    Note that if you do not make this setting, the build will always fail.
  • The build process on line 13 is a command to build the program in the standard location for the specified device.
    On the other hand, the build process on the 17th line is a command to build a program with the specified file name.
  • The code on lines 22-24 is an implementation to redirect the log generated in the build command to the specified file.
    If you use this, be aware that if you do not implement the post-processing on the 29th and 30th lines, problems may occur in the script.
  • The 26th to 28th lines are the implementation method to build the program for all the targets registered in the project.


Copied title and URL