Error variable used without being declared как исправить ошибку

;#include <GuiConstants.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ImageSearch.au3>


Global $paus, $x, $y, $result,$picked,[email protected]&'farmbotico.ico',$afterlogin=0,$polog = GuiCreate("farm b0t v1.0, Step by step",426,357,562,114),$button1=GuiCtrlCreateButton("X",375,-1,48,24),$button2=GuiCtrlCreateButton("Options",240,275,157,56),$button3=GuiCtrlCreateButton("Start",36,276,155,55)
$starter=0

$paus=0

If FileExists("C:WINDOWSsystemImageSearchDLL.dll") Then
else
    FileCopy("ImageSearchDLL.dll", "C:WINDOWSsystem", 9)
endif

If FileExists("C:WINDOWSImageSearchDLL.dll") Then
        else
    FileCopy("ImageSearchDLL.dll", "C:WINDOWS", 9)
    endif

$picked=0
HotKeySet("{esc}","close")
HotKeySet("{f1}","start")
HotKeySet("{f2}","stope")
TraySetIcon($sIconPath)

Opt("TrayMenuMode",1)
$delitem        = TrayCreateItem("help")
TrayCreateItem("")
$aboutitem      = TrayCreateItem("More info")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")

TraySetState()



TraySetToolTip("Farm bot welcome ! BOT WORK WITH 1025x768 RESOLUTION IN LOL")
SplashImageOn("", @ScriptDir & "farmbotwelcome.jpg", 300, 300)
Sleep(3000)
SplashOff()

;;================================================================================
;;VARIABEL DEFINITION
;;================================================================================
$WebFileLoc = "http://linktologinphp.com/login.php"





$Login = GUICreate("Login",355,226)
 GUICtrlCreatePic("farmbotloginbg.jpg", 0, 0, 355, 226)
                GUICtrlSetState(-1, $GUI_DISABLE)

GUISetIcon("farmbotico.ico",-20)


$OKbutton = GUICtrlCreateButton("Login",230,180,100)
GUICtrlSetTip(1, "Multi state bitmap imagelist")


$Exit = GUICtrlCreateButton("Exit",80,180,100)
GUICtrlSetTip(1, "Multi state bitmap imagelist")
$User = GUICtrlCreateInput("Username",21,75,310,28)


$Pass = GUICtrlCreateInput("Password",21,132,310,28,$ES_PASSWORD)
GUISetState()

;;================================================================================
;;LOGIN LOOP
;;================================================================================
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit
            MsgBox(0, "Thanks for using", "cya, see you soon :*")
            Exit
        Case $msg = $OKbutton
            _login()
        EndSelect
        ;tray menu
            $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            Msgbox(64,"About:","Bot farm ip ,  thanks for using !")
        Case $msg = $delitem
           Msgbox(64,"help","if u want start bot just login to ur exist account in League of legend, then start bot button and be happy for free farm bot !")
        Case $msg = $exititem
            ExitLoop
        EndSelect
    ;    end tray menu
WEnd

;;================================================================================
;;_login()
;;================================================================================


func _login()
$UsernameInput = GUICtrlRead($User)
$PasswordInput = GUICtrlRead($Pass)
if $UsernameInput = "" or $PasswordInput = "" Then
    MsgBox(0,"ERROR","Please Enter a Username and Password")
Else
    $WEBdata = _INetGetSource($WebFileLoc &'?user=' & $UsernameInput & '&pass=' & $PasswordInput)

    if $WEBdata = "02" Then
        MsgBox(0,"Error","Unable to Login" & @lf & "Username  was incorrect")
    ElseIf $WEBdata ="0102" Then
        MsgBox(0,"Error","Unable to Login" & @lf & "Wrong password")
    Else
        ;@@@@@@@@ BOT AFTER LOGIN GUI HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        $afterlogin=1
        GUISetState(@SW_HIDE, $login)

        ProgressOn("Loading...", "Be patient", "0%")

            For $i = 10 To 100 Step 20

            Sleep(500)
                ProgressSet($i, $i & "%")
            Next
            ProgressSet(100, "Succes login", "Complete gratz...")


                Sleep(500)
            ProgressOff()
            TrayTip("Login","Login successful gratz, BOT WORK WITH 1025x768 RESOLUTION IN LOL",4)
            $polog = GuiCreate("farm b0t v1.0, Step by step",426,357,562,114)

            afterlogin(); using after login func after succesfull login!:D
endif
endif

;@@@@@@@@@@@@@@@@@ BOT AFTER LOGIN GUI END @[email protected][email protected][email protected]

EndFunc ;--> _login()


;// BOT FUCTION START HERE [email protected]@@@@@@@@@@@@@!!!!!!!!!!!!!
func afterlogin() ; start function after login
         GUICtrlCreatePic("farmbottlo.jpg", 0, 0, 426, 357)
                GUICtrlSetState(-1, $GUI_DISABLE)

        GUISetIcon("farmbotico.ico",-20)
$button2=GuiCtrlCreateButton("Pause",240,275,157,56)
GUICtrlSetTip(-1, "Multi state bitmap imagelist")
$button3=GuiCtrlCreateButton("Start b0t",36,276,155,55)
GUICtrlSetTip(-1, "Multi state bitmap imagelist")

   $widthCell = 350
    GUICtrlCreateLabel("This bot is really easy to use u just need to open a LOL luncher then", 40, 140, $widthCell)

     GUICtrlCreateLabel("Login and press start button in bot thats all", 40, 160, $widthCell)

     GUICtrlCreateLabel("now u need just be away from keyboard and dont move mouse. ", 40, 180, $widthCell)

     GUICtrlCreateLabel("Vala ur LOL account FARM by afking ;o Good job ! ", 40, 200, $widthCell)

          GUICtrlCreateLabel("If u have a problem with close bot just press ESCAPE ", 40, 220, $widthCell) 
         
          GUICtrlCreateLabel("F1 = START , F2 = PAUSE ,BOT WORK WITH 1025x768 RESOLUTION IN LOL", 40, 240, $widthCell)




GuiSetState()

While 1

$msg=GuiGetMsg()
if $msg=-3 then
            MsgBox(0, "Thanks for using", "cya, see you soon :*")
            Exit
            endif
If $msg=$button2 Then button2()
If $msg=$button3 Then button3()
wend
            endfunc ; end function after login...




Func button2()

EndFunc

Func button3()
    if $afterlogin=1 then
        traytip("Cant close program?","If u have problem with clsoe program press escape !",5)
    start()

Else
    msgbox(0,"hacker?","u try use bot without login !!!! bad boy!!")
    exit
    endif
EndFunc

func close()
    exit
endfunc

func stope()
if $paus=0 then
        afterlogin()
        
        While 1
            
sleep(400)
ExitLoop
wend
            endif
$paus=1

    endfunc

func start()
    $paus=0
    if not ProcessExists("LolClient.exe") Then

        MsgBox(0,"ERROR","Turn on League of Legends CLIENT: LolClient.exe not found")
        traytip("Turn ON LOL","turn LOL login and press start !! BOT WORK WITH 1025x768 RESOLUTION IN LOL",5)

        endif
    While 1
    if not ProcessExists("LolClient.exe") Then
        exitloop

        GUICtrlDelete($polog)
        GUICtrlDelete($button1)
        GUICtrlDelete($button2)
        GUICtrlDelete($button3)
        afterlogin()
    else

IF WINEXISTS("League of Legends (TM) Client") THEN
    sumonerspell()
else
    If Not WinActivate("PVP.net Client","") Then WinActivate("PVP.net Client","")
        If WinActivate("PVP.net Client","") Then
            $picked=0
            $result = _ImageSearch("farmbotplay.bmp", 1, $x, $y, 0)
                If $result = 1 Then
    sleep(440)
    play()
    sleep(500)
    normalgame5v5()
    sleep(1000)
Else
        rec()
        sleep(200)
        playnoow()
        sleep(110)
        pickhero()
        sleep(110)
        lobbyback()
    endif
endif
endif
endif
wend

endfunc


func rec()
    If Not WinActivate("PVP.net Client","") Then WinActivate("PVP.net Client","")
    sleep(599)
            $result = _ImageSearch("farmbotok.bmp", 1, $x, $y, 0)
        If $result = 1 Then
            MouseClick("left", $x, $y)
        EndIf
    
        $result = _ImageSearch("farmbotrec.bmp", 1, $x, $y, 0)
        If $result = 1 Then
            MouseClick("left", $x, $y)
        EndIf
    endfunc

func playnoow()

        $result = _ImageSearch("farmbotplaynow.bmp", 1, $x, $y, 0)
        If $result = 1 Then
            MouseClick("left", $x, $y)
        EndIf

    endfunc

func lobbyback()

    sleep(2000)
            $result = _ImageSearch("farmbotlobby.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                    MouseClick("left", $x, $y)
                    endif

endfunc

func pickhero()
if not ProcessExists("League of Legends.exe") then
        If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
    sleep(2000)
                $result = _ImageSearch("farmbotrandom.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                        $picked=1
                    EndIf
            sleep(800)
                if $picked = 1 then
                $result = _ImageSearch("farmbotlock.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                MouseClick("left", $x, $y)
                endif

                    endif
            endif
endfunc

func play()
    If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
            $result = _ImageSearch("farmbotplay.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                MouseClick("left", $x, $y)
        endif

endfunc

func normalgame5v5()
        sleep(800)
    If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
            $result = _ImageSearch("farmbotcreategame.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
                endif

        sleep(800)
		
		If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
                $result = _ImageSearch("farmbotnamegame.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
			Send("fgfthtfthdccv")
                endif

        sleep(800)
		
		If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
                $result = _ImageSearch("farmbotpasswordgame.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
			Send("fdsdffggfhdfhfdgdf")
                endif

        sleep(800)

        If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
                $result = _ImageSearch("farmbotcreategamebot.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
                endif

        sleep(800)
		
        If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
                $result = _ImageSearch("farmbotteam2.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
                endif

        sleep(800)

        If Not WinActive("PVP.net Client","") Then WinActivate("PVP.net Client","")
            $result = _ImageSearch("farmbotstartgame.bmp", 1, $x, $y, 0)
                If $result = 1 Then
                    MouseClick("left", $x, $y)
                EndIf

endfunc


func sumonerspell()
    if not WinActivate("League of Legends (TM) Client","") then WinActivate("League of Legends (TM) Client","")
        if WinActivate("League of Legends (TM) Client","") then
            
                $result = _ImageSearch("farmbotno.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                    EndIf
                    
                $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                    endif
                    endif
            
                            ;$result = _ImageSearch("farmbotjezeli.bmp", 1, $x, $y, 0)
                ;If $result = 1 Then
                ;    sleep(2000)
                            
                            $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                else
                    
                        $pos = MouseGetPos()
                        
                        $result = _ImageSearch("tow.bmp", 1, $x, $y,0)
                    If $result = 1 Then
                    MouseClick("right", $x, $y)
                    endif
                        
                    $result = _ImageSearch("farmbotheal.bmp", 1, $x, $y,0)
                    If $result = 1 Then
                    MouseClick("left", $x, $y)
                            Else
                                $result = _ImageSearch("farmbotgost.bmp", 1, $x, $y, 0)
                                    If $result = 1 Then
                                        MouseClick("left", $x, $y)
                                    EndIf
                    endif
                    
                    
                endif
            endif
            
                
            
    
                            sleep(2000)
            $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                else

                    Mousemove($pos[0],$pos[1],70)
                    
                endif
            endif
                            

                
                sleep(400)
                if WinActivate("League of Legends (TM) Client","") then
                    
                                $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                else

                    MouseClick("right",  720, 250, 1, 0)
                    
                endif
            endif
                    
                
                endif
                sleep(299)
                $pos = MouseGetPos()
                sleep(400)
                if WinActivate("League of Legends (TM) Client","") then
                    
                                            $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                else

                    MouseClick("right",  $pos[0]-50, $pos[1]+60, 1, 0)
                    
                endif
            endif
                    
                
                endif
                        sleep(1400)
                        if WinActivate("League of Legends (TM) Client","") then
                            
                                                    $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                Else
                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                        MouseClick("left", $x, $y)
                else

                    MouseClick("right",  $pos[0], $pos[1], 1, 0)
                    
                endif
            endif
                            
                            
            
            endif
                sleep(1000)

            $result = _ImageSearch("farmbotvicory.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                    MouseClick("left", $x, $y)

                Else

                    $result = _ImageSearch("farmbotdefeat.bmp", 1, $x, $y, 0)
                    If $result = 1 Then
                    MouseClick("left", $x, $y)
                endif
            endif
        ;    endif
            endif
    endfunc
Local $x ; <<<<< You have to declare the Variable, I tend to use Local (if in a Function) & Global if the variable is used in many Functions.
Do
  Run("Conexion.cmd")
  WinWaitActive("AOL 9.5 - Connected, Signed-On", "", 60)
  If WinExists("AOL 9.5 - Connected, Signed-On") Then $x = 1
Until $x = 1

Its best you look at the help file for Local, Global, Dim Variables. Also if you are using the SciTE by Jos, then add this #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 to the top of the script and hit Ctrl+F5, it will show you what is needed to tidy your code e.g. declaring variables.

Edit: I was writing this as Melba23 was posting…


Edited December 12, 2010 by guinness

In this case, the error can appear after changing the Application Panel settings. 

Example: 

  • adding your own logo, changing the color etc. 
  • then reverting the settings and clic Reset Logo. 
  • after this whenever you try to connect with the Windows client (mstsc.exe) you get an error.

Line 15961 (File “C:Program Files (x86)TSPlusUserDesktopApplicationPanel.bin”):

Error: Variable used without being declared.

Solution :

  • open the file ApplicationPanel.ini with a notepad, located in C:Program Files (x86)TSplusUserDesktop
  • delete this line: “logoffbutton=no” (or yes).

Explanation:

After changing the Application Panel settings, the server adds/changes the line “logoffbutton=no” (or yes) in ApplicationPanel.ini.

This is my full code:

$hGUI0 = GUICreate('GUI',480,500)
Opt("GUIOnEventMode", 1)
$file = FileOpen("TEX.dll", 0)
$tex = FileRead($file)
GUISetBkColor ($tex, $hGUI0 )
;$rand=(Random(1,2,1))
$rand="1"
$file = FileOpen("PNT.dll", 0)
$pnt = FileRead($file)
if $rand="1" Then
   $Pic1 = GUICtrlCreatePic("ImagesANT.bmp", 5, 5, 180, 60)
   GUICtrlSetOnEvent(-1, "antpoint")
EndIf
GUISetState()
while 1
   sleep(200)
WEnd
func antpoint()
   if not FileExists("PNT.dll") then
      fileopen("PNT.dll")
      FileWrite("PNT.dll", "7845369875465")
   EndIf
   $file = FileOpen("PNT.dll", 0)
   $pnt = FileRead($file)
   if $pnt="7845369875465" then $points="0"
   if $pnt="1659523976984" then $points="1"
   if $pnt="4523691256486" then $points="2"
   if $pnt="6254896328015" then $points="3"
   if $pnt="0325698742531" then $points="4"
   if $pnt="1032645798421" then $points="5"
   if $pnt="8421455781253" then $points="6"
   if $pnt="4763130118223" then $points="7"
   if $pnt="1336455476895" then $points="8"
   if $pnt="6345722484814" then $points="9"
   if $pnt="4658522798872" then $points="10"
   if $pnt="1548112413000" then $points="11"
   if $pnt="5489435001878" then $points="12"
   if $pnt="5153140897831" then $points="13"
   if $pnt="2320164745795" then $points="14"
   if $pnt="0446136297802" then $points="15"
   if $pnt="4507631042900" then $points="16"
   if $pnt="7854121321298" then $points="17"
   if $pnt="0745942134507" then $points="18"
   if $pnt="8496742170896" then $points="19"
   if $pnt="3124784055213" then $points="20"
   if $pnt="6790814267910" then $points="21"
   if $pnt="4597800457948" then $points="22"
   if $pnt="5731606040013" then $points="23"
   if $pnt="2197489745302" then $points="24"
   if $pnt="1564879645316" then $points="25"
   if $pnt="4845021975120" then $points="26"
   if $pnt="6789851260316" then $points="27"
   if $pnt="2601579516715" then $points="28"
   if $pnt="0975109780279" then $points="29"
   if $pnt="5973123167519" then $points="30"
   if $pnt="0579059746127" then $points="31"
   if $pnt="9150975178107" then $points="32"
   if $pnt="5910792192317" then $points="33"
   if $pnt="9517917219012" then $points="34"
   if $pnt="0218756169103" then $points="35"
   if $pnt="2187854126789" then $points="36"
   if $pnt="5420248751054" then $points="37"
   if $pnt="8710329741096" then $points="38"
   if $pnt="3584120687451" then $points="39"
   if $pnt="6498451205448" then $points="40"
   if $pnt="4105481510150" then $points="41"
   if $pnt="1487049210132" then $points="42"
   if $pnt="0165484087020" then $points="43"
   if $pnt="0321894089748" then $points="44"
   if $pnt="9540894865156" then $points="45"
   if $pnt="0408945660481" then $points="46"
   if $pnt="5684651045749" then $points="47"
   if $pnt="1398711612984" then $points="48"
   if $pnt="1332548484544" then $points="49"
   if $pnt="9887411231545" then $points="50"
   $PNTfile = FileOpen("PNT.dll", 1)
   FileDelete("PNT.dll")
   if $points="0" then FileWrite($PNTfile, "1659523976984")
   if $points="1" then FileWrite($PNTfile, "4523691256486")
   if $points="2" then FileWrite($PNTfile, "6254896328015")
   if $points="3" then FileWrite($PNTfile, "0325698742531")
   if $points="4" then FileWrite($PNTfile, "1032645798421")
   if $points="5" then FileWrite($PNTfile, "8421455781253")
   if $points="6" then FileWrite($PNTfile, "4763130118223")
   if $points="7" then FileWrite($PNTfile, "1336455476895")
   if $points="8" then FileWrite($PNTfile, "6345722484814")
   if $points="9" then FileWrite($PNTfile, "4658522798872")
   if $points="10" then FileWrite($PNTfile, "1548112413000")
   if $points="11" then FileWrite($PNTfile, "5489435001878")
   if $points="12" then FileWrite($PNTfile, "5153140897831")
   if $points="13" then FileWrite($PNTfile, "2320164745795")
   if $points="14" then FileWrite($PNTfile, "0446136297802")
   if $points="15" then FileWrite($PNTfile, "4507631042900")
   if $points="16" then FileWrite($PNTfile, "7854121321298")
   if $points="17" then FileWrite($PNTfile, "0745942134507")
   if $points="18" then FileWrite($PNTfile, "8496742170896")
   if $points="19" then FileWrite($PNTfile, "3124784055213")
   if $points="20" then FileWrite($PNTfile, "6790814267910")
   if $points="21" then FileWrite($PNTfile, "4597800457948")
   if $points="22" then FileWrite($PNTfile, "5731606040013")
   if $points="23" then FileWrite($PNTfile, "2197489745302")
   if $points="24" then FileWrite($PNTfile, "1564879645316")
   if $points="25" then FileWrite($PNTfile, "4845021975120")
   if $points="26" then FileWrite($PNTfile, "6789851260316")
   if $points="27" then FileWrite($PNTfile, "2601579516715")
   if $points="28" then FileWrite($PNTfile, "0975109780279")
   if $points="29" then FileWrite($PNTfile, "5973123167519")
   if $points="30" then FileWrite($PNTfile, "0579059746127")
   if $points="31" then FileWrite($PNTfile, "9150975178107")
   if $points="32" then FileWrite($PNTfile, "5910792192317")
   if $points="33" then FileWrite($PNTfile, "9517917219012")
   if $points="34" then FileWrite($PNTfile, "0218756169103")
   if $points="35" then FileWrite($PNTfile, "2187854126789")
   if $points="36" then FileWrite($PNTfile, "5420248751054")
   if $points="37" then FileWrite($PNTfile, "8710329741096")
   if $points="38" then FileWrite($PNTfile, "3584120687451")
   if $points="39" then FileWrite($PNTfile, "6498451205448")
   if $points="40" then FileWrite($PNTfile, "4105481510150")
   if $points="41" then FileWrite($PNTfile, "1487049210132")
   if $points="42" then FileWrite($PNTfile, "0165484087020")
   if $points="43" then FileWrite($PNTfile, "0321894089748")
   if $points="44" then FileWrite($PNTfile, "9540894865156")
   if $points="45" then FileWrite($PNTfile, "0408945660481")
   if $points="46" then FileWrite($PNTfile, "5684651045749")
   if $points="47" then FileWrite($PNTfile, "1398711612984")
   if $points="48" then FileWrite($PNTfile, "1332548484544")
   if $points="49" then FileWrite($PNTfile, "9887411231545")
   if $points="50" then FileWrite($PNTfile, "9887411231545")
   msgbox(0,$pnt,$pnt)
   msgbox(0,$points,$points)
endfunc

When I press the button I receive two msgbox’s and it works. The problem starts when I press it again; I get an error saying:

"G:Users9stephenbDesktopAUTOITCombineRANDOM.au3" (78) : ==> Variable used without being declared.:
if $points="0" then FileWrite($PNTfile, "1659523976984")
if ^ ERROR

How could I fix it?

I have looked through it, and as it runs once, the variable must have a value.

Hi everyone,

  I’m trying to use AUTOIT mentioned in a previous thread to convert a batch file to .exe so users can change the default printer in Windows 10. UAC is on and I’m passing the admin credentials through the batch file. The code compiles to exe and runs but I receive the below error:

Line 6 (File “C:UsersUser1DesktopXXX.exe”):

Error: Variable used without being declared

I can click the OK button to clear the error and the command runs to open the printers and devices dialogue box and it allows the user to change the default printer but I want to eliminate this error message. Can anyone help?

  My code is below:

Local $sUsername = “Admin”
Local $sPassword = “Password”
Local $sDomain   = @computerName

local $sCommand1 = @comspec & ” /c control printers”

Local $iPID = RunAsWait($sUserName, $sDomain, $sPassword, 0,$sCommand1 , “”, @SW_SHOWDEFAULT)
$iPID = RunAsWait($sUserName, $sDomain, $sPassword, 0, $sCommand2 , “”, @SW_SHOWDEFAULT)
$iPID = RunAs($sUserName, $sDomain, $sPassword, 0, $sCommand3 , “”, @SW_SHOWDEFAULT)

Добавить комментарий