Sign in to follow this  
Followers 0
Zen

Help with Input & For...Next

7 posts in this topic

I'am new and from Germany.

I dont now, where is my mistake.

Func GalaScan()
    GUICtrlCreateLabel ("Galaxie (1 - 9)", 150, 75, 250, 16)
    GUICtrlCreateLabel ("Von", 28, 100, 20, 16)
    $inputGSGalaVon = GUICtrlCreateInput("1", 53, 99, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Bis", 220, 100, 720, 16)
    $inputGSGalaBis = GUICtrlCreateInput("9", 240, 99, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Sonnensystem (1 - 499)", 130, 125, 250, 16)
    GUICtrlCreateLabel ("Von", 28, 150, 20, 16)
    $inputGSsysVon = GUICtrlCreateInput("1", 53, 149, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Bis", 220, 150, 20, 16)
    $inputGSsysBis = GUICtrlCreateInput("499", 240, 149, 36, 16, 0x2000)
    $GSStart = GUICtrlCreateButton ("GalaScan Start", 240, 270, 120, 20)
    GUICtrlSetOnEvent($GSStart, "GalaScanMain")
EndFunc

Func GalaScanMain()

For $GSGala = GUICtrlRead($inputGSGalaVon) to GUICtrlRead($inputGSGalaBis)

    For $GSsys = GUICtrlRead($inputGSsysVon) to GUICtrlRead($inputGSsysBis)
    
        MouseClick("left", 670, 200, 2, 0)
        Send($GSGala)
        MouseClick("left", 800, 200, 2, 0)
        Send($GSsys)
        MouseClick("left", 735, 227, 1, 0)
        checkready()
    Next
Next

I need help :whistle:

Share this post


Link to post
Share on other sites



Welcome to the forums! Could you please post your full code? It might be something else (this code looks fine).

Share this post


Link to post
Share on other sites

Sure, but the code have over 600 lines. The Problem is here:

Func GalaScan()
    GUICtrlCreateLabel ("Galaxie (1 - 9)", 150, 75, 250, 16)
    GUICtrlCreateLabel ("Von", 28, 100, 20, 16)
    $inputGSGalaVon = GUICtrlCreateInput("1", 53, 99, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Bis", 220, 100, 720, 16)
    $inputGSGalaBis = GUICtrlCreateInput("9", 240, 99, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Sonnensystem (1 - 499)", 130, 125, 250, 16)
    GUICtrlCreateLabel ("Von", 28, 150, 20, 16)
    $inputGSsysVon = GUICtrlCreateInput("1", 53, 149, 36, 16, 0x2000)
    GUICtrlCreateLabel ("Bis", 220, 150, 20, 16)
    $inputGSsysBis = GUICtrlCreateInput("499", 240, 149, 36, 16, 0x2000)
    $GSStart = GUICtrlCreateButton ("GalaScan Start", 240, 270, 120, 20)
    GUICtrlSetOnEvent($GSStart, "GalaScanMain")
EndFunc


Func GalaScanMain()
AutoItSetOption("PixelCoordMode", 0)
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("MouseClickDownDelay", 0)
AutoItSetOption("MouseClickDelay", 0)
AutoItSetOption("WinTitleMatchMode", 3)
AutoItSetOption("WinWaitDelay", 300)

Global $Paused
HotKeySet("{SPACE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

WinActivate("NAME - Opera", "")
    MouseClick("left", 100, 363, 1, 0)
    checkready()
    
$file = FileOpen("Scan.txt", 1)

For $GSGala = GUICtrlRead($inputGSGalaVon) to GUICtrlRead($inputGSGalaBis)

    For $GSsys = GUICtrlRead($inputGSsysVon) to GUICtrlRead($inputGSsysBis)
    
        MouseClick("left", 670, 200, 2, 0)
        Send($GSGala)
        MouseClick("left", 800, 200, 2, 0)
        Send($GSsys)
        MouseClick("left", 735, 227, 1, 0)
        checkready()
        
        Send("^a")
        Sleep(25)
        Send("^c")
        FileWriteLine($file, ClipGet())
    Next
Next

FileClose($file)
EndFunc


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc


Func Terminate()
    Exit 0
EndFunc

The Code is fine, but with the INPUT at For is the problem. I can make my Numbers in the Code and the Code works good.

Share this post


Link to post
Share on other sites

You set $inputGSGalaVon, $inputGSGalaBis, $inputGSsysVon and $inputGSsysBis in your GalaScan() function, but they don't appear to be defined globally which means that they are probably destroyed when the function terminates. Try placing this code at the start of your script:

global $inputGSGalaVon, $inputGSGalaBi, $inputGSsysVon, $inputGSsysBis

Share this post


Link to post
Share on other sites

Yeah, thanks a lot.

When i'am here, i have one more question :whistle:

I make a Menu like this

$filemenu = GUICtrlCreateMenu ("Datei")
$toolmenu = GUICtrlCreateMenu ("Tool")
$helpmenu = GUICtrlCreateMenu ("?")
$toolitemAA = GUICtrlCreateMenuitem ("AutoAttack",$toolmenu)
GUICtrlSetOnEvent($toolitemAA, "AutoAttack")
$toolitemFS = GUICtrlCreateMenuitem ("FarmScan",$toolmenu)
GUICtrlSetOnEvent($toolitemFS, "FarmScan")
$toolitemGS = GUICtrlCreateMenuitem ("GalaScan",$toolmenu)
GUICtrlSetOnEvent($toolitemGS, "GalaScan")
$toolitemSS = GUICtrlCreateMenuitem ("SpeedSim",$toolmenu)
GUICtrlSetOnEvent($toolitemSS, "SpeedSim")
$infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu)
GUICtrlSetOnEvent($infoitem, "Info")
$exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
GUICtrlSetOnEvent($exititem, "Beenden")

My Problem is, when i go to one of "AutoAttack, FarmScan, GalaScan or SpeedSim" and then i switch to a another. In the GUI is the first too. I make Screenshots :dance:

Posted Image

Share this post


Link to post
Share on other sites

I'm guessing that your AutoAttack() and GalaScan() functions each create the GUI controls that they need. This probably isn't the best approach to doing things.

I suggest that you create all the controls that you need at the beginning of your script and then hide them. Then, when each function is called you can hide any visible controls and unhide the ones that you want.

(I'm not very experienced with GUIs so I'm sorry if I haven't answered your question.) Good luck! :whistle:

Share this post


Link to post
Share on other sites

This is only for me, i can life with this Bug. But i can wait... :whistle:

Thanks you again.

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