Jump to content

Full images as buttons? possible?


Recommended Posts

Ok well i know this is possible with certain languages so before anyone tries saying this isnt possible, i'm just trying to find out of i can do this with auto-it.

I'm updating my perm bot for Diablo II and i'm adding some GUI to it. Das Ami has been nice enough to make an image for this GUI and i've been able to successfuly convert the boxes in his image into input boxes, however... when i try to convert his start button into an actual button instead of just part of the image, it PUTS the image ON TOP of a button, what i'm wondering is if there's any way to make that image the actual button, and if not make it to where if you click in a certain spot on the GUI it will act as tho you pressed a button.

Here's the image that i've got for the GUI:

Posted Image

Here's my code for this so far:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("PermEm-X", 360, 130,(@DesktopWidth-394)/2, (@DesktopHeight-189)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Account = GuiCtrlCreateInput("", 10, 100, 110, 20)
$Password = GuiCtrlCreateInput("", 10, 70, 110, 20)
$Game = GuiCtrlCreateInput("", 10, 40, 110, 20)
$Pass = GuiCtrlCreateInput("", 10, 10, 110, 20)
$Start = GuiCtrlCreateButton("Start PermEm-X", 307, 75, 41, 44, $BS_ICON)
GUICtrlSetImage(-1, "Start.bmp")
$Bg = GuiCtrlCreatePic("Background.jpg", 0, 0, 360, 130)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Start
        StartBot()
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

And here's what comes out of it when i chop the image and try to put it in my GUI:

Posted Image

Link to comment
Share on other sites

Ok well i know this is possible with certain languages so before anyone tries saying this isnt possible, i'm just trying to find out of i can do this with auto-it.

I'm updating my perm bot for Diablo II and i'm adding some GUI to it. Das Ami has been nice enough to make an image for this GUI and i've been able to successfuly convert the boxes in his image into input boxes, however... when i try to convert his start button into an actual button instead of just part of the image, it PUTS the image ON TOP of a button, what i'm wondering is if there's any way to make that image the actual button, and if not make it to where if you click in a certain spot on the GUI it will act as tho you pressed a button.

Here's the image that i've got for the GUI:

Posted Image

Here's my code for this so far:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("PermEm-X", 360, 130,(@DesktopWidth-394)/2, (@DesktopHeight-189)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Account = GuiCtrlCreateInput("", 10, 100, 110, 20)
$Password = GuiCtrlCreateInput("", 10, 70, 110, 20)
$Game = GuiCtrlCreateInput("", 10, 40, 110, 20)
$Pass = GuiCtrlCreateInput("", 10, 10, 110, 20)
$Start = GuiCtrlCreateButton("Start PermEm-X", 307, 75, 41, 44, $BS_ICON)
GUICtrlSetImage(-1, "Start.bmp")
$Bg = GuiCtrlCreatePic("Background.jpg", 0, 0, 360, 130)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Start
        StartBot()
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd
Exit

And here's what comes out of it when i chop the image and try to put it in my GUI:

Posted Image

add a case for $GUI_EVENT_PRIMARYDOWN that does what you'd want button to do if the mouse is clicked in the right area. Example: (change coords)

Case $msg = $GUI_EVENT_PRIMARYDOWN
       $pos = MouseGetPos()
       If $pos[0] > 100 And $pos[0] < 150 And $pos[1] > 100 And $pos[1] < 150 then Start()
Link to comment
Share on other sites

Tried it using these settings to go exactly around the orb, and nothing happens when i click it

Case $msg = $GUI_EVENT_PRIMARYDOWN
        $pos = MouseGetPos()
        If $pos[0] > 307 And $pos[0] < 75 And $pos[1] > 348 And $pos[1] < 119 Then Start()
you're never going to run into a case where the mouse's x position is greater than 307 and less than 75....
Link to comment
Share on other sites

lol oops, set them in the wrong places

Edit: tried it these 2 different ways, still didnt work (wasnt sure witch way x and y goes so i tried it both ways)

Case $msg = $GUI_EVENT_PRIMARYDOWN
        $pos = MouseGetPos()
        If $pos[0] > 307 And $pos[0] < 348 And $pos[1] > 75 And $pos[1] < 119 Then Start()

Case $msg = $GUI_EVENT_PRIMARYDOWN
        $pos = MouseGetPos()
        If $pos[0] > 75 And $pos[0] < 119 And $pos[1] > 307 And $pos[1] < 348 Then Start()
Edited by TK_Incorperate
Link to comment
Share on other sites

lol oops, set them in the wrong places

Edit: tried it these 2 different ways, still didnt work (wasnt sure witch way x and y goes so i tried it both ways)

Case $msg = $GUI_EVENT_PRIMARYDOWN
        $pos = MouseGetPos()
        If $pos[0] > 307 And $pos[0] < 348 And $pos[1] > 75 And $pos[1] < 119 Then Start()

Case $msg = $GUI_EVENT_PRIMARYDOWN
        $pos = MouseGetPos()
        If $pos[0] > 75 And $pos[0] < 119 And $pos[1] > 307 And $pos[1] < 348 Then Start()
you may be running into issues because of your coordinate mode. use this loop (from same script) to verify your coordinates

While 1
$pos = MouseGetPos()
ToolTip($pos[0] & ", " & $pos[1])
WEnd
Link to comment
Share on other sites

Doesnt work, this displays the actual placement of the mouse on the screen, not how many pixels over and down on the GUI its at. Oh well i guess ill hafta use the regular button

that's what the test was to determine, you have to use Opt("MouseCoordMode",2) at the top of your existing script. that should fix you right up
Link to comment
Share on other sites

that's what the test was to determine, you have to use Opt("MouseCoordMode",2) at the top of your existing script. that should fix you right up

Thanks anyways but Larry's works great, exactly what i was looking for, thanks for your help tho much appreceated, i did learn a couple things from what you said.

~TK

PS. Thanks alot Larry, lol i was getting annoyed having to use that weird button.

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...