hi, what version of chat gpt are u using?
- User
hi, what version of chat gpt are u using?
- Assistant
I am an AI language model based on OpenAI's GPT-3.5-turbo.
- User
can you fix this code for me, the execution policy is unrestricted and it is running as admin. The powershell script only opens for a few seconds and closes. I think it is because of incorrect file locations but i am not sure:
Wait for Logitech G Hub to be installed
do { Start-Sleep -Seconds 1 } until (Get-Command "LogiOverlay.exe" -ErrorAction SilentlyContinue)
Set DPI to 800 at a report rate of 1000
GHubExePath = (Get-ChildItem "C:\Program Files\LGHUB\app\*" -Include "lghub_agent.exe" -Recurse -ErrorAction SilentlyContinue).FullName & GHubExePath /commands='{"settings":{"dpi_value":"800","dpi_report_rate":"1000"}}'
Remove other DPI settings
env:LOCALAPPDATA\LGHUB\profiles*" | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName "profile.json" (Get-Content } | ConvertTo-Json -Depth 5 | Set-Content $GHubProfilePath -Force
- Assistant
It seems like the issue might be due to the
Get-Commandcall being used to check for the installation of Logitech G Hub. The script waits forLogiOverlay.exe, but this executable might not be available in the PATH. Instead, you can check for the existence of thelghub_agent.exefile itself.Here's the updated script with this modification:
# Wait for Logitech G Hub to be installed do { $GHubExePath = (Get-ChildItem "C:\Program Files\LGHUB\app\*" -Include "lghub_agent.exe" -Recurse -ErrorAction SilentlyContinue).FullName Start-Sleep -Seconds 1 } until ($GHubExePath) # Set DPI to 800 at a report rate of 1000 & $GHubExePath /commands='{"settings":{"dpi_value":"800","dpi_report_rate":"1000"}}' # Remove other DPI settings $GHubProfilePath = Join-Path (Get-ChildItem "$env:LOCALAPPDATA\LGHUB\profiles\*" | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName "profile.json" (Get-Content $GHubProfilePath -Raw) | ConvertFrom-Json | ForEach-Object { $_.settings.dpi = [ordered]@{ "1" = $_.settings.dpi."1" }; $_ } | ConvertTo-Json -Depth 5 | Set-Content $GHubProfilePath -Force # Disable DPI shift button & $GHubExePath /commands='{"settings":{"dpi_shift_button_type":"0"}}' # Create "Win D" macro & $GHubExePath /commands='{"macros":[{"name":"Win D","commands":[{"type":1,"value":"{KEY_WIN DOWN}{KEY_D DOWN}{KEY_WIN UP}{KEY_D UP}"}]}]}' # Create "Discord" macro & $GHubExePath /commands='{"macros":[{"name":"Discord","commands":[{"type":1,"value":"{KEY_SHIFT DOWN}{KEY_F12 DOWN}{KEY_SHIFT UP}{KEY_F12 UP}"}]}]}' # Set lighting to red & $GHubExePath /commands='{"settings":{"lighting":{"color":{"color_id":"19"},"devices":[{"zone":"logo","mode_id":"14"},{"zone":"side_lighting","mode_id":"14"}]}}}'