Sign in to follow this  
Followers 0
supadodger

Case $Label[0] is running itself...

5 posts in this topic

cant figure out what is making my case(s) run when the labels are not clicked.

if i click go it just constantly runs through inetget...

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <Inet.au3>
#include <String.au3>
Opt("TrayIconDebug", 1)
#Region ### START Koda GUI section ### Form=
Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4)
Local $aTaskBar_Pos = WinGetPos("classname=Shell_TrayWnd")
AutoItSetOption("WinTitleMatchMode", $iPrevMode)
If IsArray($aTaskBar_Pos) Then
    $height = @DesktopHeight - $aTaskBar_Pos[3]
    $height = $height - 30
    $Form1 = GUICreate("Form1", @DesktopWidth - 1, $height, 1, 1)
Else
    ConsoleWrite("Not Found" & @CRLF)
EndIf
Global $label[1000], $url[1000], $torrent[1000], $name[1000]
$button1 = GUICtrlCreateButton("Go", @DesktopWidth - 90, 8, -1, 21, $BS_DEFPUSHBUTTON)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, @DesktopWidth - 100, 21)
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj($oIE, 8, 32, @DesktopWidth / 2 - 18, $height - 40)
GUICtrlSetState($GUIActiveX, $GUI_Disable)
GUICtrlSetBkColor(-1, 0xFFEBE8)
$lheight = 32
For $x = 1 To 25
    $url[$x] = "http://www.google.com"
    $label[$x] = GUICtrlCreateLabel("", @DesktopWidth / 2, $lheight, @DesktopWidth / 2 - 18, 15, $SS_NOTIFY)
    $lheight = $lheight + 15
Next
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$oIE.navigate("http://www.imdb.com")
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1

            FileDelete("tpbtemp.db")
            $a1 = _INetGetSource("http://thepiratebay.org/search/monster%20house/0/7/200")
            $torrent = _StringBetween($a1, 'class="detLink"', '<td class="vertTh">')
            For $x = 0 To UBound($torrent) - 1
                ;GUICtrlDelete($label[$x])
                FileWriteLine("tpbtemp.db", $torrent[$x])
            Next
            $lheight = 32
            $torrent = _StringBetween(FileRead("tpbtemp.db"), '<a href="', '"')
            $name = _StringBetween(FileRead("tpbtemp.db"), 'title="Details for ', '"')
            $seeders = _StringBetween(FileRead("tpbtemp.db"), '<td align="right">', '<')
            $leechers = _StringBetween(FileRead("tpbtemp.db"), '<a href="', '"')
            For $x = 1 To UBound($name) - 1
                GuiCtrlSetData ($Label[$x],$name[$x] & "*** Seeds : " & $seeders[$x])
                ;$label[$x] = GUICtrlCreateLabel(StringLeft($name[$x] & "                                                  ", 50) & " | Seeds : " & $seeders[$x], @DesktopWidth / 2, $lheight, @DesktopWidth / 2 - 18, -1, $SS_NOTIFY)
                $lheight = $lheight + 15
            Next


        Case $label[0]
            InetGet($torrent[0], "\\Dellmce\e\Torrents\" & $name[0])
        Case $label[1]
            InetGet($torrent[1], "\\Dellmce\e\Torrents\" & $name[1])
        Case $label[2]
            InetGet($torrent[2], "\\Dellmce\e\Torrents\" & $name[2])
        Case $label[3]
            InetGet($torrent[3], "\\Dellmce\e\Torrents\" & $name[3])
        Case $label[4]
            InetGet($torrent[4], "\\Dellmce\e\Torrents\" & $name[4])
        Case $label[5]
            InetGet($torrent[5], "\\Dellmce\e\Torrents\" & $name[5])
        Case $label[6]
            InetGet($torrent[6], "\\Dellmce\e\Torrents\" & $name[6])
        Case $label[7]
            InetGet($torrent[7], "\\Dellmce\e\Torrents\" & $name[7])
        Case $label[8]
            InetGet($torrent[8], "\\Dellmce\e\Torrents\" & $name[8])
        Case $label[9]
            InetGet($torrent[9], "\\Dellmce\e\Torrents\" & $name[9])
        Case $label[10]
            InetGet($torrent[10], "\\Dellmce\e\Torrents\" & $name[10])
        Case $label[11]
            InetGet($torrent[11], "\\Dellmce\e\Torrents\" & $name[11])
        Case $label[12]
            InetGet($torrent[12], "\\Dellmce\e\Torrents\" & $name[12])
        Case $label[13]
            InetGet($torrent[13], "\\Dellmce\e\Torrents\" & $name[13])
        Case $label[14]
            InetGet($torrent[14], "\\Dellmce\e\Torrents\" & $name[14])
        Case $label[15]
            InetGet($torrent[15], "\\Dellmce\e\Torrents\" & $name[15])
        Case $label[16]
            InetGet($torrent[16], "\\Dellmce\e\Torrents\" & $name[16])
        Case $label[17]
            InetGet($torrent[17], "\\Dellmce\e\Torrents\" & $name[17])
        Case $label[18]
            InetGet($torrent[18], "\\Dellmce\e\Torrents\" & $name[18])
        Case $label[19]
            InetGet($torrent[19], "\\Dellmce\e\Torrents\" & $name[19])
        Case $label[20]
            InetGet($torrent[20], "\\Dellmce\e\Torrents\" & $name[20])
        Case $label[21]
            InetGet($torrent[21], "\\Dellmce\e\Torrents\" & $name[21])
        Case $label[22]
            InetGet($torrent[22], "\\Dellmce\e\Torrents\" & $name[22])
        Case $label[23]
            InetGet($torrent[23], "\\Dellmce\e\Torrents\" & $name[23])
        Case $label[24]
            InetGet($torrent[24], "\\Dellmce\e\Torrents\" & $name[24])
    EndSwitch
WEnd


Func TPB()

EndFunc   ;==>TPB


















Func Find_Taskbar()

EndFunc   ;==>Find_Taskbar

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

supadodger,

You have declared the $label array, but not set any of the elements. That means that they are all regarded as 0, which is what you get as a return from GUIGetMsg() when you have no messages in the queue. So it fires on the first available Case - $label[0]. :(

As soon as you actually create the labels, everything will work normally. All clear? :graduated:

M23

Edit: Typnig.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

supadodger,

As soon as you actually create the labels, everything will work normally. All clear? :graduated:

arent they created right here?

For $x = 1 To 25
    $url[$x] = "http://www.google.com"
    $label[$x] = GUICtrlCreateLabel("", @DesktopWidth / 2, $lheight, @DesktopWidth / 2 - 18, 15, $SS_NOTIFY)
    $lheight = $lheight + 15
Next
Edited by supadodger

Share this post


Link to post
Share on other sites

i got it

my first label is label[0]

but my for $x goes 1 to 25

it should be 0 to 24

thanks

:graduated:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

supadodger,

Sorry, I was looking at the commented ;$label[$x] = GUICtrlCreateLabel line immediately above the Case $label[0]. :graduated:

However, the problem is exactly as I described - here are 2 sections from your script:

; Create the labels
For $x = 1 To 25
    $url[$x] = "http://www.google.com"
    $label[$x] = GUICtrlCreateLabel("", 1,1,1,1, $SS_NOTIFY)
    $lheight = $lheight + 15
Next

; read the labels
Case $label[0]
    InetGet($torrent[0], "\\Dellmce\e\Torrents\" & $name[0])
Case $label[1]
    InetGet($torrent[1], "\\Dellmce\e\Torrents\" & $name[1])

Notice anything about the indices? What do you think is in $label[0]? :D

M23

Edit: I see you found it. :(

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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