Jump to content
Sign in to follow this  
spkiller

unknown reason for this not to work

Recommended Posts

spkiller

im trying to make a program that runs a website then refreashes it a certain period of time given by variables that the user enter this is what i have

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include<XProTec.au3>

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$points1 = GUICtrlRead($pointsin1)
$time1 = GUICtrlRead($timein1)
$math1 = $points1 * $time1
$stopv1 = 0
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $start1
        If GUICtrlRead($URL1) <> "" Then
            If $pointsin1 <> "" Then
                If $timein1 <> "" Then
                    _IENavigate($browser1,GUICtrlRead($URL1),1)
                    sleep($math1)
                    Do
                        _IEAction($browser1,"refresh")
                        Sleep($math1)
                    Until $stopv1 = 1
                Else
                    MsgBox(0,"Your missing stuff","please put the time it takes to regain a point")
                EndIf
            Else
                MsgBox(0,"Your missing stuff","Please put the amount of points")
            EndIf
        Else
            MsgBox(0,"Your missing stuff","please put the url of the action you wish to do")
        EndIf
    Case $stop1
        stop()


EndSwitch
WEnd

the input variables dont work and i dont know how to stop the script when the user wants to plz help thnx

Share this post


Link to post
Share on other sites
NeedHelp

im trying to make a program that runs a website then refreashes it a certain period of time given by variables that the user enter this is what i have

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include<XProTec.au3>

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$points1 = GUICtrlRead($pointsin1)
$time1 = GUICtrlRead($timein1)
$math1 = $points1 * $time1
$stopv1 = 0
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $start1
        If GUICtrlRead($URL1) <> "" Then
            If $pointsin1 <> "" Then
                If $timein1 <> "" Then
                    _IENavigate($browser1,GUICtrlRead($URL1),1)
                    sleep($math1)
                    Do
                        _IEAction($browser1,"refresh")
                        Sleep($math1)
                    Until $stopv1 = 1
                Else
                    MsgBox(0,"Your missing stuff","please put the time it takes to regain a point")
                EndIf
            Else
                MsgBox(0,"Your missing stuff","Please put the amount of points")
            EndIf
        Else
            MsgBox(0,"Your missing stuff","please put the url of the action you wish to do")
        EndIf
    Case $stop1
        stop()


EndSwitch
WEnd

the input variables dont work and i dont know how to stop the script when the user wants to plz help thnx

Heres a concept you are not getting.

$pointsin1 and other variables like it contain the Control ID of that control, not what that control contains. Open up your help file and look at the function GuiCtrlRead


There are 10 types of people in this world.Those who understand binary, and those who don't.

Share this post


Link to post
Share on other sites
spkiller

Heres a concept you are not getting.

$pointsin1 and other variables like it contain the Control ID of that control, not what that control contains. Open up your help file and look at the function GuiCtrlRead

oh i c thnx but i treied using that and the same thing happens the url one works but not the other ones

Share this post


Link to post
Share on other sites
NeedHelp

oh i c thnx but i treied using that and the same thing happens the url one works but not the other ones

Post your new script with GuiCtrlRead

There are 10 types of people in this world.Those who understand binary, and those who don't.

Share this post


Link to post
Share on other sites
spkiller

Post your new script with GuiCtrlRead

well isnt it here
$points1 = GUICtrlRead($pointsin1)
$time1 = GUICtrlRead($timein1)
$math1 = $points1 * $time1
wouldnt that work?

Share this post


Link to post
Share on other sites
DCCD

GUICtrlRead()., Inside the while-wend loop,

i dont know how to stop the script

coz! Do...Until!!

take a look!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
;#include<XProTec.au3>

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$stopv1 = 0
GUISetState(@SW_SHOW)

While 1
    $math1 = GUICtrlRead($pointsin1) * GUICtrlRead($timein1) ; in milliseconds!
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start1
            If GUICtrlRead($URL1) <> "" Then
                If $pointsin1 <> "" Then
                    If $timein1 <> "" Then
                        _IENavigate($browser1, GUICtrlRead($URL1), 1)
                        Sleep($math1)
                        Do
                            _IEAction($browser1, "refresh")
                            ConsoleWrite($math1 & @CRLF)
                            Sleep($math1)
                        Until $stopv1 = 1
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
        Case $stop1
            stop()
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
spkiller

GUICtrlRead()., Inside the while-wend loop,

coz! Do...Until!!

take a look!

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
;#include<XProTec.au3>

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$stopv1 = 0
GUISetState(@SW_SHOW)

While 1
    $math1 = GUICtrlRead($pointsin1) * GUICtrlRead($timein1) ; in milliseconds!
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start1
            If GUICtrlRead($URL1) <> "" Then
                If $pointsin1 <> "" Then
                    If $timein1 <> "" Then
                        _IENavigate($browser1, GUICtrlRead($URL1), 1)
                        Sleep($math1)
                        Do
                            _IEAction($browser1, "refresh")
                            ConsoleWrite($math1 & @CRLF)
                            Sleep($math1)
                        Until $stopv1 = 1
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
        Case $stop1
            stop()
    EndSwitch
WEnd
thnx i do the until but then it continues this is what i have now

until:

Until $stopv1 = True

.....

Case $stop1
        If $stopv1 = False Then
            $stopv1 = True
            sleep(100)
        EndIf

btw srry for being such a newb i just started to code yesturday thnx to 403forbidden403 on youtube

Edited by spkiller

Share this post


Link to post
Share on other sites
spkiller

now how would i have it stop from looping when i press the button stop?

Share this post


Link to post
Share on other sites
martin

now how would i have it stop from looping when i press the button stop?

Case $stop1
      ExitLoop; or Exit to quit the whole script.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
spkiller

Case $stop1
      ExitLoop; or Exit to quit the whole script.
i tried that it just keeps looping i cant even close with the x i have to pause the script then exit

this is what i had

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
;~ ------------------------------------------------------------------------------------
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point in miliseconds?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$points1 = GUICtrlRead($pointsin1)
$times1 = GUICtrlCreateInput("", 32, 220, 89, 21)
$Timesx1 = GUICtrlCreateLabel("Times to do it? -1 = inf", 32, 200, 142, 17)
GUISetState(@SW_SHOW)


While 1
    $time1 = GUICtrlRead($times1)
    $math1 = GUICtrlRead($pointsin1) * GUICtrlRead($timein1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $stop1
            ExitLoop
        Case $start1
            If GUICtrlRead($URL1) <> "" Then
                If GUICtrlRead($pointsin1) <> "" Then
                    If GUICtrlRead($timein1) <> "" Then
                        _IENavigate($browser1, GUICtrlRead($URL1), 1)
                        Sleep($math1)
                        $time1 = $time1 - 1
                        Do
                            _IENavigate($browser1, GUICtrlRead($URL1), 1)
                            Sleep($math1)
                            $time1 = $time1 - 1
                            If $time1 = 0 Then ExitLoop
                        Until $time1 = 0
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
    EndSwitch
WEnd
Edited by spkiller

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  

×