Jump to content

possibly used before declaration. please help


SunnBoy
 Share

Recommended Posts

Hi Im really new to the whole scripting things ;)

so i watched a view videos, read tutorials and though i could try to do some on my own

ok i tried to create a GUI

i looked pretty good (i used Koda)

then i wanted to tell the buttons what they actually are supposed to do

i look for some working GUIs and looked how they did it.

i tried to do the same thing and everything looked just fine but as i tried to run the script

this error keeps comming up:

C:\Users\Marvin\Documents\AutoIt\Manager.au3(55,16) : WARNING: $min: possibly used before declaration.

If $msg = $min Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(59,16) : WARNING: $max: possibly used before declaration.

If $msg = $max Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(63,17) : WARNING: $hide: possibly used before declaration.

If $msg = $hide Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(67,17) : WARNING: $show: possibly used before declaration.

If $msg = $show Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(71,22) : WARNING: $startsbot: possibly used before declaration.

If $msg = $startsbot Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(75,26) : WARNING: $startsilkroad: possibly used before declaration.

If $msg = $startsilkroad Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(79,24) : WARNING: $startloader: possibly used before declaration.

If $msg = $startloader Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3(55,16) : ERROR: $min: undeclared global variable.

If $msg = $min Then

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

C:\Users\Marvin\Documents\AutoIt\Manager.au3 - 1 error(s), 7 warning(s)

please if u guys could help me :evil:

thank you

PS: here is the script

Manager.au3

Link to comment
Share on other sites

You need to declare the variables. What does min equal? At the top of the script, use Global $VariableName unless the variable is an array, then use Dim $VariableName.

I think what you did was you named your variables wrong. The show button should be assigned to $Show, not $Button3. Do this for all the variables that are erroring out.

Edited by dantay9
Link to comment
Share on other sites

You need to declare the variables. What does min equal? At the top of the script, use Global $VariableName unless the variable is an array, then use Dim $VariableName.

I think what you did was you named your variables wrong. The show button should be assigned to $Show, not $Button3. Do this for all the variables that are erroring out.

Arrays or not is irrelevant. Check Global and Dim in the helpfile again my friend ;)
Link to comment
Share on other sites

You can declare multiple variables seperated with a comma like this:

Global $min, $max

or if you have numerous global variables for ease of reading you can wrap the variables using '_' like this

Global $min, $max, $var1, $var2, $var3, $var4, _

$var5, $var6, $var7

Global can also be used to declare variables read from the system like this

Global $DefaultEmail = "Outlook"

Global $EmailClient = StringInStr(RegRead("HKLM\SOFTWARE\CLIENTS\MAIL", ""), $DefaultEmail) ;//If EmailClient = $DefaultEmail [nn] Otherwise [0]

Or file paths like this:

Global $sBackupDir = @ScriptDir & "\Backup\" ;//Backup Directory

You should also check how to use

Const

Local

Dim

etc

Link to comment
Share on other sites

You also need to edit your while loop. I see you used Koda to make the gui. You need to add on to the existing while loop, not make a new one. Try this:

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

    AutoIt Version: 3.3.0.0
    Author:     myName

    Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here
$windowname = ("") ;Enter the name of your silkroad window here
$sbotdirect = ("") ;Enter the path to your sbot directory
$silkroadpath = ("C:\Program Files (x86)\Silkroad\Silkroad.exe") ;Enter the path to your silkroad directory
$loaderpath = ("") ;Enter the path to your loader
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Silkroad Manager", 437, 337, 192, 124)
$min = GUICtrlCreateButton("Minimize", 16, 48, 75, 25, $WS_GROUP)
$max = GUICtrlCreateButton("Maximize", 16, 80, 75, 25, $WS_GROUP)
$show = GUICtrlCreateButton("Show", 16, 112, 75, 25, $WS_GROUP)
$hide = GUICtrlCreateButton("Hide", 16, 144, 75, 25, $WS_GROUP)
$startsbot = GUICtrlCreateButton("Start Sbot", 16, 176, 75, 25, $WS_GROUP)
$startsilkroad = GUICtrlCreateButton("Start Silkroad", 16, 208, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("Start Sbot + Silkroad", 16, 272, 123, 25, $WS_GROUP)
$startloader = GUICtrlCreateButton("Start Silkroad + Loader", 16, 240, 123, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("You need to Start Silkroad with Loader so all functions work!", 8, 8, 288, 17)
$Label2 = GUICtrlCreateLabel("By: San_Bow", 144, 304, 68, 17)
$ID = GUICtrlCreateInput("ID", 112, 48, 121, 21)
$Password = GUICtrlCreateInput("Password", 112, 80, 121, 21)
$Character = GUICtrlCreateInput("Character", 112, 112, 121, 21)
$Edit1 = GUICtrlCreateEdit("", 176, 56, 1, 9)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $min
            min()
        Case $max
            max()
        Case $hide
            hide()
        Case $show
            show()
        Case $startsbot
            startsbot()
        Case $startsilkroad
            startsilkroad()
        Case $startloader
            startloader()
    EndSwitch
WEnd

Func min()
    WinSetState($windowname, "", @SW_MINIMIZE)
EndFunc ;==>min

Func max()
    WinSetState($windowname, "", @SW_MAXIMIZE)
EndFunc ;==>max

Func hide()
    WinSetState($windowname, "", @SW_HIDE)
EndFunc ;==>hide

Func show()
    WinSetState($windowname, "", @SW_SHOW)
EndFunc ;==>show

Func startsbot()
    Run($sbotdirect)
EndFunc ;==>startsbot

Func startsilkroad()
    Run($silkroadpath)
EndFunc ;==>startsilkroad

Func startloader()
    Run($loaderpath)
EndFunc ;==>startloader
Link to comment
Share on other sites

sorry for double post

when i hit the minimize, maximize, hide,show buttons

they apply to the manager window not to a specific window

how can i change the window it's supposed to hide, etc

Edit:

ok i got it

another problem is happening -.-

when i hit the button Start Silkroad nothing happens

even if i put the silkroad directory in the function

Edited by SunnBoy
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...