Sign in to follow this  
Followers 0
dbzfanatic

Misplaced Items on the GUI

5 posts in this topic

#1 ·  Posted (edited)

Hi, I've made a GUI with multiple forms and they seem to work great when run from SCITE but as soon as I compile the .exe everything is either squished together or nowhere near the right coordinates. Does anyone have any experience with this or ideas how to fix it? I've gotten most of it to work but as soon as I try to update the code by adding a function that will set a variable to a certain integer like

Func fctnName()
If *someevent* then
*somevariable* = 1
ElseIf *someotherevent* then
*somevariable* = 2
EndFunc

and change my loop code from infinite to finite like this

(original)
Do
*event code*
Until 0>1

(new)
Do
*event code*
Until *somevariable*>0

the GUI messes up again. Any help would be much appreciated.

Edited by dbzfanatic

Share this post


Link to post
Share on other sites



Post any code that seems applicable. The less unneeded code the better, but if it interacts with the GUI, might as well post it to be safe.

If it is long, please use the [ codebox][ autoit] Tags.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That's what's confusing me though. The code I change doesn't have anything to do with the GUI but it still causes the glitch. Here it is.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#Region ### START Koda GUI section ### Form=\\michael-laptop\users\michael\documents\chaos bot\choas bot full.kxf
$frmBot = GUICreate("Chaos Bot", 339, 117, 193, 115)
GUISetIcon("C:\Users\Michael\Documents\chaos.ico")
$lblUsername = GUICtrlCreateLabel("Username:", 8, 8, 91, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$lblPass = GUICtrlCreateLabel("Password:", 6, 39, 86, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$txtUser = GUICtrlCreateInput("", 104, 8, 209, 21)
GUICtrlSetLimit($txtUser, 25)
$txtPass = GUICtrlCreateInput("", 96, 40, 209, 21, $ES_PASSWORD)
GUICtrlSetLimit($txtPass, 25)
$btnLogin = GUICtrlCreateButton("Login", 120, 64, 89, 17, 0)
$mnuFile = GUICtrlCreateMenu("&File")
$mnuOptions = GUICtrlCreateMenuItem("Options", $mnuFile)
$mnuExit = GUICtrlCreateMenuItem("Exit", $mnuFile)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func Post()
    $oMessage = GUICtrlRead($txtMessage)
        If $oMessage = "" Then
            MsgBox("", "Error", "No Message Specified. Resetting to default.")
            $oMessage = "bump"
        EndIf
    $oThread = GUICtrlRead($txtThread)
        If $oThread = "" Then
            MsgBox("", "Error", "No Thread Specified. Resetting to default.")
            $oThread = "http://www.gaiaonline.com/forum/viewtopic.php?t=30430373"
        EndIf
    $oTime = GUICtrlRead($txtDelay)
        if $oTime < 45 Then
            $oTime = 45
            MsgBox("", "Error", "Delay less than Gaia Flood Interval. Resetting to minimum flood interval.")
        EndIf
    _IENavigate($oIE, $oThread )
    Sleep(900)
    if GUICtrlRead($chkSafety) = $GUI_Checked Then
        SafetyCheck()
    EndIf
    Do
        $i = $i + 1
        _IEImgClick($oIE, "forum_postreply.gif")
        $oForm = _IEFormGetCollection($oIE, 0)
        $oText = _IEFormElementGetObjByName($oForm, "message")
        _IEFormElementSetValue($oText, $oMessage)
        _IEFormImageClick($oForm, "_Submit")
        _IELinkClickByText($oIE, "here")
        $sString = _IEBodyReadText($oIE)
        $sPattern = '(?s)(?i)Gold: (\d+)'
        $aArray = StringRegExp($sString, $sPattern, 3)
            if $aArray = 0 Then
                MsgBox(48,"Error", "Gaia error. Post not added or page not loaded.")
                _IENavigate($oIE, $oThread)
                $i = $i - 1
                $aArray = StringRegExp($sString, $sPattern, 3)
            EndIf
        $oEarnedGold = ($aArray[0] - $oGoldOriginal)
        ToolTip($i & " Post(s)" & @CRLF & "Gold Earned: " & $oEarnedGold & @CRLF & "Average Gold per Post: " & ($oEarnedGold/$i), .80 * @DesktopWidth, .90 * @DesktopHeight)
        If GUICtrlRead($chkRandomDelay) = $GUI_Checked Then
            $oTime = Random(45,75,1)
        EndIf
        _IELoadWait($oIE)
        Sleep( $oTime * 1000 );do the waiting
    Until $oStop > 0
    Terminate()
EndFunc

Func Options()
#Region ### START Koda GUI section ### Form=\\michael-laptop\users\michael\documents\chaos bot\chaos bot options.kxf
$frmOptions = GUICreate("Chaos Bot Options", 433, 266, 193, 115, BitOR($WS_SYSMENU,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetIcon("C:\Users\Michael\Documents\Chaos Bot\chaos.ico")
$lblDelay = GUICtrlCreateLabel("Delay (in seconds) between posts", 7, 36, 163, 17)
$chkRandomDelay = GUICtrlCreateCheckbox("Random Delay", 55, 52, 89, 17)
$txtDelay = GUICtrlCreateInput("50", 23, 52, 25, 21)
$txtMessage = GUICtrlCreateInput("Message goes here.", 224, 112, 145, 300, BitOR($ES_AUTOVSCROLL,$ES_MULTILINE))
$grpOptions = GUICtrlCreateGroup("Mis. Options", 24, 96, 193, 113)
$chkDC = GUICtrlCreateCheckbox("Get Daily Chances", 32, 144, 113, 17)
$chkVista = GUICtrlCreateCheckbox("Vista?", 32, 120, 57, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$txtThread = GUICtrlCreateInput("http://www.gaiaonline.com/forum/viewtopic.php?t=30102111", 55, 8, 201, 21)
$lblThread = GUICtrlCreateLabel("Thread:", 8, 8, 41, 17)
$chkBold = GUICtrlCreateCheckbox("Bold", 224, 80, 49, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$chkItalic = GUICtrlCreateCheckbox("Italic", 280, 80, 57, 17)
GUICtrlSetFont(-1, 8, 400, 2, "MS Sans Serif")
$chkUnderline = GUICtrlCreateCheckbox("Underline", 344, 80, 73, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$chkSafety = GUICtrlCreateCheckbox("Extra Safety", 264, 8, 97, 17)
$mnuOptions = GUICtrlCreateMenu("&File")
$mnuOptClose = GUICtrlCreateMenuItem("Close", $mnuOptions)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$oMessage = GUICtrlRead($txtMessage)
GUICtrlSetState($txtMessage,$GUI_Focus)
EndFunc

Func SafetyCheck()
    If $i = 100 Then
        $oStop = 1
    EndIf
    If $oEarnedGold >= 300 Then
        $oStop = 2
    EndIf
EndFunc<!--c2--></div><!--ec2-->
Edited by dbzfanatic

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