chssoccer 0 Report post Posted January 13, 2008 The code below moves a GUI (Merlin) which looks like an icon around using arrow keys. How can this be done except with the mouse? expandcollapse popup#include <GUIConstants.au3> $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{ESC}", "main") HotKeySet("{LEFT}", "left") HotKeySet("{RIGHT}", "right") HotKeySet("{DOWN}", "down") HotKeySet("{UP}", "up") $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Exit Func main() $guiPos = WinGetPos($gui) WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10) EndFunc Func left () $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]-10,$picPos[1]) EndFunc Func right() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0]+10,$picPos[1]) EndFunc Func down() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]+10) EndFunc Func up() $picPos = WinGetPos($pic) WinMove($pic,"",$picPos[0],$picPos[1]-10) EndFunc Share this post Link to post Share on other sites
Matteo 0 Report post Posted January 13, 2008 You want say a thing like this? #include <GUIConstants.au3> $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_HIDE,$gui) WinSetOnTop($pic,"",1) HotKeySet("{ESC}","_exit") do WinMove($gui,"",MouseGetPos(0),MouseGetPos(1)) $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Func _exit() Exit EndFunc ,.-~*´¨¯¨`*·~-.¸-(_[M]¦¦[A]¦¦[T]¦¦[T]¦ ¦[E]¦¦[O]_)-,.-~*´¨¯¨`*·~-.¸ Share this post Link to post Share on other sites
martin 68 Report post Posted January 13, 2008 If you mean you want to move the image in the way that the Arrow keys did then maybe this alteration to your script will do it. #include <GUIConstants.au3> #include <misc.au3> $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) $pic1 = GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{ESC}", "main") do $msg = GUIGetMsg() switch $msg Case $pic1 $gp = WinGetPos($pic) $mp = MouseGetPos() while _IsPressed("1") $cp = MouseGetPos() WinMove($pic,'',$gp[0] - $mp[0] + $cp[0],$gp[1] - $mp[1] + $cp[1]) WEnd EndSwitch until $msg = $GUI_EVENT_CLOSE Exit Func main() $guiPos = WinGetPos($gui) WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10) EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Share this post Link to post Share on other sites
chssoccer 0 Report post Posted January 14, 2008 (edited) If you mean you want to move the image in the way that the Arrow keys did then maybe this alteration to your script will do it. #include <GUIConstants.au3> #include <misc.au3> $gui=GUICreate("test transparentpic", 200, 100) $pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) $pic1 = GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$pic) GUISetState(@SW_SHOW,$gui) HotKeySet("{ESC}", "main") do $msg = GUIGetMsg() switch $msg Case $pic1 $gp = WinGetPos($pic) $mp = MouseGetPos() while _IsPressed("1") $cp = MouseGetPos() WinMove($pic,'',$gp[0] - $mp[0] + $cp[0],$gp[1] - $mp[1] + $cp[1]) WEnd EndSwitch until $msg = $GUI_EVENT_CLOSE Exit Func main() $guiPos = WinGetPos($gui) WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10) EndFunc Thank you! Edited January 14, 2008 by chssoccer Share this post Link to post Share on other sites
crzftx 0 Report post Posted January 14, 2008 take a look at Lazy Readerbut if I don't see why you're even trying, sinceAutoIt is a suckass language and can't do shit ...andit's not up to standardsTherefore, just write it in a better language, maybe C++ sinceC++ can easily do it. I've done it already. Share this post Link to post Share on other sites