Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Rekomendowane odpowiedzi

Opublikowano (edytowane)

Jak w temacie i opisie nie działa mi wywołanie funkcji ;( która odświeza stronę i zczytuje dane ze strony i wpisuje je do programiku

 

KOD:

 

 

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <FF.au3>

#include <FFEx.au3>

 

GUICreate("Anwar Bot v1.0", 200, 600)

$login_input = GUICtrlCreateInput("", 5, 5, 100)

$haslo_input = GUICtrlCreateInput("", 5, 30, 100)

GUICtrlCreateLabel("Login", 108, 8)

GUICtrlCreateLabel("Hasło", 108, 32)

$loguj = GUICtrlCreateButton("Zaloguj", 140, 5, 55, 40)

$odswiez = GUICtrlCreateButton("Odswiez", 140, 45, 55, 30);button odswiez

$Label1 = GUICtrlCreateLabel("Zaloguj się", 5, 60, 124, 41)

$Label2 = GUICtrlCreateLabel("_____________________________________________________", 0, 80, 200, 41)

$Label3 = GUICtrlCreateLabel("Login :", 5, 100, 200, 41)

$Label4 = GUICtrlCreateLabel("", 100, 100, 200, 41)

$Label5 = GUICtrlCreateLabel("Poziom :", 5, 120, 200, 41)

$Label6 = GUICtrlCreateLabel("", 100, 120, 200, 41)

$Label7 = GUICtrlCreateLabel("PA :", 5, 140, 200, 41)

$Label8 = GUICtrlCreateLabel("", 100, 140, 200, 41)

$Label9 = GUICtrlCreateLabel("Złoto :", 5, 160, 200, 41)

$Label10 = GUICtrlCreateLabel("", 100, 160, 200, 41)

 

$Label11 = GUICtrlCreateLabel("", 5, 180, 200, 41)

 

 

 

 

 

 

GUISetState()

 

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $loguj

login()

EndSwitch

WEnd

 

While 1;nie wiem czy dobrze... skopiowalem z gory podmienilem zmienna i funkcje

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $odswiez

refresh()

EndSwitch

WEnd

 

 

Func login()

$login = GUICtrlRead($login_input)

$haslo = GUICtrlRead($haslo_input)

 

 

_FFStart("http://anwar.pl/")

$obiekt_login = _FFObjGet("login", "name")

$obiekt_haslo = _FFObjGet("haslo", "name")

 

_FFObj($obiekt_login, "value", $login)

_FFObj($obiekt_haslo, "value", $haslo)

_FFFormSubmit()

Sleep(100)

GUICtrlSetData($Label1,"Zalogowany")

Sleep(100)

 

EndFunc

 

Func refresh();zawartos tej funkcji dziala gdy jest umieszczona w Func login() | natomiast nie wiem jak ją wywołać gdyz button 'Odswiez' nie reaguje

_FFConnect()

_FF_TabReloadAll()

$imie = _FFXPath('/html/body/div[14]/a/span', 'textContent')

GUICtrlSetData($Label4, $imie)

 

$lewel = _FFXPath('/html/body/div[14]/a[2]/span', 'textContent')

GUICtrlSetData($Label6, $lewel)

 

$pa = _FFXPath('/html/body/div[14]/a[3]/span', 'textContent')

GUICtrlSetData($Label8, $pa)

 

$zloto = _FFXPath('/html/body/div[14]/a[5]/strong', 'textContent')

GUICtrlSetData($Label10, $zloto)

 

$bestia = _FFXPath('/html/body/div[16]', 'textContent')

GUICtrlSetData($Label11, $bestia)

 

 

 

EndFunc

 

 

DO ZAMKNIĘCIA dla ciekawych:

 

 

 

 

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <FF.au3>

#include <FFEx.au3>

 

GUICreate("Anwar Bot v1.0", 200, 600)

$login_input = GUICtrlCreateInput("", 5, 5, 100)

$haslo_input = GUICtrlCreateInput("", 5, 30, 100)

GUICtrlCreateLabel("Login", 108, 8)

GUICtrlCreateLabel("Hasło", 108, 32)

$loguj = GUICtrlCreateButton("Zaloguj", 140, 5, 55, 40)

$odswiez = GUICtrlCreateButton("Odswiez", 140, 45, 55, 30);button odswiez

$Label1 = GUICtrlCreateLabel("Zaloguj się", 5, 60, 124, 41)

$Label2 = GUICtrlCreateLabel("_____________________________________________________", 0, 80, 200, 41)

$Label3 = GUICtrlCreateLabel("Login :", 5, 100, 200, 41)

$Label4 = GUICtrlCreateLabel("", 100, 100, 200, 41)

$Label5 = GUICtrlCreateLabel("Poziom :", 5, 120, 200, 41)

$Label6 = GUICtrlCreateLabel("", 100, 120, 200, 41)

$Label7 = GUICtrlCreateLabel("PA :", 5, 140, 200, 41)

$Label8 = GUICtrlCreateLabel("", 100, 140, 200, 41)

$Label9 = GUICtrlCreateLabel("Złoto :", 5, 160, 200, 41)

$Label10 = GUICtrlCreateLabel("", 100, 160, 200, 41)

 

$Label11 = GUICtrlCreateLabel("", 5, 180, 200, 41)

 

 

 

 

 

 

GUISetState()

 

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $loguj

login()

Case $odswiez

refresh()

EndSwitch

WEnd

 

 

 

 

Func login()

$login = GUICtrlRead($login_input)

$haslo = GUICtrlRead($haslo_input)

 

 

_FFStart("http://anwar.pl/")

$obiekt_login = _FFObjGet("login", "name")

$obiekt_haslo = _FFObjGet("haslo", "name")

 

_FFObj($obiekt_login, "value", $login)

_FFObj($obiekt_haslo, "value", $haslo)

_FFFormSubmit()

Sleep(100)

GUICtrlSetData($Label1,"Zalogowany")

Sleep(100)

 

EndFunc

 

Func refresh();zawartos tej funkcji dziala gdy jest umieszczona w Func login() | natomiast nie wiem jak ją wywołać gdyz button 'Odswiez' nie reaguje

_FFConnect()

_FF_TabReloadAll()

$imie = _FFXPath('/html/body/div[14]/a/span', 'textContent')

GUICtrlSetData($Label4, $imie)

 

$lewel = _FFXPath('/html/body/div[14]/a[2]/span', 'textContent')

GUICtrlSetData($Label6, $lewel)

 

$pa = _FFXPath('/html/body/div[14]/a[3]/span', 'textContent')

GUICtrlSetData($Label8, $pa)

 

$zloto = _FFXPath('/html/body/div[14]/a[5]/strong', 'textContent')

GUICtrlSetData($Label10, $zloto)

 

$bestia = _FFXPath('/html/body/div[16]', 'textContent')

GUICtrlSetData($Label11, $bestia)

 

 

 

EndFunc

 

 

Edytowane przez Szakallt
Opublikowano

To jest ukryta treść, proszę

 

Jak byś wiedział co to Switch to byś nie miał takiego problemu, jak piszesz skrypt to wypadało by wiedzieć co do czego służy :>

 

 

A więc można powiedzieć że w autoit siedze od wczoraj na powaznie.

 

I doszedlem juz do fajnego botka do anwar.pl

 

Mam tak że teoria jest mi wrogiem a na przykładach jest o wiele łatwiej

Jak skoncze to wrzuce bota na strone

p.s jak możesz prosiłbym o odpowiedź w poście

Temat na cpmforum

 

 

×
×
  • Dodaj nową pozycję...