title: Script Bash & Batch - Resolution in Wine & Windows Registry For Some Games
body: <p>well this time , i have the dunno how to make in Bash and Batch scripts</p>
  
  <p>1 - Detect the current resolution</p>
  
  <p>2 - Write in the Registry Key that Resolution</p>
  
  <p>3 - I Dont know all resolutions in "dword" , someone can help me , with all resolutions , of any screen , 2:1 , 4:3 , 5:4 , 11:6 , 15:9 , 16:9 , 16:10 , 25:16 , 60:29 , 72:35 , any</p>
  
  <p>Okey now , for Example , with Wine under "No Windows S.O" , in "Bash" script . its more practical use something like this -></p>
  
  <p>A - Obtain the Current Resolution under Linux for Example -></p>
  
  <pre><code>echo `xrandr --current | grep current | awk '{print $8}'` &gt;&gt; Resolution1
  echo `xrandr --current | grep current | awk '{print $10}'` &gt;&gt; Resolution2
  cat Resolution2 | sed -i 's/,//g' Resolution2
  P1Resolution=$(cat Resolution1)
  P2Resolution=$(cat Resolution2)
  rm Resolution1 Resolution2
  echo "$P1Resolution"'x'"$P2Resolution" &gt;&gt; Resolution
  Resolution=$(cat Resolution)
  rm Resolution
  </code></pre>
  
  <p>B - Write a Registry File , for Example for "Warcraft 3" or "Ragnarok Classic International"</p>
  
  <p>Warcraft 3 :-></p>
  
  <pre><code>if      [ $Resolution = "640x480" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" &gt;&gt; video.reg
  echo '"resHEIGHT"=dword:000001e0' &gt;&gt; video.reg
  echo '"resWIDTH"=dword:00000280' &gt;&gt; video.reg
  
  # Add ResolutionRate
  echo '"ResolutionRatehrate"=dword:00000046' &gt;&gt; video.reg
  regedit -s video.reg
  
      elif    [ $Resolution = "800x600" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" &gt;&gt; video.reg
  echo '"resHEIGHT"=dword:00000258' &gt;&gt; video.reg
  echo '"resWIDTH"=dword:00000320' &gt;&gt; video.reg
  
  # Add ResolutionRate
  echo '"ResolutionRatehrate"=dword:00000046' &gt;&gt; video.reg
  regedit -s video.reg
  
      elif    [ $Resolution = "1024x768" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" &gt;&gt; video.reg
  echo '"resHEIGHT"=dword:00000300' &gt;&gt; video.reg
  echo '"resWIDTH"=dword:00000400' &gt;&gt; video.reg
  
  # Add ResolutionRate
  echo '"ResolutionRatehrate"=dword:00000046' &gt;&gt; video.reg
  regedit -s video.reg
  rm -rf video.reg
  else
      echo "Unknow Resolution"
  fi
  </code></pre>
  
  <p>Well Now with Ragnarok International :-></p>
  
  <pre><code>if          [ $Resolution = "640x480" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" &gt;&gt; video.reg
  echo '"HEIGHT="=dword:000001e0' &gt;&gt; video.reg
  echo '"WIDTH"=dword:00000280' &gt;&gt; video.reg
  regedit -s video.reg
  
      elif    [ $Resolution = "800x600" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" &gt;&gt; video.reg
  echo '"HEIGHT"=dword:00000258' &gt;&gt; video.reg
  echo '"WIDTH"=dword:00000320' &gt;&gt; video.reg
  regedit -s video.reg
  
      elif    [ $Resolution = "1024x768" ]; then
  echo "REGEDIT4" &gt;&gt; video.reg
  echo "" &gt;&gt; video.reg
  echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" &gt;&gt; video.reg
  echo '"HEIGHT"=dword:00000300' &gt;&gt; video.reg
  echo '"WIDTH"=dword:00000400' &gt;&gt; video.reg
  regedit -s video.reg
  rm -rf video.reg
  
  else
      echo "Unknow Resolution"
  fi
  </code></pre>
  
  <p>Okey that works fine in Bash , now in Batch , from where i can obtain the "Current Resolution" under Native "Windows" ???</p>
  
  <p>Part of the Batch Script , are be something like :</p>
  
  <pre><code>Warcraft 3 :-&gt;
  
  @echo off
  
  color A
  title Automatic Resolution Setup
  
  set key1=HKEY_CURRENT_USER\Software\Blizzard Entertainment\
  set key2=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III
  set key3=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video
  
  reg delete "%key1%" /f
  reg add "%key1%" /f
  reg add "%key2%" /f
  reg add "%key3%" /f
  reg add "%key3%" /t REG_DWORD /v reswidth /d %CURRENT_WIDTH% /f
  reg add "%key3%" /t REG_DWORD /v reshieght /d %CURRENT_HEIGHT% /f
  </code></pre>
  
  <p>Ragnarok International :-></p>
  
  <pre><code>@echo off
  color A
  title Automatic Resolution Setup
  set key=HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok
  reg delete "%key%" /f
  reg add "%key% /f
  reg add "%key%" /t REG_DWORD /v WIDTH /d %CURRENT_WIDTH% /f
  reg add "%key%" /t REG_DWORD /v HEIGHT /d %CURRENT_HEIGHT% /f
  </code></pre>
  
  <p>I need to know what are all possible resolutions , I just Know the Follows -></p>
  
  <pre><code>#640x480  -&gt; "(res)WIDTH"=dword:00000280 "(res)HEIGHT"=dword:000001e0
  #800x600  -&gt; "(res)WIDTH"=dword:00000320 "(res)HEIGHT"=dword:00000258
  #1024x768 -&gt; "(res)WIDTH"=dword:00000400 "(res)HEIGHT"=dword:00000300
  #1280×768 –&gt; "(res)WIDTH"=dword:00000500 "(res)HEIGHT"=dword:00000300 
  #1280×800 –&gt; "(res)WIDTH"=dword:00000500 "(res)HEIGHT"=dword:00000320 
  #1360×768 –&gt; "(res)WIDTH"=dword:00000550 "(res)HEIGHT"=dword:00000300 
  #1440×900 –&gt; "(res)WIDTH"=dword:000005A0 "(res)HEIGHT"=dword:00000384
  </code></pre>
  
  <p>Well , how i can get the values for "height" and "width" under natives windows , using a "Batch Script" for determinate the current resolution ???</p>
  
  <p>Someone can help me with my scripts plz ???</p>