Jump to content

Diablo Ii - Detect Window Size (scrap)


Recommended Posts

$darkred = 4522241
$lightred = 16711680
$darkblue = 55
$lightblue = 255

if not processexists("Game.exe") then 
;this process assumes game.exe, you can add errors here or whatever
endif

If Not WinActive("Diablo II","") Then WinActivate("Diablo II","")
WinWaitActive("Diablo II", "")
WinMove("Diablo II", "", 0, 0)
WinSetOnTop ("Diablo II", "", 1)
Sleep(1000)
WinWaitActive("Diablo II")
Sleep(100)

$w6401 = PixelGetColor(77,424)
$w6402 = PixelGetColor(577,424)
$f6401 = PixelGetColor(67,400)
$f6402 = PixelGetColor(577,400)
$w8001 = PixelGetColor(90,570)
$w8002 = PixelGetColor(750,570)
$f8001 = PixelGetColor(75,514)
$f8002 = PixelGetColor(744,514)

if $w6401 > $darkred and $w6401 < $lightred and $w6402 > $darkblue and $w6402 < $lightblue then
    splashtexton("Color", "Windowed 640 res", 200, 200)
    sleep(10000)
elseif $f6401 > $darkred and $f6401 < $lightred and $f6402 > $darkblue and $f6402 < $lightblue Then
    splashtexton("Color", "Fullscreen 640 res", 200, 200)
    Sleep(10000)
elseif $w8001 > $darkred and $w8001 < $lightred and $w8002 > $darkblue and $w8002 < $lightblue Then
    splashtexton("Color", "Windowed 800 res", 200, 200)
    sleep(10000)
elseif $f8001 > $darkred and $f8001 < $lightred and $f8002 > $darkblue and $f8002 < $lightblue Then
    splashtexton("Color", "Fullscreen 800 res", 200, 200)
    sleep(10000)
else
    splashtexton("Color", "Not Recognized.", 300, 200);if you aren't getting the res
    sleep(10000)
EndIf

This code will tell you if D2 is running in Windowed 640, Fullscreen 640, Windowed 800 or Fullscreen 800 (the only possible resolutions). If it is not working for you, please tell me so I can make it more universal, but it should work.

Diablo title must be "Diablo II" for this simple code.

Link to comment
Share on other sites

Nice effort and all, but this script could be replaced with a couple lines of code.

$a_size = WinGetPos("Diablo II")
If @error = 1 Then
MsgBox(0,"Diablo Size", "Window not found")
Else
MsgBox(0,"Diablo Size","Width: "& $a_size[2]&" Height: "&$a_size[3])
EndIf

Similarly, you can use WinGetState to see if it is in windowed or fullscreen mode. No messy pixel functions.

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Nice effort and all, but this script could be replaced with a couple lines of code.

$a_size = WinGetPos("Diablo II")
If @error = 1 Then
MsgBox(0,"Diablo Size", "Window not found")
Else
MsgBox(0,"Diablo Size","Width: "& $a_size[2]&" Height: "&$a_size[3])
EndIf

Similarly, you can use WinGetState to see if it is in windowed or fullscreen mode. No messy pixel functions.

Once again: things that should have been brought to my attention YESTERDAY (when I asked =[ )!

Link to comment
Share on other sites

Once again: things that should have been brought to my attention YESTERDAY (when I asked =[ )!

No need to get upset, I was just trying to help out :)
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...