Sign in to follow this  
Followers 0
pezo89

GUI help

5 posts in this topic

Hello guys, is there anyone of u who can help me make a Gui for my code? becouse i cant get the hold on it myself =/

What im in need of is a GUI with 4 input bars, of each cord location in this line

_DiamondScan(276, 431, 885, 125, 1484, 430, 881, 735)

And a Cordviewer, i once found one aorund on the forum, but kinda lost it :D and all i am able to make myself is one that requiers a keypress for each cord, and is not continues updating the cordinate the mouse is on.

attached an image with a CSS painting iv made just to give u an idea about what im looking for.

and as u can see, the "Left,right, bottom and top" has a X & Y pos to it,

the code is the following:

lobal $Paused
sleep ("1000")
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{Insert}", "Terminate")
sleep ("2000")


send ("{Pause}")

;
Opt("MouseClickDelay", 1) ; adjust as needed
; Alters the length of the brief pause in between mouse clicks.
; Time in milliseconds to pause (default=10).

Opt("MouseClickDownDelay", 1) ; adjust as needed
; Alters the length a click is held down before release.
; Time in milliseconds to pause (default=10).

HotKeySet("{ESC}", "Terminate")

_DiamondScan(276, 431, 885, 125, 1484, 430, 881, 735)

; For Diamond shape $xL, $yL - Left x,y coordinate etc.
Func _DiamondScan($xL, $yL, $xTop, $yTop, $xR, $tR, $xB, $yB, $xSpacing = 60, $ySpacing = 60)
    Local $width = $xR - $xL
    Local $Height = $yB - $yTop
    Local $rat = $width / $Height
    Local $x1, $y1, $Grad = ($Height - $Height / $rat) / ($width - $width / $rat)
    ConsoleWrite("$Height " & $Height & @CRLF)
    ConsoleWrite("@DesktopWidth / 2 " & $width / $rat & @CRLF)
    For $y = $Height To $Height / $rat Step -Int(($Height - $Height / $rat) / $ySpacing)
        For $x = ($width / $rat) To $width Step Int(($width - $width / $rat) / $xSpacing)


            $x1 = $x + ($y - $Height) / $Grad + $xL
            $y1 = $y - ($x - $width / $rat) * $Grad + $yTop

            ;MouseClick("left", $x1, $y1, 1, 0)
            mouseclick("Left", $x1, $y1, 1)
        Next
    Next
    sleep (3000)
    mouseclick ("Left", 1122, 16,2)
EndFunc   ;==>_DiamondScan

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
;







Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ;toolTip('Script -  "Scriptet er - AV"',0, 40)
    WEnd
    ToolTip("")
EndFunc

Share this post


Link to post
Share on other sites



http://www.autoitscript.com/forum/index.php?showtopic=32299

Share this post


Link to post
Share on other sites

right, and how u use that prog? :D

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ok iv been able to make the gui,

but is there anyone who can help me code it into the script?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Andreas Walseng\Desktop\koda_1.7.2.1_b191_2009-07-09\Forms\farmtown.kxf
$Form1 = GUICreate("FarmTown Replant script", 378, 193, 320, 253, BitOR($WS_POPUP,$WS_CLIPSIBLINGS))
GUISetIcon("D:\004.ico")
$GroupBox1 = GUICtrlCreateGroup("", 0, 1, 281, 193)
$LEFT = GUICtrlCreateInput("LEFT X", 0, 8, 121, 21)
$RIGHT = GUICtrlCreateInput("RIGHT X", 144, 8, 121, 21)
$BOTTOM = GUICtrlCreateInput("BOTTOM X", 144, 72, 121, 21)
$Label3 = GUICtrlCreateLabel("Made by Andreas W ", 64, 152, 104, 17)
$Label1 = GUICtrlCreateLabel("Copyright 2009", 63, 172, 75, 17)
$Input1 = GUICtrlCreateInput("LEFT Y", 0, 30, 121, 21)
$Input2 = GUICtrlCreateInput("RIGHT Y", 144, 29, 121, 21)
$Input3 = GUICtrlCreateInput("BOTTOM Y", 142, 95, 121, 21)
$Input4 = GUICtrlCreateInput("TOP X", 4, 75, 121, 21)
$Input5 = GUICtrlCreateInput("TOP Y", 5, 97, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("&OK", 286, 35, 75, 25, BitOR($BS_FLAT,$WS_GROUP))
$Button2 = GUICtrlCreateButton("&Cancel", 285, 76, 75, 25, BitOR($BS_FLAT,$WS_GROUP))
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#include <GuiConstants.au3>


$label = GUICtrlCreateLabel("Mousepos",285, 140, 75, 25, BitOR($BS_FLAT,$WS_GROUP))
$GUI = GUICreate("Cords",285, 76, 75, 25, BitOR($BS_FLAT,$WS_GROUP))
GUISetState()

While 1
    $pos = MouseGetPos()
    $control = WinGetPos($GUI)
    GUICtrlSetData($label,"x "&$pos[0]&" --- y "&$pos[1])
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Exit
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button2
EndSwitch
WEnd

each of the boxes has two values X & Y, for the diamond scan

_DiamondScan(276, 431, 885, 125, 1484, 430, 881, 735)
thats Left - top-Right-bottom X & Y cords

so the inputed numbers in each box goes into the correct part of that diamond scan, for example if the following was typed in

Left box 1 - 1024

Left box 2 - 760

the diamond scan would been looking like

_DiamondScan(1024, 760, 885, 125, 1484, 430, 881, 735)

Cancel = exit the script

Ok = Starts the script and close that window

Edited by pezo89

Share this post


Link to post
Share on other sites

anyone? :D

Share this post


Link to post
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
Sign in to follow this  
Followers 0