Sign in to follow this  
Followers 0
c4mpi

Buttons doesn't work

7 posts in this topic

Hi none of the buttons OR the traymenu work can anyone please help me? :(

Thanks in advance

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.6.0
    Author:         myName

    Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Global $URL = "www.google.com"

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <TabConstants.au3>
#include <file.au3>

Func GuiEx()
    Exit
EndFunc

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


$lol2k2k = IniReadSection("C:\Program Files\AnyDir\Inis\info.ini", "Login informasjon")
If @error Then
    $MSGbx = MsgBox(4, "Første gang", "Det er første gang du peiser boten vill du konfigurere nå? Trykker du 'Nei' avsluttes Prg")
    If $MSGbx = 6 Then
        Call("lol")
    EndIf
EndIf


Func lol()
    #Region ### START Koda GUI section ### Form=
    $FormK1 = GUICreate("Prg Konfigurasjon", 407, 303, 302, 218)
    GUISetIcon("D:\005.ico")
    $PageControlK1 = GUICtrlCreateTab(8, 8, 340, 256)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $TabSheetK1 = GUICtrlCreateTabItem("Oppsett")
    $GroupK1 = GUICtrlCreateGroup("Prg oppsett", 16, 48, 129, 201)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $CheckboxK1 = GUICtrlCreateCheckbox("Any", 24, 72, 97, 17)
    $CheckboxK2 = GUICtrlCreateCheckbox("Any", 24, 104, 97, 17)
    $CheckboxK3 = GUICtrlCreateCheckbox("Any", 24, 136, 97, 17)
    $CheckboxK4 = GUICtrlCreateCheckbox("Any", 24, 168, 97, 17)
    $CheckboxK5 = GUICtrlCreateCheckbox("Any", 24, 200, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $GroupK2 = GUICtrlCreateGroup("Log", 176, 48, 129, 113)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $RadioK1 = GUICtrlCreateRadio("Logg den", 184, 72, 113, 17)
    $RadioK2 = GUICtrlCreateRadio("Ikke logg", 184, 112, 113, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $TabSheetK2 = GUICtrlCreateTabItem("Passord")
    GUICtrlSetState(-1, $GUI_SHOW)
    $InputK1 = GUICtrlCreateButton("Paswrd", 33, 101, 137, 22)
    $InputK2 = GUICtrlCreateInput("Email", 33, 75, 137, 22)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $GroupK3 = GUICtrlCreateGroup("Login ", 24, 48, 161, 81)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateTabItem("")
    $ButtonK1 = GUICtrlCreateButton("&OK", 102, 272, 75, 25, $WS_GROUP)
    $ButtonK2 = GUICtrlCreateButton("&Avbryt", 190, 272, 75, 25, $WS_GROUP)
    $ButtonK3 = GUICtrlCreateButton("&Forandre", 8, 272, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        #include <File.au3>
        $makepath = "C:\Program Files\anydir\Inis\info.ini"
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $ButtonK1
                GUIDelete()
                ExitLoop
            Case $ButtonK2
                Exit
            Case $GUI_EVENT_CLOSE
                Exit
            Case $InputK1
                $passwd = InputBox("Rediger passord", "Skriv inn passordet ditt.", "", "*")
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "Login informasjon", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Login informasjon", "Passord", $passwd)
            Case $ButtonK3
                $Email = GUICtrlRead($InputK2)
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Login informasjon", "Email", $Email)
                $Oppsett1 = GUICtrlRead($CheckboxK1)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "Kriminalitet", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Kriminalitet", "Kriminalitet", $Oppsett1)
                $Oppsett2 = GUICtrlRead($CheckboxK2)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "GTA", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "GTA", "GTA", $Oppsett2)
                $Oppsett3 = GUICtrlRead($CheckboxK3)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "Utpressing", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Utpressing", "Utpressing", $Oppsett3)
                $Oppsett4 = GUICtrlRead($CheckboxK4)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "Bestikke", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Bestikke", "Bestikke", $Oppsett4)
                $Oppsett5 = GUICtrlRead($CheckboxK5)
                IniWriteSection("C:\Program Files\Uanydir\Inis\info.ini", "Bryting", "")
                IniWrite("C:\Program Files\USM bot v2.5\Inis\info.ini", "Bryting", "Bryting", $Oppsett5)
                $PMlogg = GUICtrlRead($RadioK1)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "Loggpm", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "Loggpm", "Loggpm", $PMlogg)
                $PMikkelogg = GUICtrlRead($RadioK2)
                IniWriteSection("C:\Program Files\anydir\Inis\info.ini", "ikkeLoggpm", "")
                IniWrite("C:\Program Files\anydir\Inis\info.ini", "ikkeLoggpm", "ikkeLoggpm", $PMikkelogg)
        EndSwitch
    WEnd

EndFunc   ;==>lol





#Region ### START Koda GUI section ### Form=
Global $oIE = _IECreateEmbedded()
GUICreate("USM bot v2", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$Label1 = GUICtrlCreateLabel("TBA", 48, 496, 148, 17)
$Progress1 = GUICtrlCreateProgress(48, 472, 150, 17)
$Progress2 = GUICtrlCreateProgress(432, 472, 150, 17)
$Label2 = GUICtrlCreateLabel("TBA", 432, 496, 148, 17)
$Label3 = GUICtrlCreateLabel("any Progress:", 48, 450, 148, 17)
$Label4 = GUICtrlCreateLabel("any Progress:", 432, 450, 148, 17)
$Hidebutton = GUICtrlCreateButton("Skjul", 240, 472, 150, 17, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("GuiOnEventMode", 1)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$prefsitem = TrayCreateItem("Konfigurasjon")
TrayCreateItem("")
$visitem = TrayCreateItem("Vis bot")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

TraySetState()

$url2 = _IENavigate($oIE, $URL)
$passord = IniRead("C:\Program Files\USM bot v2.5\Inis\info.ini", "Login informasjon", "Passord", "error")
$brukernavn = IniRead("C:\Program Files\USM bot v2.5\Inis\info.ini", "Login informasjon", "Email", "error")


$oFormIL = _IEFormGetCollection($oIE, 0)
$oTextIL = _IEFormElementGetObjByName($oFormIL, "username")
_IEFormElementSetValue($oTextIL, $brukernavn)
Sleep(100)
$oFormIL = _IEFormGetCollection($oIE, 0)
$oTextIL = _IEFormElementGetObjByName($oFormIL, "password")
_IEFormElementSetValue($oTextIL, $passord)
Sleep(100)
$subIL = _IEFormImageClick($oFormIL, "http://www.usmafia.com/images/login.gif")
Sleep(5000)
$oFrameB = _IEFrameGetObjByName($oIE, "leftFrame")
$loadB = _IELinkClickByText($oFrameB, "»Din statestikk")
Sleep(3000)
$oFrameB = _IEFrameGetObjByName($oIE, "middle")
$oTableB = _IETableGetCollection($oFrameB, 7)
$aTableDataB = _IETableWriteToArray($oTableB, True)
GUICtrlSetData($Label1, $aTableDataB[1][0])
GUICtrlSetData($Progress1, $aTableDataB[1][0])



While 1
    ;Variables while 1
    $stategui = WinGetState("[CLASS:AutoIt v3 GUI]", "")
    ;Slutt på variables

    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
    Select
        Case $msg = $GUI_EVENT_MAXIMIZE

        Case $msg = $GUI_EVENT_CLOSE
            $AvslutteSporsmaal = MsgBox(4, "Avslutte?", "Er du sikker på at du vil avslutte?")
            If $AvslutteSporsmaal = 7 Then ContinueLoop
            Exit
        Case $msg = $Hidebutton
            GUISetState(@SW_HIDE)
            If Not BitAND($stategui, 2) Then
                TrayTip("", "For å vise prg igjen, høyre klikk dette ikonet og trykk 'Vis prg'!", 0)
            EndIf
        Case $msg1 = 0
            ContinueLoop
        Case $msg1 = $prefsitem
            Call("lol")
        Case $msg1 = $visitem
            GUISetState(@SW_SHOW)
        Case $msg1 = $exititem
    EndSelect
    Exit

        $GTAread = IniRead("C:\Program Files\anydir\Inis\info.ini", "GTA", "GTA", "error")
        If $GTAread = 1 Then
            $oFrameA = _IEFrameGetObjByName($oIE, "leftFrame")
            $loadA = _IELinkClickByText($oFrameA, "»anylink")
            Sleep(1500)
            $oFrameA = _IEFrameGetObjByName($oIE, "middle")
            $oFormA = _IEFormGetObjByName($oFrameA, "form1")
            _IEFormElementRadioSelect($oFormA, 0, "radiobutton", 1, "byIndex")
            Sleep(100)
            $oSubmitA = _IEGetObjByName($oFormA, "submit")
            _IEAction($oSubmitA, "click")
            $PropGetA = _IEPropertyGet($oIE, "innertext")
            If StringInStr($PropGetA, "caught") Then
                Sleep(125000)
            EndIf
            GUICtrlSetData($Progress2, 80)
            GUICtrlSetData($Label2, "any...")
            If $GTAread = "error" Then ContinueLoop
            Sleep(Random(5000, 10000))
        EndIf
        $Krimread = IniRead("C:\Program Files\anydir\Inis\info.ini", "Kriminalitet", "Kriminalitet", "error")
        If $Krimread = 1 Then
            $oFrame = _IEFrameGetObjByName($oIE, "leftFrame")
            $load = _IELinkClickByText($oFrame, "»anylink")
            Sleep(1500)
            $oFrame = _IEFrameGetObjByName($oIE, "middle")
            $oForm = _IEFormGetObjByName($oFrame, "form1")
            _IEFormElementRadioSelect($oForm, 5, "radiobutton", 1, "byIndex")
            Sleep(1000)
            $oSubmit = _IEGetObjByName($oForm, "submit")
            Sleep(100)
            _IEAction($oSubmit, "click")
            $PropGet = _IEPropertyGet($oIE, "innertext")
            If StringInStr($PropGet, "caught") Then
                Sleep(125000)
            EndIf
            GUICtrlSetData($Progress2, 20)
            GUICtrlSetData($Label2, "any")
        EndIf
        If $Krimread = "error" Then ContinueLoop
        Sleep(Random(5000, 10000))
        $UTPread = IniRead("C:\Program Files\anydir\Inis\info.ini", "Utpressing", "Utpressing", "error")
        If $UTPread = 1 Then
            While 1
                $timed34 = TimerDiff($timer34)
                If $timed34 > 720000 Then
                    $oFrameBB92 = _IEFrameGetObjByName($oIE, "leftFrame")
                    $loadBB92 = _IELinkClickByText($oFrameBB92, "»anylink")
                    Sleep(1500)
                    $oFrameBB92 = _IEFrameGetObjByName($oIE, "middle")
                    Sleep(100)
                    $oSubmitB92 = _IEGetObjByName($oFrameBB92, "go")
                    _IEAction($oSubmitB92, "click")
                    GUICtrlSetData($Progress1, 40)
                    GUICtrlSetData($Label1, "any")
                    $timer34 = TimerInit()
                EndIf
            WEnd
            If $UTPread = "error" Then ContinueLoop
    EndIf
WEnd

Share this post


Link to post
Share on other sites



c4mpi,

Your problem is easy to solve, but before we do.....

Your GUI has the title "USM bot v2.5" - and you refer to "www.usmafia.com" within it. Does it fall foul of Valik's announcement about "Game Bots" at the top of the forum?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yes it does but Im just practising and Im using an old code in this project. No intentions on making a bot. but making a code that only starts on first run

Share this post


Link to post
Share on other sites

c4mpi,

making a code that only starts on first run

I will take that as meaning it is designed to log you into the game rather than playing it.

Next time do not post code which might raise eyebrows. Practice on something non-controversial. :(

Anyway, your problem. here are 2 lines from your script:

; Line 43
Opt("GuiOnEventMode", 1)

; Line 85
$msg = GUIGetMsg()

See anything wrong there? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

c4mpi,

I will take that as meaning it is designed to log you into the game rather than playing it.

Next time do not post code which might raise eyebrows. Practice on something non-controversial. :(

Anyway, your problem. here are 2 lines from your script:

; Line 43
Opt("GuiOnEventMode", 1)

; Line 85
$msg = GUIGetMsg()

See anything wrong there? :)

M23

Yes I do, this is because I looked at other posts with the same problem for 10 mins.

And I didnt understand it. Ive probably just forgotten to remove that

Edit : I removed GuiOnEventMode still doesnt work

Edited by c4mpi

Share this post


Link to post
Share on other sites

c4mpi,

Here is a cut-down version of your code which works for me without any problem: :)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <TabConstants.au3>
#include <file.au3>

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

GUICreate("USM bot v2", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$Hidebutton = GUICtrlCreateButton("Skjul", 240, 472, 150, 17, 1)
GUISetState(@SW_SHOW)

Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$prefsitem = TrayCreateItem("Konfigurasjon")
TrayCreateItem("")
$visitem = TrayCreateItem("Vis bot")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

TraySetState()

While 1

    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
    Select
        Case $msg = $GUI_EVENT_MAXIMIZE

        Case $msg = $GUI_EVENT_CLOSE
            $AvslutteSporsmaal = MsgBox(4, "Avslutte?", "Er du sikker på at du vil avslutte?")
            If $AvslutteSporsmaal = 7 Then ContinueLoop
            Exit
        Case $msg = $Hidebutton
            ConsoleWrite("Hide" & @CRLF)
        Case $msg1 = $prefsitem
            ConsoleWrite("Tray prefs" & @CRLF)
        Case $msg1 = $visitem
            ConsoleWrite("Tray vis" & @CRLF)
        Case $msg1 = $exititem
            ConsoleWrite("Tray Exit" & @CRLF)
    EndSelect
    ;Exit
WEnd

Func GuiEx()
    Exit
EndFunc

If you want to practice, which is a good thing :( , then use simple code like this to start with and gradually make it more complex in small steps. Then when something goes wrong you know where the problem is likely to be. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

c4mpi,

Here is a cut-down version of your code which works for me without any problem: :)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <TabConstants.au3>
#include <file.au3>

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

GUICreate("USM bot v2", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$Hidebutton = GUICtrlCreateButton("Skjul", 240, 472, 150, 17, 1)
GUISetState(@SW_SHOW)

Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$prefsitem = TrayCreateItem("Konfigurasjon")
TrayCreateItem("")
$visitem = TrayCreateItem("Vis bot")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

TraySetState()

While 1

    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
    Select
        Case $msg = $GUI_EVENT_MAXIMIZE

        Case $msg = $GUI_EVENT_CLOSE
            $AvslutteSporsmaal = MsgBox(4, "Avslutte?", "Er du sikker på at du vil avslutte?")
            If $AvslutteSporsmaal = 7 Then ContinueLoop
            Exit
        Case $msg = $Hidebutton
            ConsoleWrite("Hide" & @CRLF)
        Case $msg1 = $prefsitem
            ConsoleWrite("Tray prefs" & @CRLF)
        Case $msg1 = $visitem
            ConsoleWrite("Tray vis" & @CRLF)
        Case $msg1 = $exititem
            ConsoleWrite("Tray Exit" & @CRLF)
    EndSelect
    ;Exit
WEnd

Func GuiEx()
    Exit
EndFunc

If you want to practice, which is a good thing :( , then use simple code like this to start with and gradually make it more complex in small steps. Then when something goes wrong you know where the problem is likely to be. ;)

M23

Okey thanks for everything Melba :)

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