Sign in to follow this  
Followers 0
TokeySmurf

Sorry, Still having problem with input boxes

18 posts in this topic

Sorry, Still having problems with the input fields in my script, Have to click input button twice in menu for it to show and its just faulty it doesn't really work it does but stop will noT work and you can't close it. I believe those are my only problems. Its just geting hung

Func input()
    $Queswitch = 0
    GUISetState (@SW_SHOW)
    $inputwindow = Guicreate("Mouse Coords Input", 200, 200, 100)
    Global $Que = GUICtrlCreateInput("", 40, 40, 100, 20)
    Global $Que2 = GuiCtrlCreateInput("", 40, 70, 100, 20)
    Global $Startq = GuiCtrlCreateButton("Start", 80, 150, 40, 40)
    GUICtrlSetOnEvent($Startq, "autoq")
    Global $Stopq = GuiCtrlCreateButton("Stop", 120, 150, 40, 40)
    GUICtrlSetOnEvent($stopq, "Stopq2")
    EndFunc
    
    ;func startq2()
        ;$Queswitch = 0 
   ; While 2
            ;Global $coord = GuiCtrlRead($Que) & GUICTRLREAD($Que2)
            ;Autoq(GUICtrlRead($Que),GUICtrlRead($Que2))
        ;WEnd
    ;EndFunc
Func Autoq($Que,$Que2)
    $Queswitch = 0
    GUISetState (@SW_SHOW)
    Do
    MouseMove($Que,$Que2,1)
    Sleep(5000)
    Global $coord2 = PixelSearch(0, 0, 1024, 768, 0x836B1A)
    if @error Then
    ;   Msgbox(16, "Error", "Second color not found.")
    ContinueLoop
    ;Else
    MouseMove($coord2[0], $coord2[1])
    sleep(2000)
    MouseClick("Left", $coord2[0], $coord2[1], 2)
    sleep(5000)
EndIf   
    Global $coord3 = PixelSearch(0, 0, 233, 515, 0x590300)
    if @error Then
    ;   Msgbox(16, "Error", "Third color not found.")
    ;Else
    ContinueLoop
        MouseMove($coord3[0], $coord3[1])
        sleep(1000)
        Mouseclick("left", $coord3[0], $coord3[1], 2)
        Sleep(30000)
    EndIf
    Global $coord4 = PixelSearch(0, 0, 453, 197, 0x750300)
   if @error Then
;       Msgbox(16, "Error", "Fourth color not found.")
    ;Else
    ContinueLoop
        MouseMove($coord4[0], $coord4[1])
        sleep(2000)
        Mouseclick("left", $coord4[0], $coord[1], 2)
    EndIf
    Until $QueSwitch = 1 or $close = 1
EndFunc

Func Stopq2()
    Sleep(20)
    $Close = 1
    $QueSwitch = 1
    EndFunc

Note -

Func inpu() is a menu command.. Rest of the GUI works well just not this part its sort of an addition

Share this post


Link to post
Share on other sites



As far as I can see, your code is just a bunch of functions...


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

As far as I can see, your code is just a bunch of functions...

?? Now I'm really confursed

Share this post


Link to post
Share on other sites

?? Now I'm really confursed

For anyone that may have a similiar problem with windows not closing I found I had GUIctrlsetonevent($GUI_EVENT_CLOSE, "Function") and for some reason in my code not sure why it would blog it up, I tried GUISetOnEvent($GUI_EVENT_CLOSE, "Function") to fix the problem in the main GUI script aswell.. Not sure why, I decided to scrap this part and start a new so I still havn't worked out the reading the input boxes but I think I'm on a good step forward, set some switches for a $hstatusq (my var name) =label To test my start stop functions and so far seems to be going smoothly

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok, Still having problems with mouse moving to right coords. Mouse goes off screen..also What would be the best way to call the stop function here?

Func input()
    $inputwindow = Guicreate("Mouse Coords Input", 200, 200, 100)
    GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 200, 20)
    Global $hStatusq = GUICtrlCreateLabel("", 40, 130, 200, 20)
    Global $Que = GUICtrlCreateInput("", 50, 60, 100, 20)
    Global $Que2 = GuiCtrlCreateInput("", 50, 90, 100, 20)
    Global $Startq = GuiCtrlCreateButton("Start", 40, 150, 40, 40)
    GUICtrlSetOnEvent($Startq, "Autoq")
    Global $Stopq = GuiCtrlCreateButton("Stop", 120, 150, 40, 40)
    GUICtrlSetOnEvent($stopq, "Stopq2")
    GUICtrlSetData($hStatusq,"Click start to begin")
    GUISetState(@SW_SHOW)
GUIsetonevent($GUI_EVENT_CLOSE, "WindowClose")
    EndFunc
    
    ;func startq2()
           ; Autoq(GUICtrlRead($Que),GUICtrlRead($Que2))
        
    ;EndFunc
Func Autoq()
    sleep(20)
    GUICtrlSetData($hStatusq,"Status: AutoBG Started")
    While 4
        Guictrlread($que)
        Guictrlread($Que2)
        mousemove($Que & $que2,89)
        Sleep(5000)
        WEnd
Endfunc

Func Stopq2()
    sleep(20)
    GUICtrlSetData($hstatusq, "Status: AutoBG Halted")
;   Sleep(20)
;   $Close = 1
;   $QueSwitch = 1
    EndFunc


func WindowClose()
    GUISetState(@SW_Hide)
    EndFunc
    

Func CLOSEClicked()
   GUICtrlSetData($hStatus,"Status: Closing.. Have a nice day!")
    Exit
EndFunc
Edited by TokeySmurf

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@Tokey Smurf - Dude, I really gotta know... How the heck do you even get that to run? Lol, like theguy0000 said it's just a 3 functions. Where does the script actually start? Either your not showing us the whole code, or you changed it before you posted it? Show us the exact code you using that's messing up, and maybe we can help you out...?

EDIT: I just realized... you have not #include <GuiConstants.au3> How are you even creating a GUI in the first place. You really confusing me. What is this supposed to do in the first place?

Edited by dandymcgee

- Dan [Website]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ok, Still having problems with mouse moving to right coords. Mouse goes off screen..also What would be the best way to call the stop function here?

CODE
Func input()

$inputwindow = Guicreate("Mouse Coords Input", 200, 200, 100)

GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 200, 20)

Global $hStatusq = GUICtrlCreateLabel("", 40, 130, 200, 20)

Global $Que = GUICtrlCreateInput("", 50, 60, 100, 20)

Global $Que2 = GuiCtrlCreateInput("", 50, 90, 100, 20)

Global $Startq = GuiCtrlCreateButton("Start", 40, 150, 40, 40)

GUICtrlSetOnEvent($Startq, "Autoq")

Global $Stopq = GuiCtrlCreateButton("Stop", 120, 150, 40, 40)

GUICtrlSetOnEvent($stopq, "Stopq2")

GUICtrlSetData($hStatusq,"Click start to begin")

GUISetState(@SW_SHOW)

GUIsetonevent($GUI_EVENT_CLOSE, "WindowClose")

EndFunc

;func startq2()

; Autoq(GUICtrlRead($Que),GUICtrlRead($Que2))

;EndFunc

Func Autoq()

sleep(20)

GUICtrlSetData($hStatusq,"Status: AutoBG Started")

While 4

Guictrlread($que)

Guictrlread($Que2)

mousemove($Que & $que2,89)

Sleep(5000)

WEnd

Endfunc

Func Stopq2()

sleep(20)

GUICtrlSetData($hstatusq, "Status: AutoBG Halted")

; Sleep(20)

; $Close = 1

; $QueSwitch = 1

EndFunc

func WindowClose()

GUISetState(@SW_Hide)

EndFunc

Func CLOSEClicked()

GUICtrlSetData($hStatus,"Status: Closing.. Have a nice day!")

Exit

EndFunc

Wow! That is some truly confused code... :P

Starting at the begining: Don't declare Global variables inside a function. Since nothing calls the Input() function anyway, nothing is executed. So take that code out of the Func/EndFunc and it becomes the main sequence for your script, and makes a lot more sense. But nothing keeps the script running while waiting for events, so I added a While loop:

$inputwindow = GUICreate("Mouse Coords Input", 200, 200, 100)
GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 200, 20)
Global $hStatusq = GUICtrlCreateLabel("", 40, 130, 200, 20)
Global $Que = GUICtrlCreateInput("", 50, 60, 100, 20)
Global $Que2 = GUICtrlCreateInput("", 50, 90, 100, 20)
Global $Startq = GUICtrlCreateButton("Start", 40, 150, 40, 40)
GUICtrlSetOnEvent($Startq, "Autoq")
Global $Stopq = GUICtrlCreateButton("Stop", 120, 150, 40, 40)
GUICtrlSetOnEvent($Stopq, "Stopq2")
GUICtrlSetData($hStatusq, "Click start to begin")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "WindowClose")
; Wait for events
While 1
    Sleep(50)
WEndoÝ÷ ØÚ0Ê·ö÷yø§yÚ'xez÷§¶ôß¡ ED509!2¢êîØ^Z)Ý£¥¢Çºw-ð'!'^²Ø^B-«pjÇ%¢Ç­¶§ºxbuë"µ.j[(«Þiû§rبƥçB
Xçp'!©²j+zǧ±çè¯MúBTCS³«"µìb¶ËazÇ+Lk&Þʬ¥uÈZ­«ew­¡«­¢+ÙU%MÑ=¹Ù¹Ð ÀÌØíU%}Y9Q}
1=M°ÅÕ½Ðí
1=M
±¥­ÅÕ½Ðì¤oÝ÷ Ø  Ýué^µëayh§v~éܶ*'j[hëaz´áz|!zp9!'$yÚîÈ­r§ë-é²Æ y»­{­²Ú(}«-¶z+l¡©b¶Ù^²W¦+"ÝzºeºÇâÆ)ඦË)zY^wMú+Z¶ë*½ªâi¹^jëh×6; GUI closed event
Func CLOSEClicked()
    GUICtrlSetData($hStatusq, "Status: Closing.. Have a nice day!")
    Sleep(3000)
    Exit
EndFunc   ;==>CLOSEClickedoÝ÷ Ù.«Þj[(uçâçm®+këÞÛ(çè®Ø^JÖ«µ»­¶ÚÚ'yú+¶¶[ºÛhéÜy+Z®Ø¬rXçmà.¶ºw-à¡ë"Úrí{¨ºÉh¢ajØZ²zÆ+X¢çצ¦Ú®)r{^®»©´­¢¦òrX)àJÚ)nëhÇ¢µÈZ¬¶¦zËëhªê-©myÚ®¢Ø­Â)eâ[iÉ0êÞܲ)íà.¶ºw-íêÞË-Yg¡ìbµúè­¢§±qêmÓ~PÔÂ,äÂìb¶ËazÇ+X¢ì(ºW[y·­µêè}ûh©¶µªíjwR¶^½éí±ÈZ~V jwaj÷­«_¨¢{k¢Z^­ú+)àÊ«¬y§-Ò£©àzØ^Z¥zZ(¦Ú¢wb¶*'jYrv¨º¹¨ºÇ¬¶çßjw_¨º¶ë¢G§q©e¶(ºÇ¢÷ºÚ"µÍÈØZ]Ü][ÂÛØ[ ÌÍÑÛÑYÈHÚ[HBRY   ÌÍÑÛÑYÈ[BIÌÍÖÛÛÜHÕRPÝXY
    ÌÍÔ]YJBBIÌÍÖPÛÛÜHÕRPÝXY
    ÌÍÔ]YLBBS[ÝÙS[ÝJ  ÌÍÖÛÛÜ    ÌÍÖPÛÛÜJBBTÛY
L
BQ[YTÛY
L
BÑ[

:)

Edited by PsaltyDS

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

The working result is:

WOW, How in the world did you figure that out? Lol, I didn't even know what it was supposed to do, and you made it work perfectly. Nice job PsaltyDS, I hope it works out for tokeysmurf :)

- Dan [Website]

Share this post


Link to post
Share on other sites

Wow is right heh, Thanks alot, I havn't tried it out yet but I'm going to take it slow and compare my code to yours and re-write it from that just so I make sure I understand it better, I really appreciate the detailed response and will let you know how it works out

Share this post


Link to post
Share on other sites

Ok . Here's the entire script. I'm trying to set it up so when the Input menu command is called it'll Work.. Here's my script. with PSaltys Input box code. I played around with it alot but for displaying it here as I tried it as is (But I changed while 1 to while 3 so i wouldn't have conflict there.. anyway here we go..

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICoordMode", 1)
Opt("WinTitleMatchMode", 4)

GUISetState(@SW_SHOW)
Global $Show = 0
Global $QueSwitch = 0
Global $Close = 0
Global $handle = WinGetHandle("classname=GxWindowClassD3d")
If @error Then
Msgbox(64, "WoW Not Found", "Please Start WoW to Begin")
;Exit
EndIf
sleep(20)
$mainwindow = GUICreate("Blank", 200, 150)
GUISetState(@SW_SHOW)
$optionsm = GuictrlCreateMenu("Options")
$restorem = GUICtrlCreateMenuitem("Restore", $optionsm)
GUICtrlSetOnEvent($restorem, "Restore")
$hidem = GUICtrlCreateMenuitem("Hide", $optionsm)
GUICtrlSetOnEvent($hidem, "Hide")
$AutoBG = GUICtrlCreateMenu("Auto BG")
$mousem = GUICtrlCreateMenuitem("Mouse Coords", $AutoBG)
GUICtrlSetOnEvent($mousem, "mcoord")
$inputm = GUICtrlCreateMenuitem("Coord Input", $AutoBG)
GUICtrlSetOnEvent($inputm, "input")


$startb = GUICtrlCreateButton("Start",25,50,70,25) 
GUICtrlSetOnEvent($startb, "Start")
$Stopb = GUICtrlCreateButton("Stop",100 ,50,70,25 )
GUICtrlSetOnEvent($Stopb, "Stop")
$hStatus = GUICtrlCreateLabel("", 10, 25, 200, 20)
$hideb = GUICtrlCreateCheckbox("Hide/Unhide Game on Start", 10, 80, 200, 20)
GUIsetonevent($GUI_EVENT_CLOSE, "CLOSEclicked")
WinSetOnTop($mainwindow, "", 1)
GUICtrlSetData($hStatus,"Status: Click Start to Begin!")


While 1
    Sleep(20)
    If $Show = 1 Then
        GUICtrlSetData($hStatus,"Status: Blank Started")
        ControlSend($handle, "", "", "{Z}")
        sleep(200000)
    EndIf
WEnd


Func Start()
    $Show = 1
    If @error Then
        MsgBox(0, "Blank", "Blankw Not Found",)
    EndIf
    
    $info = GUICtrlRead($hideb);read the checkbox
    if ($info = $GUI_CHECKED) Then ;check if its checked
        WinSetState($handle, "", @SW_MINIMIZE);set the window state
        WinSetState ($handle, "", @SW_HIDE )
        $Show = 1
    EndIf
EndFunc   ;==>Start


    func Stop()
    If $Show = 1 Then
        WinSetState($handle, "", @SW_SHOW)
        ;WinSetState($handle, "", @SW_RESTORE)
        WinActivate($handle, "")
        GUICtrlSetData($hStatus,"Status: Blank Halted")
        $Show = 0
    Else
        GUICtrlSetData($hStatus,"Status: 'ERROR' Blank Not Running")
        $Show = 0
    EndIf
EndFunc

Func Restore()
WinSetState($handle, "", @SW_SHOW)
;WinSetState($handle, "", @SW_RESTORE)
EndFunc

Func Hide()
    WinSetState($handle, "", @SW_MINIMIZE) ;set the window state
         WinSetState ($handle, "", @SW_HIDE )
         
     EndFunc
     
Func mcoord()
sleep(20)
 EndFunc

func input()
$inputwindow = GUICreate("Mouse Coords Input", 260, 270, 100, 100)
GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 220, 20)
Global $hStatusq = GUICtrlCreateLabel("Initialized...", 20, 70, 220, 20)
Global $Que = GUICtrlCreateInput("", 50, 115, 100, 20)
Global $Que2 = GUICtrlCreateInput("", 50, 160, 100, 20)
Global $Startq = GUICtrlCreateButton("Start", 40, 205, 40, 40)
GUISetOnEvent($Startq, "Autoq")
Global $Stopq = GUICtrlCreateButton("Stop", 120, 205, 40, 40)
GUISetOnEvent($Stopq, "Stopq2")
GUICTRLSetData($hStatusq, "Click start to begin")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
Global $GoFlag = 0
; Wait for events
While 3
    If $GoFlag = 1 Then
        $GoFlag = 1
       $XCoord = GUICtrlRead($Que)
      $YCoord = GUICtrlRead($Que2)
     MouseMove($XCoord, $YCoord, 16)
    Sleep(5000)
EndIf
  Sleep(50)
WEnd
EndFunc

; ===============================
;   Local Functions
; ===============================

; Start button event
Func Autoq()
    $GoFlag = 1
    EndFunc   ;==>Autoq

; Stop button event
Func Stopq2()
    $GoFlag = 0
    GUICtrlSetData($hStatusq, "Status: AutoBG Halted")
EndFunc   ;==>Stopq2

; GUI closed event
Func CLOSEClicked()
    GUICtrlSetData($hStatusq, "Status: Closing.. Have a nice day!")
    Sleep(3000)
    Exit
EndFunc   ;==>CLOSEClicked

Share this post


Link to post
Share on other sites

Btw, Thanks for all the help guys

Share this post


Link to post
Share on other sites

Ok . Here's the entire script. I'm trying to set it up so when the Input menu command is called it'll Work.. Here's my script. with PSaltys Input box code. I played around with it alot but for displaying it here as I tried it as is (But I changed while 1 to while 3 so i wouldn't have conflict there.. anyway here we go..

CODE
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Opt("GUICoordMode", 1)

Opt("WinTitleMatchMode", 4)

GUISetState(@SW_SHOW)

Global $Show = 0

Global $QueSwitch = 0

Global $Close = 0

Global $handle = WinGetHandle("classname=GxWindowClassD3d")

If @error Then

Msgbox(64, "WoW Not Found", "Please Start WoW to Begin")

;Exit

EndIf

sleep(20)

$mainwindow = GUICreate("Blank", 200, 150)

GUISetState(@SW_SHOW)

$optionsm = GuictrlCreateMenu("Options")

$restorem = GUICtrlCreateMenuitem("Restore", $optionsm)

GUICtrlSetOnEvent($restorem, "Restore")

$hidem = GUICtrlCreateMenuitem("Hide", $optionsm)

GUICtrlSetOnEvent($hidem, "Hide")

$AutoBG = GUICtrlCreateMenu("Auto BG")

$mousem = GUICtrlCreateMenuitem("Mouse Coords", $AutoBG)

GUICtrlSetOnEvent($mousem, "mcoord")

$inputm = GUICtrlCreateMenuitem("Coord Input", $AutoBG)

GUICtrlSetOnEvent($inputm, "input")

$startb = GUICtrlCreateButton("Start",25,50,70,25)

GUICtrlSetOnEvent($startb, "Start")

$Stopb = GUICtrlCreateButton("Stop",100 ,50,70,25 )

GUICtrlSetOnEvent($Stopb, "Stop")

$hStatus = GUICtrlCreateLabel("", 10, 25, 200, 20)

$hideb = GUICtrlCreateCheckbox("Hide/Unhide Game on Start", 10, 80, 200, 20)

GUIsetonevent($GUI_EVENT_CLOSE, "CLOSEclicked")

WinSetOnTop($mainwindow, "", 1)

GUICtrlSetData($hStatus,"Status: Click Start to Begin!")

While 1

Sleep(20)

If $Show = 1 Then

GUICtrlSetData($hStatus,"Status: Blank Started")

ControlSend($handle, "", "", "{Z}")

sleep(200000)

EndIf

WEnd

Func Start()

$Show = 1

If @error Then

MsgBox(0, "Blank", "Blankw Not Found",)

EndIf

$info = GUICtrlRead($hideb);read the checkbox

if ($info = $GUI_CHECKED) Then ;check if its checked

WinSetState($handle, "", @SW_MINIMIZE);set the window state

WinSetState ($handle, "", @SW_HIDE )

$Show = 1

EndIf

EndFunc ;==>Start

func Stop()

If $Show = 1 Then

WinSetState($handle, "", @SW_SHOW)

;WinSetState($handle, "", @SW_RESTORE)

WinActivate($handle, "")

GUICtrlSetData($hStatus,"Status: Blank Halted")

$Show = 0

Else

GUICtrlSetData($hStatus,"Status: 'ERROR' Blank Not Running")

$Show = 0

EndIf

EndFunc

Func Restore()

WinSetState($handle, "", @SW_SHOW)

;WinSetState($handle, "", @SW_RESTORE)

EndFunc

Func Hide()

WinSetState($handle, "", @SW_MINIMIZE) ;set the window state

WinSetState ($handle, "", @SW_HIDE )

EndFunc

Func mcoord()

sleep(20)

EndFunc

func input()

$inputwindow = GUICreate("Mouse Coords Input", 260, 270, 100, 100)

GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 220, 20)

Global $hStatusq = GUICtrlCreateLabel("Initialized...", 20, 70, 220, 20)

Global $Que = GUICtrlCreateInput("", 50, 115, 100, 20)

Global $Que2 = GUICtrlCreateInput("", 50, 160, 100, 20)

Global $Startq = GUICtrlCreateButton("Start", 40, 205, 40, 40)

GUISetOnEvent($Startq, "Autoq")

Global $Stopq = GUICtrlCreateButton("Stop", 120, 205, 40, 40)

GUISetOnEvent($Stopq, "Stopq2")

GUICTRLSetData($hStatusq, "Click start to begin")

GUISetState(@SW_SHOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

Global $GoFlag = 0

; Wait for events

While 3

If $GoFlag = 1 Then

$GoFlag = 1

$XCoord = GUICtrlRead($Que)

$YCoord = GUICtrlRead($Que2)

MouseMove($XCoord, $YCoord, 16)

Sleep(5000)

EndIf

Sleep(50)

WEnd

EndFunc

; ===============================

; Local Functions

; ===============================

; Start button event

Func Autoq()

$GoFlag = 1

EndFunc ;==>Autoq

; Stop button event

Func Stopq2()

$GoFlag = 0

GUICtrlSetData($hStatusq, "Status: AutoBG Halted")

EndFunc ;==>Stopq2

; GUI closed event

Func CLOSEClicked()

GUICtrlSetData($hStatusq, "Status: Closing.. Have a nice day!")

Sleep(3000)

Exit

EndFunc ;==>CLOSEClicked

You left out the most important part... Did it work? :P

I don't know what you meant by "But I changed while 1 to while 3 so i wouldn't have conflict there..", but I suspect you assign more signifigance to the number than it deserves. The only argument to While is a boolean True or False. False = 0, True = anything that's not 0. There is no "conflict" between While loops. The While loop continues until the expression is false. "While 1", "While -9", and "While 3" are exactly the same thing because they are all non-zero (same as an If statement). If you have a command that returns a 0 or non-zero result, you can use it to control the While loop: "While StringLeft($LastName, 1) = 'P'" will keep looping until the last name does not begin with 'P'. All your While loops could have the same "While 1" if you want them to run until interrupted by a GuiEvent, or maybe an ExitLoop statement.

I'm not a programmer, but I think some other languages (couldn't tell you which ones) use a number after a While statement to identify levels of nesting or something like that. AutoIT doesn't. The While loop just goes untill interrupted, exited, or the expression becomes zero.

:)


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

You left out the most important part... Did it work? :P

I don't know what you meant by "But I changed while 1 to while 3 so i wouldn't have conflict there..", but I suspect you assign more signifigance to the number than it deserves. The only argument to While is a boolean True or False. False = 0, True = anything that's not 0. There is no "conflict" between While loops. The While loop continues until the expression is false. "While 1", "While -9", and "While 3" are exactly the same thing because they are all non-zero (same as an If statement). If you have a command that returns a 0 or non-zero result, you can use it to control the While loop: "While StringLeft($LastName, 1) = 'P'" will keep looping until the last name does not begin with 'P'. All your While loops could have the same "While 1" if you want them to run until interrupted by a GuiEvent, or maybe an ExitLoop statement.

I'm not a programmer, but I think some other languages (couldn't tell you which ones) use a number after a While statement to identify levels of nesting or something like that. AutoIT doesn't. The While loop just goes untill interrupted, exited, or the expression becomes zero.

:)

Ahh hehe, I was reading The while statements wrong as far as the 1 and 3 were concerned. I thought maybe my while 1 would have conflict with the while 3 , but no your script doesn't work within my script but yes your script works by itself. Its why I'm so confused. I tried moving the while statement to the autoq function.. But that left me with my first problem. the Continous Loop. I'm just not sure whats going on lol.. driven me bonkers!

Again. Thanks for all the help

-Tokey

Share this post


Link to post
Share on other sites

Still lost. =(

Share this post


Link to post
Share on other sites

Still lost. =(

From the top again...

The first thing after your options is GUISetState(@SW_SHOW). What are you showing? You haven't created a GUI yet, so move that down to just below where you finish creating all the controls:

GUICtrlSetData($hStatus, "Status: Click Start to Begin!")
GUISetState(@SW_SHOW)oÝ÷ Ù.ºÇ´ß¨ZÙ^|¨º»®*mnëb¶åÉÊ'v+b¢v¥Ê­²Ç­!ü¨º­jw«®ÚÚh¦Ø^2È£h²Ö«¶Ø^©Ê¢}ý¶·©y«må¢g­©Ý趮±ê쵪í²Ø^©zÞ²'qëh¶©®©µ«­¢+Ù±½°ÀÌØí¡¹±)]¡¥±Ä($ÀÌØí¡¹±ô]¥¹Ñ!¹± ÅÕ½Ðí±Í͹µõá]¥¹½Ý
±ÍÍÍÅÕ½Ðì¤(%%ÉɽÈQ¡¸($%5Í  ½à ØаÅÕ½Ðí]½9½Ð½Õ¹ÅÕ½Ðì°ÅÕ½ÐíA±ÍMÑÉÐ]½Ñ¼    ¥¸ÅÕ½Ðì¤(%±Í($%á¥Ñ1½½À(%¹%)]¹oÝ÷ Øíéu¡W¥¢r¢ë¬y«­¢+Ù
½¹Ñɽ±M¹ ÀÌØí¡¹±°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐííiôÅÕ½Ðì¤oÝ÷ Øhm¶§*.q©Ýyö®Ûax*'¶º% 9bëajÖî´ýz-²êÞº{.­â'Ê«JÖ«µû§rبØ^­è¬jËkjxn+h}ÊyhZ·
.ׯz»µê뢶­¶¬¦§µ«­¢+Ø$ÀÌØíM¡½ÜôÄ(%%ÉɽÈQ¡¸($%5Í   ½à À°ÅÕ½Ðí ±¹¬ÅÕ½Ðì°ÅÕ½Ðí    ±¹­Ü9½Ð½Õ¹ÅÕ½Ðì°¤(%¹%

Inside your Input() function you are still declaring Global variables. This might work if the function is never called more than once, but is a bad habit anyway.

After you tweak and test some more, see what works and what doesn't. You'll need to post more specific questions if you need more help.

:)


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

wow, Thanks for all the help again. I miss read the use of Global before and thought "Global" was declaring my variables as like Yes I'm here everywhere rather than making it a constant, I cleaned alot of that up. Everything works properly except. The while statement. If I put it in the Func input() it doesn't work and blogs the script. If I put it outside of the func everything else works but it doesn't do anything. if I put it inside the autoq() function I get a variable is not declared

Func Input()
$inputwindow = GUICreate("Mouse Coords Input", 260, 270, 100, 100)
GUICtrlCreateLabel("Put in X,Y Coords of Battle Master", 20, 25, 220, 20)
Global $hStatusq = GUICtrlCreateLabel("Initialized...", 20, 70, 220, 20) ; NOTE - If I don't make this global I get a Variable used without being declared error here too
$Que = GUICtrlCreateInput("", 50, 115, 100, 20)
$Que2 = GUICtrlCreateInput("", 50, 160, 100, 20)
$XCoord = GUICtrlRead($Que)
$YCoord = GUICtrlRead($Que2)
$Startq = GUICtrlCreateButton("Start", 40, 205, 40, 40)
GUICtrlSetOnEvent($Startq, "Autoq")
$Stopq = GUICtrlCreateButton("Stop", 120, 205, 40, 40)
GUICtrlSetOnEvent($Stopq, "Stopq2")
GUICtrlSetData($hStatusq, "Click start to begin")
GUISetOnEvent($GUI_EVENT_CLOSE, "WindowClose")
GUISetState(@SW_SHOW)
; Wait for events
 $GoFlag = 0
 EndFunc
  
  While 1
    If $GoFlag Then
    $XCoord = GUICtrlRead($Que) ; if I put this in the autoq() I get a variable used without being declared error. if I put it in the main input() and just try to get it to read it does nothing =(
    $YCoord = GUICtrlRead($Que2)
        MouseMove($XCoord, $YCoord, 16)
        Sleep(5000)
    EndIf
WEnd


; ===============================
;   Local Functions
; ===============================

; Start button event
Func Autoq()
    $GoFlag = 1
;If I put the while statement here it blogs the script.
; I tried taking it out of the while statement just to see if it'd execute and it wouldn't
    
GUICtrlSetData($hStatusq, "Status: AutoBG Started")
     Sleep(50)
EndFunc   ;==>Autoq

; Stop button event
Func Stopq2()
    $GoFlag = 0
    GUICtrlSetData($hStatusq, "Status: AutoBG Halted")
EndFunc   ;==>Stopq2

Func WindowClose()
     GUISetState(@SW_HIDE)
     EndFunc

; GUI closed event
Func CLOSEClicked()
    GUICtrlSetData($hStatusq, "Status: Closing.. Have a nice day!")
    Sleep(3000)
    Exit
EndFunc   ;==>CLOSEClicked

Share this post


Link to post
Share on other sites

wow, Thanks for all the help again. I miss read the use of Global before and thought "Global" was declaring my variables as like Yes I'm here everywhere rather than making it a constant, I cleaned alot of that up. Everything works properly except. The while statement. If I put it in the Func input() it doesn't work and blogs the script. If I put it outside of the func everything else works but it doesn't do anything. if I put it inside the autoq() function I get a variable is not declared.

Global works about how you describe, but you don't want to be declaring Global stuff inside functions. The trick is to just declare the variable, without necesarily setting it to anything, in the early part of your script. So put this at the top of your script somewhere:

Global $hStatusqoÝ÷ Ø    ݶ§ë-ºÇ­ëÚ®&ì!z·§yç^w­­uç%j¸§+Z¨§.)r'¦ëZºÚ"µÍÌÍÚÝ]ÜHHÕRPÝÜX]SX[
    ][ÝÒ[]X[^Y][ÝË
Ì

The other variables didn't give errors because they were declared local (because they are inside the function) by default, and were not used anywhere else. Don't feel bad if that's confusing. Variable scopes are like fractions and long division - some of us had to work extra hard to figure out what the heck was going on... :)

So it's OK to use Global variables, but declare them in the main body of the script, then use them inside functions as required. Any variables that don't need to be Global should remain local inside the functions. It may not be obvious now, but that will save you much pain when your scripts get longer and more complicated!

It's not obvious to me why the Input() function doesn't work otherwise. Can you be more specific about what happens when the GUI comes up from Input(). Is it displayed correctly? Do some controls work and not others, or does it generate errors, or just ignore clicking on anything...??? :P


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

Can you explain to me a little bit more of what this does? Is it like an aim bot for a game or something, I still don't really understand it's purpose. By the way, this is a nice script. There are obviously errors, but my first GUI was no pretty sight either. I'm still not great at making GUIs, so I must admit this one is pretty good. Keep up the great efforts, and soon I'll be buying your GUIs on you for hundreds of dollars a piece (ok, maybe not) lol. If you have a specific problem just post it either me or PsaltyDS will probably be able to help ya out.


- Dan [Website]

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