autocomplex Posted August 22, 2007 Share Posted August 22, 2007 I have a bit of code that creates a visible box around a scan area, so the user can see where they are moving the scan area to. However, it just keeps drawing itself over and over and over. Here's the code. Case $msg = $move Stop() $MoveMode = True While 1 $Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $MousePos = MouseGetPos() WinMove($GUI,"", $MousePos[0],$MousePos[1]) WinMove($Top,"", $MousePos[0],$MousePos[1]+40) WinMove($Left,"", $MousePos[0],$MousePos[1]+40) WinMove($Right,"", $MousePos[0]+ $ScanWidth - 2,$MousePos[1]+40) WinMove($Bottom,"", $MousePos[0],$MousePos[1]+ 40 + $ScanHeight) $x = $MousePos[0] $y = $MousePos[1] If _IsPressed(01) Then ExitLoop EndIf WEnd Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
Generator Posted August 22, 2007 Share Posted August 22, 2007 Messy.. Case $msg = $move Stop() $MoveMode = True $Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() While $Movemode $MousePos = MouseGetPos() WinMove($GUI,"", $MousePos[0],$MousePos[1]) WinMove($Top,"", $MousePos[0],$MousePos[1]+40) WinMove($Left,"", $MousePos[0],$MousePos[1]+40) WinMove($Right,"", $MousePos[0]+ $ScanWidth - 2,$MousePos[1]+40) WinMove($Bottom,"", $MousePos[0],$MousePos[1]+ 40 + $ScanHeight) $x = $MousePos[0] $y = $MousePos[1] If _IsPressed(01) Then ExitLoop EndIf WEnd Link to comment Share on other sites More sharing options...
sandman Posted August 22, 2007 Share Posted August 22, 2007 Could you show the entire script please? All I can tell from here is that you don't have an EndSelect or EndSwitch, depending on which one you're doing. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
autocomplex Posted August 22, 2007 Author Share Posted August 22, 2007 i wrote it elsewhere, then pasted where i thought it fit ... not a good idea i guess. if you could explain how to make my scripts less messy please do so. =) Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
autocomplex Posted August 22, 2007 Author Share Posted August 22, 2007 (edited) I just fixed it from drawing forever by moving it outside the While 1 ... like this Case $msg = $move Stop() $MoveMode = True $Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() While 1 $MousePos = MouseGetPos() WinMove($GUI,"", $MousePos[0],$MousePos[1]) WinMove($Top,"", $MousePos[0],$MousePos[1]+40) WinMove($Left,"", $MousePos[0],$MousePos[1]+40) WinMove($Right,"", $MousePos[0]+ $ScanWidth - 2,$MousePos[1]+40) WinMove($Bottom,"", $MousePos[0],$MousePos[1]+ 40 + $ScanHeight) $x = $MousePos[0] $y = $MousePos[1] If _IsPressed(01) Then ExitLoop EndIf WEnd But now it won't erase the gui once the move has finished. Edited August 22, 2007 by inline853 Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
Generator Posted August 22, 2007 Share Posted August 22, 2007 i wrote it elsewhere, then pasted where i thought it fit ... not a good idea i guess.if you could explain how to make my scripts less messy please do so. =)See if the code above works for you, what i meant by messy is you should tidy it up. Link to comment Share on other sites More sharing options...
autocomplex Posted August 22, 2007 Author Share Posted August 22, 2007 is there anyway to erase the gui without turning off the script? Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
Gif Posted August 22, 2007 Share Posted August 22, 2007 is there anyway to erase the gui without turning off the script?GuiDelete() Link to comment Share on other sites More sharing options...
autocomplex Posted August 22, 2007 Author Share Posted August 22, 2007 Got this to work. =) expandcollapse popupCase $msg = $move Stop() $MoveMode = True $Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() $Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI) GUISetBkColor(0xFF0000) GUISetState() While 1 $MousePos = MouseGetPos() WinMove($GUI,"", $MousePos[0],$MousePos[1]) WinMove($Top,"", $MousePos[0],$MousePos[1]+40) WinMove($Left,"", $MousePos[0],$MousePos[1]+40) WinMove($Right,"", $MousePos[0]+ $ScanWidth - 2,$MousePos[1]+40) WinMove($Bottom,"", $MousePos[0],$MousePos[1]+ 40 + $ScanHeight) $x = $MousePos[0] $y = $MousePos[1] If _IsPressed(01) Then GuiDelete($Bottom) GuiDelete($Right) GuiDelete($Left) GuiDelete($Top) ExitLoop EndIf WEnd Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
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