d0n Posted June 16, 2009 Posted June 16, 2009 When i run this code it says i haven't set the $mob variable, but i did it when i click my button, not sure whats wrong here expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("Sendkeydelay", 1000) $FV_1 = "C:\Documents and Settings\Admin\Desktop\bot\FV_1.bmp" $FV_2 = "C:\Documents and Settings\Admin\Desktop\bot\FV_2.bmp" $Title = "Night" $1 = 1 $2 = 3 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 127, 263, 395, 258) $Label1 = GUICtrlCreateLabel("", 8, 40, 127, 17) $Combo1 = GUICtrlCreateCombo("", 0, 8, 121, 25) GUICtrlSetData(-1, "FV_1|FV_2", "") $Button1 = GUICtrlCreateButton("Start", 0, 224, 57, 33, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 64, 224, 57, 33, $WS_GROUP) $Pic1 = GUICtrlCreatePic("", 8, 112, 108, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Gui() Func Gui() While 1 $Msg = GUIGetMsg() Select Case $Msg = $Combo1 $Selection = GUICtrlRead($Combo1) IF $Selection = "FV_1" Then GUICtrlSetImage($Pic1,$FV_1) GUICtrlSetData($Label1,"Bear") ElseIf $Selection = "FV_2" Then GUICtrlSetImage($Pic1,$FV_2) GUICtrlSetData($Label1,"Dragon") EndIf Case $Msg = $Button1 IF $Selection = "FV_1" Then $mob = "Bear" Search1() ElseIf $Selection = "FV_2" Then $mob = "Dragon" Search1() EndIf Case $Msg = $Button2 Exit Case $Msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd EndFunc Func Search1() Sleep(1000) $Text1 = ControlGetText($Title,"","[CLASS:RichEdit20A; INSTANCE:2]") $Trim1 = StringRight($Text1, 300) MsgBox("","",$mob) $a = StringInStr($Trim1, $mob & " is standing here.") If $a NOT= 0 Then ControlClick($Title,"","[CLASS:Button; INSTANCE:31]") ControlClick($Title,"","[CLASS:Button; INSTANCE:29]","Left",2) Sleep(3000) ControlClick($Title,"","[CLASS:Button; INSTANCE:28]","Left",2) $1 = 1 Search2() Else EndIf Sleep(100) EndFunc
Danny35d Posted June 17, 2009 Posted June 17, 2009 You declare $mob for the main part of the script, but inside Search1() function you are using $mob which it hasn't been declare. You have two choice:1) At the beging of the script add Global $mob2) Change function Search1() to Search1($mob) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
DCCD Posted June 17, 2009 Posted June 17, 2009 or 1. $mob = "" Insert into head 2. Check out ,If $a Not = 0 Then [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group
DCCD Posted June 17, 2009 Posted June 17, 2009 what do you mean by point #2?syntax error! [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group
DCCD Posted June 17, 2009 Posted June 17, 2009 it works tho i think this will be fine! If Not $a = 0 Then [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now