keen Posted July 16, 2007 Posted July 16, 2007 Hey, i am making a code so when a gui moves into a place it pops up a message. why isnt the message poping up? Here is the code: expandcollapse popup#include "GUIConstants.au3" $gui=GUICreate("Take your dog on a walk", 618, 442, 226, 145, -1, $WS_EX_TOOLWINDOW) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\walk.gif", 0, 0, 617, 441) $pic=GUICreate("", 49, 57, 5, 350,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) $guy = GUICtrlCreatePic(@ScriptDir & "\guyfarward.gif",0,0, 0,0) $pic2=GUICreate("", 68, 100, 162, 237,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) $Pic5 = GUICtrlCreatePic(@ScriptDir & "\door.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{LEFT}", "left") HotKeySet("{RIGHT}", "right") HotKeySet("{DOWN}", "down") HotKeySet("{UP}", "up") $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) $pic2pos = WinGetPos ($pic2) While 1 $msg = GuiGetMsg() $picPos = WinGetPos($pic) $pic2pos = WinGetPos($pic2) If $picPos[0] And $picPos[1] = $pic2pos[0] And $pic2pos[1] Then MsgBox (0,"hi","hi") EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func left () $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]-5,$picPos[1]) GUICtrlSetImage ($guy, @ScriptDir & "\guybackward.gif") EndFunc Func right() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]+5,$picPos[1]) GUICtrlSetImage ($guy, @ScriptDir & "\guyfarward.gif") EndFunc Func down() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]+5) EndFunc Func up() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]-5) EndFunc [center]Kesne's Bar & Grill[/center]
DW1 Posted July 16, 2007 Posted July 16, 2007 If $picPos[0] And $picPos[1] = $pic2pos[0] And $pic2pos[1] Then MsgBox (0,"hi","hi") EndIf I don't think that syntax is correct, did you mean: If $picPos[0] = $pic2pos[0] And $picPos[1] = $pic2pos[1] Then MsgBox (0,"hi","hi") EndIf AutoIt3 Online Help
keen Posted July 16, 2007 Author Posted July 16, 2007 Well with that it give me a one pixel point to hit to open the essage box. I need the whole are avalible to hit. [center]Kesne's Bar & Grill[/center]
DW1 Posted July 16, 2007 Posted July 16, 2007 so you want a range of positions? like a rectangle of positions that would trigger the msg? AutoIt3 Online Help
DW1 Posted July 16, 2007 Posted July 16, 2007 If you want a range you would write something like this: If $picPos[0] > $LEFTVALUE And $picPos[1] > $TOPVALUE And $picPos[0] < $RIGHTVALUE And $picPos[1] < $BOTVALUE Then MsgBox (0,"hi","hi") EndIf AutoIt3 Online Help
keen Posted July 17, 2007 Author Posted July 17, 2007 I cant get that to work with these values: $LEFTVALUE = "162" $TOPVALUE = "237" $RIGHTVALUE = "230" $BOTVALUE = "337" Why not? [center]Kesne's Bar & Grill[/center]
keen Posted July 17, 2007 Author Posted July 17, 2007 No message box is popping up! [center]Kesne's Bar & Grill[/center]
keen Posted July 18, 2007 Author Posted July 18, 2007 Bump! The message box still wont pop up [center]Kesne's Bar & Grill[/center]
DW1 Posted July 18, 2007 Posted July 18, 2007 please post the whole code, and we will help you fix it AutoIt3 Online Help
keen Posted July 18, 2007 Author Posted July 18, 2007 NVM, i got it working. thanks for the help! [center]Kesne's Bar & Grill[/center]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now