Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #What display user want
  2. $WhichDisplay = Read-Host -Prompt 'Input main display for hearthstone'
  3.  
  4. #Setting it in reg
  5. Set-ItemProperty -Path "HKCU:\SOFTWARE\Blizzard Entertainment\Hearthstone\" -Name UnitySelectMonitor_h17969598 -Value ($WhichDisplay-1)
  6.  
  7. #For cross reference against the windows monitor info
  8. $Display = "DISPLAY$Whichdisplay"
  9.  
  10. #Getting info from the system
  11. $Monitors = [System.Windows.Forms.Screen]::AllScreens
  12.  
  13. foreach ($Monitor in $Monitors)
  14. {
  15. $DeviceName = (($Monitor.DeviceName).replace("\", "")).replace(".", "")
  16. if( $DeviceName -eq $Display)
  17. {
  18. $Width = $Monitor.bounds.Width
  19. $Height = $Monitor.bounds.Height
  20. }
  21. }
  22.  
  23. #Set local user
  24. $p = $ENV:UserProfile
  25.  
  26. #File to change
  27. $file = "$p\AppData\Local\Blizzard\Hearthstone\options.txt"
  28.  
  29. #Get file content and store it into $content variable
  30. $content = Get-Content -Path $file
  31.  
  32. #Check and change
  33. $i=0
  34. $u=0
  35. While ($content[$i] -ne $null)
  36. {if ($content[$i] -match "graphicsheight")
  37. {$content[$i] = "graphicsheight=$Height"}
  38. $i++
  39. }
  40.  
  41. While ($content[$u] -ne $null)
  42. {if ($content[$u] -match "graphicswidth")
  43. {$content[$u] = "graphicswidth=$Width"}
  44. $u++
  45. }
  46. # Set the new content
  47. $content | Set-Content -Path $file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement