-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/JPersson77/LGTVCompanion
- Loading branch information
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function getBacklight() | ||
{ | ||
$value = & 'C:\Program Files\LGTV Companion\LGTVcli.exe' -ok backlight -get_system_settings picture [`\`"backlight`\`"] | ||
Write-Host "Backlight is set to $value" | ||
} | ||
|
||
function setBacklight([int]$value) | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -backlight "$value" | Out-Null | ||
Write-Host "Backlight set to $value" | ||
} | ||
|
||
function volumeUp() | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/volumeUp | Out-Null | ||
} | ||
|
||
function volumeDown() | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/volumeDown | Out-Null | ||
} | ||
|
||
|
||
function getVolume() | ||
{ | ||
$jsonObject = (& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/getVolume)|ConvertFrom-json | ||
$volume=$jsonObject.Device1.payload.volumeStatus.volume | ||
Write-Host "Volume is set to $volume" | ||
} | ||
|
||
function setVolume([int]$value) | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request_with_param com.webos.service.audio/master/setVolume "{\`"volume\`":$value}" | Out-Null | ||
Write-Host "Volume set to $value" | ||
} | ||
|
||
function setHDMI([int]$value) | ||
{ | ||
if ($value -In 1..4) { | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -setHdmi "$value" | Out-Null | ||
Write-Host "HDMI is set to $value" | ||
} else { | ||
Write-Host "HDMI can only be set between 1-4!" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Powershell example functions | ||
|
||
Following functions are definedin the file [Microsoft.PowerShell_profile.ps1](./Example%20scripts/Microsoft.PowerShell_profile.ps1) | ||
|
||
- getBacklight | ||
- setBacklight [0-100] | ||
- getVolume | ||
- setVolume [0-100] | ||
- volumeUp | ||
- volumeDown | ||
- setHDMI [1-4] | ||
|
||
If you don't have this file already, just make a folder called `WindowsPowerShell` in your `C:\Users\<username>\Documents` and copy the file [Microsoft.PowerShell_profile.ps1](./Example%20scripts/Microsoft.PowerShell_profile.ps1) into it. The functions will be then usable in the every new powershell session. | ||
|
||
# Functions | ||
|
||
```Powershell | ||
function getBacklight() | ||
{ | ||
$value = & 'C:\Program Files\LGTV Companion\LGTVcli.exe' -ok backlight -get_system_settings picture [`\`"backlight`\`"] | ||
Write-Host "Backlight is set to $value" | ||
} | ||
function setBacklight([int]$value) | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -backlight "$value" | Out-Null | ||
Write-Host "Backlight set to $value" | ||
} | ||
function volumeUp() | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/volumeUp | Out-Null | ||
} | ||
function volumeDown() | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/volumeDown | Out-Null | ||
} | ||
function getVolume() | ||
{ | ||
$jsonObject = (& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request com.webos.service.audio/master/getVolume)|ConvertFrom-json | ||
$volume=$jsonObject.Device1.payload.volumeStatus.volume | ||
Write-Host "Volume is set to $volume" | ||
} | ||
function setVolume([int]$value) | ||
{ | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -request_with_param com.webos.service.audio/master/setVolume "{\`"volume\`":$value}" | Out-Null | ||
Write-Host "Volume set to $value" | ||
} | ||
function setHDMI([int]$value) | ||
{ | ||
if ($value -In 1..4) { | ||
& 'C:\Program Files\LGTV Companion\LGTVcli.exe' -setHdmi "$value" | Out-Null | ||
Write-Host "HDMI is set to $value" | ||
} else { | ||
Write-Host "HDMI can only be set between 1-4!" | ||
} | ||
} | ||
``` |