Jump to content

(closed) want to win move with arrows


Recommended Posts

Hello everybody,

This is my script for the moment, I take script for have transparant image but the problem is : the image move only if I drag it with mouse so I want to change the function _BoundedDrag for when I press : up ,down and ,up the image move like the Function Bombermanpos() and then if you can ; Is there a code for know how long time a touch is pressed

Thanks for answers !

CODE
#NoTrayIcon

Global Const $GUI_EVENT_CLOSE = -3

Global Const $GUI_EVENT_PRIMARYUP = -8

Global Const $GUI_EVENT_MOUSEMOVE = -11

Global Const $WS_POPUP = 0x80000000

Global Const $WS_EX_LAYERED = 0x00080000

Global Const $WS_EX_MDICHILD = 0x00000040

Global Const $WS_EX_TOPMOST = 0x00000008

Opt("GUICloseOnESC", 1)

Opt("TrayIconHide", 1)

Dim $guiWinTitle = "TranaparentGUI"

Dim $Version = "v0700611a"

DllCall("kernel32.dll", "int", "CreateMutex", "int", 0, "long", 1, "str", $guiWinTitle)

Dim $linex,$liney,$bomb,$lastError = DllCall("kernel32.dll", "int", "GetLastError")

If $lastError[0] == 183 Then

MsgBox(266288, $guiWinTitle & " - Error", "...already running. Aborting. ", 8)

_Exit()

EndIf

InetGet("http://ibo90000.ifrance.com/target.gif", @ScriptDir & "\t80x80.gif")

Local $width = 15, $height = 15

Local $mainGUI = GUICreate($guiWinTitle, $width, $height, _

(@DesktopWidth - $width) / 2, (@DesktopHeight - $height) / 2, _

$WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD + $WS_EX_TOPMOST, _

WinGetHandle(WinGetTitle("Program Manager")))

Local $image = GUICtrlCreatePic("t80x80.gif", 0, 0, $width, $height)

FileDelete( @ScriptDir & "\t80x80.gif" )

GUISetState(@SW_SHOW)

;;----------------- Variables for loop and dragging

Local $msg, $mouseOffsetPos, $dragging = $image

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

_Exit()

Case $msg = $GUI_EVENT_PRIMARYUP

If $dragging Then $dragging = $image

Case $msg = $image

If $dragging <> $GUI_EVENT_MOUSEMOVE Then

$dragging = $GUI_EVENT_MOUSEMOVE

Opt("MouseCoordMode", 0)

$mouseOffsetPos = MouseGetPos()

Opt("MouseCoordMode", 1)

EndIf

Case $msg = $dragging

_BoundedDrag($mainGUI)

EndSelect

WEnd

Func _BoundedDrag($win, $top=0, $left=0, $bottom=@DesktopHeight, $right=@DesktopWidth)

Local $mousePos = MouseGetPos()

Local $windowPos = WinGetPos($win)

Local $x, $y

If $mousePos[0] - $mouseOffsetPos[0] < $left Then

$x = $left

ElseIf $windowPos[2] - $mouseOffsetPos[0] + $mousePos[0] > $right Then

$x = $right - $windowPos[2]

Else

$x = $mousePos[0] - $mouseOffsetPos[0]

EndIf

If $mousePos[1] - $mouseOffsetPos[1] < $top Then

$y = $top

ElseIf $windowPos[3] - $mouseOffsetPos[1] + $mousePos[1] > $bottom Then

$y = $bottom - $windowPos[3]

Else

$y = $mousePos[1] - $mouseOffsetPos[1]

EndIf

WinMove($win, "", $x, $y)

EndFunc ;==>_BoundedDrag

#include <GUIConstants.au3>

#include <Misc.au3>

#NoTrayIcon

$msgbomb = GUIGetMsg()

;~ HotKeySet("{1}", "V1")

;~ HotKeySet("{2}", "V2")

;~ HotKeySet("{3}", "V3")

;~ HotKeySet("{4}", "V4")

HotKeySet("{F5}","_Exit")

$play=HotKeySet("{F4}","_Play")

$pause=HotKeySet("{F3}","_Pause")

FileInstall("bmoline.bmp",@TempDir&"\bmoline.bmp")

$win = GUICreate("BMO -line-",70,70,620,20,$WS_POPUP&$WS_BORDER)

GUICtrlCreatePic(@TempDir&"\bmoline.bmp",0,0,70,70)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $win, "int", 500, "long", 0x00080000)

GUISetState()

WinSetOnTop($win,"",1)

While 2

If ProcessExists("BomberMan.exe")=0 Then

HotKeySet("{$}","Bombermanpos")

HotKeySet("{ALT}","bombline")

_BoundedDrag($mainGUI)

EndIf

WEnd

Func Bombermanpos()

$check=GUICreate("-CHECK YOUR BOMBERMAN POSITION-",100,20,5,5,$WS_POPUP&$WS_BORDER)

Do

WinSetState($check,"",@SW_SHOW)

WinSetOnTop($check,"",1)

WinFlash($check,"",1)

WinSetTrans($check,"",100)

Until sleep(1000)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $check, "int", 250, "long", 0x00090000)

$startpos=MouseGetPos()

FileWrite(@TempDir&"\bombermanposx.txt",$startpos[0])

FileWrite(@TempDir&"\bombermanposy.txt",$startpos[1])

If _IsPressed("25") then

$posleftx=FileRead(@TempDir&"\bombermanposx.txt")

$poslefty=FileRead(@TempDir&"\bombermanposy.txt")

WinMove($win,"",$posleftx,$poslefty)

FileDelete(@TempDir&"\bombermanposx.txt")

FileWrite(@TempDir&"\bombermanposx.txt",$posleftx)

FileWrite(@TempDir&"\bombermanposy.txt",$poslefty)

EndIf

If _IsPressed("27") then

$posrightx=FileRead(@TempDir&"\bombermanposx.txt")

$posrighty=FileRead(@TempDir&"\bombermanposy.txt")

WinMove($win,"",$posrightx,$posrighty)

FileDelete(@TempDir&"\bombermanposx.txt")

FileWrite(@TempDir&"\bombermanposx.txt",$posrightx)

FileWrite(@TempDir&"\bombermanposy.txt",$posrighty)

EndIf

If _IsPressed("26") then

$posupx=FileRead(@TempDir&"\bombermanposx.txt")

$posupy=FileRead(@TempDir&"\bombermanposy.txt")

WinMove($win,"",$posupx,$posupy)

FileDelete(@TempDir&"\bombermanposx.txt")

FileWrite(@TempDir&"\bombermanposx.txt",$posupx)

FileWrite(@TempDir&"\bombermanposy.txt",$posupy)

EndIf

If _IsPressed("28") then

$posdownx=FileRead(@TempDir&"\bombermanposx.txt")

$posdowny=FileRead(@TempDir&"\bombermanposy.txt")

WinMove($win,"",$posdownx,$posdown)

FileDelete(@TempDir&"\bombermanposx.txt")

FileWrite(@TempDir&"\bombermanposx.txt",$posdownx)

FileWrite(@TempDir&"\bombermanposy.txt",$posdowny)

EndIf

EndFunc

Func bombline()

$bomblinex=FileRead(@TempDir&"\bombermanposx.txt")

$bombliney=FileRead(@TempDir&"\bombermanposy.txt")

$linex = GUICreate("line x",6,2,$bomblinex-3,$bombliney,$WS_POPUP&$WS_BORDER)

$liney = GUICreate("line y",2,6,$bomblinex,$bombliney-3,$WS_POPUP&$WS_BORDER)

GUISetBkColor("0x00FF00",$linex)

GUISetBkColor("0x00FF00",$liney)

FileDelete(@TempDir&"\bombermanposx.txt")

FileWrite(@TempDir&"\bombermanposx.txt",$posdownx)

FileWrite(@TempDir&"\bombermanposy.txt",$posdowny)

Do

WinSetState($linex,"",@SW_SHOW)

WinSetState($liney,"",@SW_SHOW)

WinSetOnTop($linex,"",1)

WinSetOnTop($liney,"",1)

WinFlash($linex,"",1)

WinFlash($liney,"",1)

WinSetTrans($linex,"",100)

WinSetTrans($liney,"",100)

Until sleep(1000) or $msgbomb=$pause

Do

GUISetBkColor("0x339900",$linex)

GUISetBkColor("0x339900",$liney)

WinSetState($linex,"",@SW_SHOW)

WinSetState($liney,"",@SW_SHOW)

WinSetOnTop($linex,"",1)

WinSetOnTop($liney,"",1)

WinFlash($linex,"",1)

WinFlash($liney,"",1)

WinSetTrans($linex,"",100)

WinSetTrans($liney,"",100)

Until sleep(1000) or $msgbomb=$pause

Do

GUISetBkColor("0xFFFF00",$linex)

GUISetBkColor("0xFFFF00",$liney)

WinSetState($linex,"",@SW_SHOW)

WinSetState($liney,"",@SW_SHOW)

WinSetOnTop($linex,"",1)

WinSetOnTop($liney,"",1)

WinFlash($linex,"",1)

WinFlash($liney,"",1)

WinSetTrans($linex,"",100)

WinSetTrans($liney,"",100)

Until sleep(500) or $msgbomb=$pause

Do

GUISetBkColor("0xFF9900",$linex)

GUISetBkColor("0xFF9900",$liney)

WinSetState($linex,"",@SW_SHOW)

WinSetState($liney,"",@SW_SHOW)

WinSetOnTop($linex,"",1)

WinSetOnTop($liney,"",1)

WinFlash($linex,"",1)

WinFlash($liney,"",1)

WinSetTrans($linex,"",100)

WinSetTrans($liney,"",100)

Until sleep(500) or $msgbomb=$pause

Do

GUISetBkColor("0x00FFFF",$linex)

GUISetBkColor("0x00FFFF",$liney)

WinSetState($linex,"",@SW_SHOW)

WinSetState($liney,"",@SW_SHOW)

WinSetOnTop($linex,"",1)

WinSetOnTop($liney,"",1)

WinFlash($linex,"",1)

WinFlash($liney,"",1)

WinSetTrans($linex,"",100)

WinSetTrans($liney,"",100)

Until sleep(500) or $msgbomb=$pause

WinSetTrans($linex,"",250)

WinSetTrans($liney,"",250)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $linex, "int", 250, "long", 0x00090000)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $liney, "int", 250, "long", 0x00090000)

EndFunc

Func _Pause()

Do

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $linex, "int", 1, "long", 0x00090000)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $liney, "int", 1, "long", 0x00090000)

WinSetState($linex,"",@SW_HIDE)

WinSetState($liney,"",@SW_HIDE)

WinSetOnTop($linex,"",0)

WinSetOnTop($liney,"",0)

Until $msgbomb=$play

EndFunc

Func _Play()

bomermanpos()

EndFunc

Func _Exit()

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $linex, "int", 250, "long", 0x00090000)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $liney, "int", 250, "long", 0x00090000)

Exit

EndFunc

Edited by d3mon
No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
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...