Sign in to follow this  
Followers 0
onestcoder

Gui not working

11 posts in this topic

#1 ·  Posted (edited)

Does anyone see what the problem is???

CODE
$file = FileOpen(@ProgramFilesDir & "\Onestcoder\Include\vars\powervars.txt", 0)

$alt1 = FileReadLine($file, 1)

$alt2 = FileReadLine($file, 2)

$alt3 = FileReadLine($file, 3)

$alt5 = FileReadLine($file, 4)

$alt6 = FileReadLine($file, 5)

$alt7 = FileReadLine($file, 6)

$mpt = FileReadLine($file, 7)

$alt5t = FileReadLine($file, 8)

$alt6t = FileReadLine($file, 9)

$alt7t = FileReadLine($file, 10)

$mpr = FileReadLine($file, 11)

$refresh = FileReadLine($file, 12)

$follow = FileReadLine($file, 13)

FileClose($file)

;--------------------------------------------------------------------------------------

;--------------------------------------------------------------------------------------

;--------------------------------------------------------------------------------------

Local $res = ''

Local $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")

Local $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002")

Local $resnumber = $resx + $resy

If $resnumber = 1400 Then

$res = 1

ElseIf $resnumber = 1792 Then

$res = 2

ElseIf $resnumber = 2016 Then

$res = 0

ElseIf $resnumber = 2048 Then

$res = 0

ElseIf $resnumber = 2240 Then

$res = 0

ElseIf $resnumber = 2304 Then

$res = 3

EndIf

If $res = 0 Then

MsgBox(16, "Error", "Your FFXI resolution is not currently supported", 10)

Exit

ElseIf Not $res <> '' Then

MsgBox(16, 'Error', "You don't have FFXI in your Registry", 10)

Exit

EndIf

If $res = 1 Then

$resolution = 0

$resolution2 = 0

EndIf

If $res = 2 Then

$resolution = 168

$resolution2 = 225

EndIf

If $res = 3 Then

$resolution = 424

$resolution2 = 481

EndIf

#include <GUIConstants.au3>

opt("GUIOnEventMode", 1)

Global $Paused

Global $run = 0

Global $event = 0

If $refresh = 1 Then

AdlibEnable("refresh", 130000)

EndIf

If $alt5 = 1 Then

AdlibEnable("alt5", 1 + $alt5t)

EndIf

If $alt6 = 1 Then

AdlibEnable("alt6", 1 + $alt6t)

EndIf

If $alt7 = 1 Then

AdlibEnable("alt7", 1 + $alt7t)

EndIf

$gui = GUICreate("Powerleveler Bot", 180, 100, 0, 0, -1, $WS_EX_TOPMOST)

GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUICtrlCreatePic(@ProgramFilesDir & "\Onestcoder\Include\img\Obotz3.jpg", 5, 5, 170, 59)

$button_1 = GUICtrlCreateButton("Run", 5, 70, 50, 25)

GUICtrlSetOnEvent($button_1, "Running")

GUICtrlSetState($button_1, $GUI_FOCUS)

$n2 = GUICtrlCreateButton("Exit", 125, 70, 50, 25)

GUICtrlSetOnEvent($n2, "Terminate")

$p2 = GUICtrlCreateButton("Pause", 65, 70, 50, 25)

GUICtrlSetOnEvent($p2, "TogglePause")

GUISetState()

AutoItSetOption("SendKeyDelay", 40);

While 1

While $run = 1

Do

If $follow = 1 Then

Send("!0")

EndIf

If $follow = 4 Then

Send("!1")

EndIf

Sleep(250)

AutoItSetOption("SendKeydownDelay", 250);

If PixelGetColor(26, 577 + $resolution) > 16777000 And PixelGetColor(26, 577 + $resolution) < 16777300 And PixelGetColor(35, 571 + $resolution) > 16777000 And PixelGetColor(35, 571 + $resolution) < 16777300 And PixelGetColor(53, 567 + $resolution) > 16777000 And PixelGetColor(53, 567 + $resolution) < 16777300 Then

Sleep(1000)

Send("^1")

Sleep(500)

Exit

Terminate()

EndIf

If $alt1 = 1 Then

If PixelGetColor(766 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) > 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!1")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If $alt2 = 1 Then

If PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(735 + $resolution2, 537 + $resolution) > 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!2")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If $alt3 = 1 Then

If PixelGetColor(735 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!3")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 9000000 Then

med();

$event = 1;low mp.

EndIf

Until $event = 1

WEnd

WEnd

Func refresh()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!4")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>refresh

Func alt5()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!5")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

If $mpr = 1 Then

Sleep(250)

Send("!9")

Sleep(250)

EndIf

EndFunc ;==>alt5

Func alt6()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!6")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>alt6

Func alt7()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!7")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>alt7

Func med()

If $alt5 = 1 Then

AdlibDisable()

EndIf

Sleep(1000)

Send("!8")

Sleep(1500)

Send("!h");down

Sleep(10000)

If PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(735 + $resolution2, 537 + $resolution) > 10000000 Then

AutoItSetOption("SendKeydownDelay", 3000);

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250);

Sleep(500)

Send("!2")

Sleep(5000)

Send("!8")

Sleep(1000)

Send("!h");down

EndIf

Sleep(10000)

If PixelGetColor(735 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 Then

AutoItSetOption("SendKeydownDelay", 3000);

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250);

Sleep(500)

Send("!2")

Sleep(5000)

Send("!8")

Sleep(1000)

Send("!h");down

EndIf

Sleep(60000)

If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 8500000 Then

Send("!h");down

EndIf

$event = 0

Do

Sleep(3000)

If PixelGetColor(772 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(772 + $resolution2, 577 + $resolution) > 11000000 Then

AutoItSetOption("SendKeydownDelay", 3000);

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250);

Sleep(1500)

Send("!9")

Sleep(1500)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

If $alt5 = 1 Then

AdlibEnable("alt5", 1 + $alt5t)

EndIf

$event = 2;mp full.

EndIf

Until $event = 2

EndFunc ;==>med

Func Running()

If $run = 0 And $Paused = 1 Then

TogglePause()

Else

$run = 1

EndIf

EndFunc ;==>Running

; Pause function

Func TogglePause()

$Paused = Not $Paused

$run = Not $run

If $Paused = 0 Then

ToolTip("")

ElseIf $Paused = 1 Then

Sleep(100)

ToolTip('Script is "Paused"', 0, 0)

EndIf

EndFunc ;==>TogglePause

Func Terminate()

Exit 0

EndFunc ;==>Terminate

Edited by onestcoder

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What exactly is the problem that you are experiencing? I don't play FFXI, so I for one cannot help if the problem is related to integrating the script with game.

Also, you can use [ codebox ] instead of [ code ] to prevent listing the script in full.

Edited by Stumpii

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

I really didn't look to be honest, simply because you posted a question last time on why your Pause wasn't working, and you still haven't fixed it.

This:

Func TogglePause()
    $Paused = Not $Paused
    $run = Not $run
    If $Paused = 0 Then
        ToolTip("")
    ElseIf $Paused = 1 Then
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    EndIf
EndFunc ;==>TogglePause

Does nothing but show a tooltip... there is no looping there until the pause is unpaused.

Here I made you an example that you can see for yourself

Global $Paused
Global $run

HotKeySet('{pause}', 'TogglePause')
HotKeySet('{esc}', 'Terminate')
HotKeySet('{insert}', 'Running')

While 1
    Sleep(5000)
    MsgBox(0, $run, $Paused)
WEnd

Func Running()
    If $run = 0 And $Paused = 1 Then
        TogglePause()
    Else
        $run = 1
    EndIf
EndFunc ;==>Running
; Pause function
Func TogglePause()
    $Paused = Not $Paused
    $run = Not $run
    If $Paused = 0 Then
        ToolTip("")
    ElseIf $Paused = 1 Then
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    EndIf
EndFunc ;==>TogglePause
Func Terminate()
    Exit 0
EndFunc ;==>Terminate
Even if you push pause, it will show the tooltip, but you will still get the msgbox from the loop.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well take a deep breath... I posted your mistake only with an example on how to see it wasn't working so you could fix it. I told you why it wasn't working to help you along. Last time I suggested you use the TogglePause() unedited in the help file, And no one is suggesting you use hotkeys(), they just aren't writing the code for you, and giving you nudges in the right direction.

How your Pause function should be the way you have it set up:

;This is not to put in your script, it is for you to use in a text.au3 so you can see it working only, replace your TogglePause() Function with this one.
;Nothing will change, except it will work.
Global $Paused
Global $run

HotKeySet('{pause}', 'TogglePause')
HotKeySet('{esc}', 'Terminate')
HotKeySet('{insert}', 'Running')

While 1
    Sleep(5000)
    MsgBox(0, $run, $Paused)
WEnd

Func Running()
    If $run = 0 And $Paused = 1 Then
        TogglePause()
    Else
        $run = 1
    EndIf
EndFunc;==>Running
; Pause function
Func TogglePause()
    $Paused = Not $Paused
    $run = Not $run
    While $Paused; notice that the loop keeps traps it here until you unpause it with whatever method your using
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip('')
EndFunc;==>TogglePause
Func Terminate()
    Exit 0
EndFunc;==>Terminate

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well, I have to admit, I'm 100% confused on what your trying to accomplish here.

So, I'll go through some areas where I can see real problems.

You have a Do / Until $event = 2, but $even only ever = 2 if: PixelGetColor(772 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(772 + $resolution2, 577 + $resolution) > 11000000

What colors are: 10000000 and 11000000 (I'm seriously asking because I do my colors in decimal)? And if you don't know, and if it isn't a color, then you never leave that Do/Until loop.

You do this often throughout your script and if they aren't true scenerios then you may never get your script to work... I might suggest as an example:

(PixelGetColor(772 + $resolution2, 575 + $resolution) <> 0xFF0000) as an example. (0xFF0000 - being hex for red)

I'm just making an example here, because it looks like a lot of different things you through together from pieces of other code, so it's super hard to try and follow it.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I made a couple changes, nothing too drastic, but I did fix part of the pause problem, so now when you pause, it won't run, and when you unpause, it should run again. However, there still remains the problem that when you press run, it's in an enormous loop, and then exiting the loop due to GUI event will put you back exactly where you left when you're done with the function that the event called. In other words, if you press run, and then pause, it'll say it's paused, and if it were outside the loop it would act paused, but until it gets out of the loop it's not paused. This wouldn't be a problem if GUI events (from event mode) worked inside functions.

Hmm, now that I think about it I really didn't help that much, but there are some things you might want to look at.

CODE

$file = FileOpen(@ProgramFilesDir & "\Onestcoder\Include\vars\powervars.txt", 0)

$alt1 = FileReadLine($file, 1)

$alt2 = FileReadLine($file, 2)

$alt3 = FileReadLine($file, 3)

$alt5 = FileReadLine($file, 4)

$alt6 = FileReadLine($file, 5)

$alt7 = FileReadLine($file, 6)

$mpt = FileReadLine($file, 7)

$alt5t = FileReadLine($file, 8)

$alt6t = FileReadLine($file, 9)

$alt7t = FileReadLine($file, 10)

$mpr = FileReadLine($file, 11)

$refresh = FileReadLine($file, 12)

$follow = FileReadLine($file, 13)

FileClose($file)

;--------------------------------------------------------------------------------------

;--------------------------------------------------------------------------------------

;--------------------------------------------------------------------------------------

Local $res = ''

Local $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001")

Local $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002")

Local $resnumber = $resx + $resy

If $resnumber = 1400 Then

$res = 1

ElseIf $resnumber = 1792 Then

$res = 2

ElseIf $resnumber = 2016 Then

$res = 0

ElseIf $resnumber = 2048 Then

$res = 0

ElseIf $resnumber = 2240 Then

$res = 0

ElseIf $resnumber = 2304 Then

$res = 3

EndIf

If $res = '' Then

MsgBox(16, 'Error', "You don't have FFXI in your Registry", 10)

Exit

ElseIf $res = 0 Then

MsgBox(16, "Error", "Your FFXI resolution is not currently supported", 10)

Exit

EndIf

If $res = 1 Then

$resolution = 0

$resolution2 = 0

EndIf

If $res = 2 Then

$resolution = 168

$resolution2 = 225

EndIf

If $res = 3 Then

$resolution = 424

$resolution2 = 481

EndIf

If $refresh = 1 Then

AdlibEnable("refresh", 130000) ; only 1 adlib at a time

EndIf

If $alt5 = 1 Then

AdlibEnable("alt5", 1 + $alt5t) ; only 1 adlib at a time, really 1+? if $alt5t = 1000, 1+1000 = 1001, not very helpful.

EndIf

If $alt6 = 1 Then

AdlibEnable("alt6", 1 + $alt6t) ; only 1 adlib at a time, really 1+? if $alt6t = 1000, 1+1000 = 1001, not very helpful.

EndIf

If $alt7 = 1 Then

AdlibEnable("alt7", 1 + $alt7t) ; only 1 adlib at a time, really 1+? if $alt7t = 1000, 1+1000 = 1001, not very helpful.

EndIf

HotKeySet('{pause}', 'TogglePause')

HotKeySet('{esc}', 'Terminate')

HotKeySet('{insert}', 'Running')

#include <GUIConstants.au3>

opt("GUIOnEventMode", 1)

Global $Paused

Global $run

Global $event

$gui = GUICreate("Powerleveler Bot", 180, 100, 0, 0, -1, $WS_EX_TOPMOST)

GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUICtrlCreatePic(@ProgramFilesDir & "\Onestcoder\Include\img\Obotz3.jpg", 5, 5, 170, 59)

$button_1 = GUICtrlCreateButton("Run", 5, 70, 50, 25)

GUICtrlSetOnEvent($button_1, "Running")

GUICtrlSetState($button_1, $GUI_FOCUS)

$n2 = GUICtrlCreateButton("Exit", 125, 70, 50, 25)

GUICtrlSetOnEvent($n2, "Terminate")

$p2 = GUICtrlCreateButton("Pause", 65, 70, 50, 25)

GUICtrlSetOnEvent($p2, "TogglePause")

GUISetState()

AutoItSetOption("SendKeyDelay", 40);

While 1

While $run = 1 And $Paused = 0

Do

If $follow = 1 Then

Send("!0")

EndIf

If $follow = 4 Then

Send("!1")

EndIf

Sleep(250)

AutoItSetOption("SendKeydownDelay", 250);

If PixelGetColor(26, 577 + $resolution) > 16777000 And PixelGetColor(26, 577 + $resolution) < 16777300 And PixelGetColor(35, 571 + $resolution) > 16777000 And PixelGetColor(35, 571 + $resolution) < 16777300 And PixelGetColor(53, 567 + $resolution) > 16777000 And PixelGetColor(53, 567 + $resolution) < 16777300 Then

Sleep(1000)

Send("^1")

Sleep(500)

Exit

EndIf

If $alt1 = 1 Then

If PixelGetColor(766 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) > 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!1")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If $alt2 = 1 Then

If PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(735 + $resolution2, 537 + $resolution) > 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!2")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If $alt3 = 1 Then

If PixelGetColor(735 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 Then

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(500)

Send("!3")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndIf

EndIf

If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 9000000 Then

med();

$event = 1;low mp.

EndIf

Until $event = 1

WEnd

WEnd

Func refresh()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!4")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>refresh

Func alt5()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!5")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

If $mpr = 1 Then

Sleep(250)

Send("!9")

Sleep(250)

EndIf

EndFunc ;==>alt5

Func alt6()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!6")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>alt6

Func alt7()

If $follow = 1 Then

MouseClick("right")

Sleep(100)

MouseClick("right")

EndIf

Sleep(250)

Send("!7")

Sleep(4000)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

EndFunc ;==>alt7

Func med()

If $alt5 = 1 Then

AdlibDisable() ; since only 1 can be active at a time, this will disable the last one started

EndIf

Sleep(1000)

Send("!8")

Sleep(1500)

Send("!h");down

Sleep(10000)

If PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(735 + $resolution2, 537 + $resolution) > 10000000 Then

AutoItSetOption("SendKeydownDelay", 3000); is this really what you want? Or would sleep(3000) suffice?

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250); only needed if you change it (to 3000) above

Sleep(500)

Send("!2")

Sleep(5000)

Send("!8")

Sleep(1000)

Send("!h");down

EndIf

Sleep(10000)

If PixelGetColor(735 + $resolution2, 537 + $resolution) < 10000000 And PixelGetColor(751 + $resolution2, 537 + $resolution) < 10000000 Then

AutoItSetOption("SendKeydownDelay", 3000); is this really what you want? Or would sleep(3000) suffice?

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250); only needed if you change it (to 3000) above

Sleep(500)

Send("!2")

Sleep(5000)

Send("!8")

Sleep(1000)

Send("!h");down

EndIf

Sleep(60000)

If PixelGetColor(733 + $resolution2, 575 + $resolution) < 9000000 And PixelGetColor(733 + $resolution2, 577 + $resolution) < 8500000 Then

Send("!h");down

EndIf

$event = 0

Do

Sleep(3000)

If PixelGetColor(772 + $resolution2, 575 + $resolution) > 10000000 And PixelGetColor(772 + $resolution2, 577 + $resolution) > 11000000 Then

AutoItSetOption("SendKeydownDelay", 3000); is this really what you want? Or would sleep(3000) suffice?

Send("!h");up

AutoItSetOption("SendKeydownDelay", 250); only needed if you change it (to 3000) above

Sleep(1500)

Send("!9")

Sleep(1500)

If $follow = 1 Then

Sleep(1000)

Send("!0")

Sleep(1000)

EndIf

If $alt5 = 1 Then

AdlibEnable("alt5", 1 + $alt5t) ; if $alt5 = 1, then whichever was called last (could be 6 or 7) will be replaced with 5

EndIf

$event = 2;mp full.

EndIf

Until $event = 2

EndFunc ;==>med

Func Running()

If $run = 0 And $Paused = 1 Then

TogglePause()

Else

$run = 1

EndIf

EndFunc ;==>Running

; Pause function

Func TogglePause()

$Paused = Not $Paused

$run = Not $run

If $Paused = 0 Then

ToolTip("")

ElseIf $Paused = 1 Then

Sleep(100)

ToolTip('Script is "Paused"', 0, 0)

EndIf

EndFunc ;==>TogglePause

Func Terminate()

Exit 0

EndFunc ;==>Terminate

Share this post


Link to post
Share on other sites

Here is a Pause methode I can up with > Do you think this would work???

;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
#include <GUIConstants.au3>
GUICreate("Onestcoder", 218, 100, 1, -1, "", $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$exit = GUICtrlCreateButton("EXIT", 5, 40, 60)
$pause = GUICtrlCreateButton("PAUSE", 75, 40, 60)
$run = GUICtrlCreateButton("RUN", 145, 40, 60)
Global $pausedinput = GUICtrlCreateInput("PAUSED", 75, 5, 60, 20)
Global $runninginput = GUICtrlCreateInput("RUNNING", 75, 5, 60, 20)
Global $event
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
GUISetState()
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
pause()
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
While 1
    $msg = GUIGetMsg()
    If $msg = $pause Then
        GUICtrlDelete($runninginput)
        Global $pausedinput = GUICtrlCreateInput(" PAUSED", 75, 5, 60, 20)
        pause()
    EndIf
    If $msg = $exit Then
        Exit
    EndIf
WEnd
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
Func pause()
    While 1
        $msg = GUIGetMsg()
        Sleep(100)
        If $msg = $run Then
            GUICtrlDelete($pausedinput)
            Global $runninginput = GUICtrlCreateInput("RUNNING", 75, 5, 60, 20)
            ExitLoop
        EndIf
        If $msg = $exit Then
            Exit
        EndIf
    WEnd
EndFunc  ;==>pause
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
Func Terminate()
    Exit 0
EndFunc  ;==>Terminate
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------
Exit

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You don't have to keep deleting the controls, but here is where you will run into the problem.

When your script is running ... then your GUI isn't going to be active, because you'll be in a seperate function. You would more than likely either have to delete the entire GUI and recreate it in the function that your currently in, or run the 'script to act' functions in a seperate script, maybe EventMode might work better in this situation.

None the less, you should still have a HotKeySet() to that pause, so that you can break out of the current functions to that pause.

Edit:

Sorry, meant to re-itterate on don't have to delete controls, most of the time... you can just use GUICtrlSetData(): If your script was just that first While 1 Loop, and the Pause() function, this is what I would have suggested.

#include <GUIConstants.au3>
GUICreate("Onestcoder", 218, 100, 1, -1, "", $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$exit = GUICtrlCreateButton("EXIT", 5, 40, 60)
$pause = GUICtrlCreateButton("PAUSE", 75, 40, 60)
$run = GUICtrlCreateButton("RUN", 145, 40, 60)
Global $pausedinput = GUICtrlCreateLabel("RUNNING", 75, 5, 60, 20)
Global $event
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $pause Then
        GUICtrlSetData($pausedinput, 'PAUSED')
        pause()
    EndIf
    If $msg = $exit Then
        Exit
    EndIf
WEnd
Func pause()
    While 1
        $msg = GUIGetMsg()
        If $msg = $run Then
            GUICtrlSetData($pausedinput, 'RUNNING')
            ExitLoop
        EndIf
        If $msg = $exit Then
            Exit
        EndIf
    WEnd
EndFunc ;==>pause
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Understood :o

What if while I'm in the While statement I have a Do...Until and I insert a function that breaks out and checks the status if the gui after every If...Endif like this

O and I do want the While...Wend to start over if it is paused

SmOke_N I wanted to tell you thank you for your help.

Also knowing what you have already gathered from looking at my scripts - if I were to startover from scrach what advice would you give?

#include <GUIConstants.au3>
GUICreate("Onestcoder", 218, 100, 1, -1, "", $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$exit = GUICtrlCreateButton("EXIT", 5, 40, 60)
$pause = GUICtrlCreateButton("PAUSE", 75, 40, 60)
$run = GUICtrlCreateButton("RUN", 145, 40, 60)
Global $pausedinput = GUICtrlCreateLabel("RUNNING", 75, 5, 60, 20)
Global $event
GUISetState()
While 1
checkguistatus()
    Do
        If Then
        EndIf
        checkguistatus()
        If Then
        EndIf
        checkguistatus()
        If Then
        EndIf
        checkguistatus()
    Until
WEnd
Func pause()
    While 1
        $msg = GUIGetMsg()
        If $msg = $run Then
            GUICtrlSetData($pausedinput, 'RUNNING')
            ExitLoop
        EndIf
        If $msg = $exit Then
            Exit
        EndIf
    WEnd
EndFunc;==>pause
Func checkguistatus()
    $msg = GUIGetMsg()
    If $msg = $pause Then
        GUICtrlSetData($pausedinput, 'PAUSED')
        pause()
    EndIf
    If $msg = $exit Then
        Exit
    EndIf
EndFunc;==>goop

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites

Understood :o

What if while I'm in the While statement I have a Do...Until and I insert a function that breaks out and checks the status if the gui after every If...Endif like this

O and I do want the While...Wend to start over if it is paused

SmOke_N I wanted to tell you thank you for your help.

Also knowing what you have already gathered from looking at my scripts - if I were to startover from scrach what advice would you give?

#include <GUIConstants.au3>
GUICreate("Onestcoder", 218, 100, 1, -1, "", $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$exit = GUICtrlCreateButton("EXIT", 5, 40, 60)
$pause = GUICtrlCreateButton("PAUSE", 75, 40, 60)
$run = GUICtrlCreateButton("RUN", 145, 40, 60)
Global $pausedinput = GUICtrlCreateLabel("RUNNING", 75, 5, 60, 20)
Global $event
GUISetState()
While 1
checkguistatus()
    Do
        If Then
        EndIf
        checkguistatus()
        If Then
        EndIf
        checkguistatus()
        If Then
        EndIf
        checkguistatus()
    Until
WEnd
Func pause()
    While 1
        $msg = GUIGetMsg()
        If $msg = $run Then
            GUICtrlSetData($pausedinput, 'RUNNING')
            ExitLoop
        EndIf
        If $msg = $exit Then
            Exit
        EndIf
    WEnd
EndFunc;==>pause
Func checkguistatus()
    $msg = GUIGetMsg()
    If $msg = $pause Then
        GUICtrlSetData($pausedinput, 'PAUSED')
        pause()
    EndIf
    If $msg = $exit Then
        Exit
    EndIf
EndFunc;==>goop
I would say if the one script part was working, but you GUI interactiveness (<-- is that a word?), to create 2 scripts, one that has all the GUI interactiveness and the script itself. You may make use of an .ini file as well.

It may seem a bit over whelming, but I think you would actually get your desired results.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
:o o god I wouldn't even know where to begain. Linking 2 scripts or an .ini file I'm still a noob but I guess this is the type of project the seperates the men from the boys.

Need a website: http://www.iconixmarketing.com

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