Sign in to follow this  
Followers 0
Crxo

$I Problem...

4 posts in this topic

#1 ·  Posted (edited)

Hello. Since yesterday I started to play AutoIT. I decided to write a simple program for a game. And here comes the problem. I put the following script and error. I would ask for help.

#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayAutoPause", 0)
Global $sila, $szybkosc, $obrona, $show
$plik = "set.ini"
If Not FileExists("set.ini") Then
$f = FileOpen("set.ini", 2)
FileClose($f)
IniWriteSection($plik, "logowanie", "")
IniWrite($plik, "logowanie", "login", "login")
IniWrite($plik, "logowanie", "haslo", "haslo")
EndIf
$loginINI = IniRead($plik, "logowanie", "login", "login")
$hasloINI = IniRead($plik, "logowanie", "haslo", "haslo")

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("PrisonWarsBot", 341, 265, 346, 244)
$Checkbox2 = GUICtrlCreateCheckbox("Sila", 80, 48, 97, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Obrona", 80, 72, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Szybkosc", 80, 96, 97, 17)
$Silownia = GUICtrlCreateGroup("Silownia", 40, 24, 249, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$IE = GUICtrlCreateCheckbox("Pokaz IE", 32, 216, 97, 17)
$Checkbox4 = GUICtrlCreateGroup("Przegladarka", 8, 192, 169, 57)
$Button1 = GUICtrlCreateButton("Start", 176, 144, 129, 33, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

   Case $Button1
   If GUICtrlRead($Checkbox2) = 1 Then $sila = 1
   If GUICtrlRead($Checkbox2) = 4 Then $sila = 0
   If GUICtrlRead($Checkbox1) = 1 Then $obrona = 1
   If GUICtrlRead($Checkbox1) = 4 Then $obrona = 0
   If GUICtrlRead($Checkbox3) = 1 Then $szybkosc = 1
   If GUICtrlRead($Checkbox3) = 4 Then $szybkosc = 0
   If GUICtrlRead($Checkbox4) = 1 Then $show = 1
   If GUICtrlRead($Checkbox4) = 4 Then $show = 0
   Sleep(200)
   GUIDelete($Form2)
   logg()
EndSwitch
WEnd

Func logg()
Global $I = _IECreate("http://prisonwars.pl/", 0, $show)
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Mati\Pulpit\autoit\prision\loginF.kxf
$Form1 = GUICreate("Logowanie", 274, 100, 192, 124)
$Input1 = GUICtrlCreateInput($loginINI, 8, 16, 121, 21)
$Input2 = GUICtrlCreateInput($hasloINI, 144, 16, 121, 21)
$Button1 = GUICtrlCreateButton("Zaloguj", 96, 48, 75, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("www.forum.toproste.pl", 72, 80, 129, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         Exit
      Case $Button1
         $login = _IETagNameGetCollection($I, "input", 1)
         $haslo = _IETagNameGetCollection($I, "input", 2)
         $form = _IETagNameGetCollection($I, "form", 0)
         _IEFormElementSetValue($login, GUICtrlRead($Input1))
         _IEFormElementSetValue($haslo, GUICtrlRead($Input2))
         _IEFormSubmit($form)
         Sleep(100)
         IniWrite($plik, "logowanie", "login", GUICtrlRead($Input1))
         IniWrite($plik, "logowanie", "haslo", GUICtrlRead($Input2))
         Sleep(100)
         GUIDelete($Form1)
         Sleep(100)
         start()
   EndSwitch
WEnd
EndFunc

Func start()
While 1
$r = Random(10000, 30000, 1)
If $sila = 1 Then
TrayTip("sila", "Cwicze", 1)
_IENavigate($I, "http://prisonwars.pl/gym/")
$b = _IETagNameGetCollection($I, "form", 5)
$d = _IEFormElementGetObjByName($b, "value")
_IEFormElementSetValue($d, "1")
_IEFormSubmit($b)
Sleep($r)
EndIf
If $obrona = 1 Then
TrayTip("obrona", "Cwicze", 1)
_IENavigate($I, "http://prisonwars.pl/gym/")
$b = _IETagNameGetCollection($I, "form", 6)
$d = _IEFormElementGetObjByName($b, "value")
_IEFormElementSetValue($d, "1")
_IEFormSubmit($b)
Sleep($r)
EndIf
If $szybkosc = 1 Then
TrayTip("szybkosc", "Cwicze", 1)
_IENavigate($I, "http://prisonwars.pl/gym/")
$b = _IETagNameGetCollection($I, "form", 7)
$d = _IEFormElementGetObjByName($b, "value")
_IEFormElementSetValue($d, "1")
_IEFormSubmit($b)
Sleep($r)
EndIf
WEnd
EndFunc

Error:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Dom\Moje dokumenty\skrypt.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>16:41:45 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0415 Keyboard:00000415 OS:WIN_XP/Dodatek Service Pack 3 CPU:X64 OS:X86)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

C:\Documents and Settings\Dom\Moje dokumenty\skrypt.au3(92,15) : WARNING: $I: possibly used before declaration.

_IENavigate($I,

~~~~~~~~~~~~~~^

C:\Documents and Settings\Dom\Moje dokumenty\skrypt.au3(55,57) : WARNING: $I: declared global in function only. Prefer top of file.

Global $I = _IECreate("http://prisonwars.pl/", 0, $show)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Dom\Moje dokumenty\skrypt.au3 - 0 error(s), 2 warning(s)

->16:41:45 AU3Check ended.rc:1

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Dom\Moje dokumenty\skrypt.au3"

C:\Program Files\AutoIt3\Include\IE.au3 (238) : ==> The requested action with this object has failed.:

$o_object.visible = $f_visible

$o_object.visible = $f_visible^ ERROR

->16:41:49 AutoIT3.exe ended.rc:1

+>16:41:50 AutoIt3Wrapper Finished

>Exit code: 1 Time: 5.710

Please help me ; )) Edited by Crxo

Share this post


Link to post
Share on other sites



You declared $I inside a function. Since the function may or may not be run before the variable gets used, you get a warning.

Speaking of warnings: This forum does not support malicious activities on the web, including botting a game site where that's against their Terms of Service (TOS). If that is your purpose, don't continue this topic or open a new one on it.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Please admin delete this topic... Problem was fixed! :)

Share this post


Link to post
Share on other sites

Please admin delete this topic... Problem was fixed! :)

We don't delete posts just because they were solved. That would be counter productive for those that actually use the search feature when they need to get an answer to something.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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