Sign in to follow this  
Followers 0
JesusIsKing

For Loop

16 posts in this topic

Hi, I have a For loop and its skipping whats in it and going to where it says 'Next'

For $a = 0 To _GUICtrlListCount($List) - 1
    GUICtrlCreateListViewItem(_GUICtrlListGetText($List, $a), $ListView)
Next

; it skips GUICtrlCreateListViewItem() and goes straight here

Any help would be great.

Share this post


Link to post
Share on other sites



Add this ConsoleWrite( _GUICtrlListCount($List) & @CR) before the loop and see what it returns. If it's <= 1 then there you go...

Share this post


Link to post
Share on other sites

Add this ConsoleWrite( _GUICtrlListCount($List) & @CR) before the loop and see what it returns. If it's <= 1 then there you go...

I already tried that but with MsgBox() and it says -1

Share this post


Link to post
Share on other sites

-1 is the error ($LB_ERR). Apparently, the listbox has no items and you are trying to create them inside the loop.

Share this post


Link to post
Share on other sites

-1 is the error ($LB_ERR). Apparently, the listbox has no items and you are trying to create them inside the loop.

maybe im trying to create the loop before the list items load into the listox. im going to try to make it sleep for a few seconds.

Share this post


Link to post
Share on other sites

still not working...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

any help?

edit:

im using 3.2.8.1

Edited by JesusIsKing

Share this post


Link to post
Share on other sites

help would be nice

Share this post


Link to post
Share on other sites

Spamming your thread won't make people help you faster. I told what you problem was. Your list box has NO items. Do you even know how a For...To...Next loop works?

Share this post


Link to post
Share on other sites

of course i know how one works. and there are items in the listbox.

Share this post


Link to post
Share on other sites

What you are trying to do is not possible, you are trying to create an item from something that isn't there yet

this works

#include <GUIConstants.au3>

GUICreate("listview items")

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150)

$Items = StringSplit("This|Way,No|That|Direction,Other|Might|Work,No,Yes,Dont Ask", ",")

For $a = 1 To $Items[0]
    GUICtrlCreateListViewItem($Items[$a], $ListView)
Next

GUISetState()


Do
  $msg = GUIGetMsg ()
 
Until $msg = $GUI_EVENT_CLOSE

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

What you are trying to do is not possible, you are trying to create an item from something that isn't there yet

this works

#include <GUIConstants.au3>

GUICreate("listview items")

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150)

$Items = StringSplit("This|Way,No|That|Direction,Other|Might|Work,No,Yes,Dont Ask", ",")

For $a = 1 To $Items[0]
    GUICtrlCreateListViewItem($Items[$a], $ListView)
Next

GUISetState()


Do
  $msg = GUIGetMsg ()
 
Until $msg = $GUI_EVENT_CLOSE

8)

your code doesn't demonstrate anything close to what im trying to do. and that is getting all the items from a list in another application and taking those items and putting it into my listview. anyone know how to do that?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

your code doesn't demonstrate anything close to what im trying to do. and that is getting all the items from a list in another application and taking those items and putting it into my listview. anyone know how to do that?

*******************************

Hi, I have a For loop and its skipping whats in it and going to where it says 'Next'

For $a = 0 To _GUICtrlListCount($List) - 1
      GUICtrlCreateListViewItem(_GUICtrlListGetText($List, $a), $ListView)
  Next

; it skips GUICtrlCreateListViewItem() and goes straight here

Any help would be great.

I already tried that but with MsgBox() and it says -1

maybe im trying to create the loop before the list items load into the listox. im going to try to make it sleep for a few seconds.

still not working...

any help?

edit:

im using 3.2.8.1

help would be nice

of course i know how one works. and there are items in the listbox.

.... Now, How in the hell are we supposed to know that you were trying to read some other listbox?????

Where's the Frigging clue?????

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

*******************************

.... Now, How in the hell are we supposed to know that you were trying to read some other listbox?????

Where's the Frigging clue?????

8)

I'm glad you responded before me - Your wording was a lot gentler than what popped into my head.

grumble grumble... help me now! grumble... insufficient info grumble... help file grumble...


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

*******************************

.... Now, How in the hell are we supposed to know that you were trying to read some other listbox?????

Where's the Frigging clue?????

8)

Here's how I am trying to do it but nothing happens:

Case $msg = $FindBuddies ; when i click the button to copy all the list items into my listview

If WinExists("Full Tilt Poker - Logged In As", "" ) Then

WinActivate("Full Tilt Poker - Logged In As", "")

$buddiesSearch = StringSplit($var, ",")

Send("{CTRLDOWN}{f}")

Send("{CTRLUP}")

Sleep(1000)

If IsArray($buddiesSearch) Then

For $i = 1 To $buddiesSearch[0]

Send($buddiesSearch[$i] & "{Enter}") ; Search for each individual player

Next

For $a = 0 To _GUICtrlListCount($ListBox) - 1 ; this is "supposed" to count and get the index of the list items

GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListView) ; and this is "supposed" to create all of the list items in the Full Tilt Application into my program

Next

EndIf

Else

MsgBox(16, "Error", "Full Tilt isn't running!")

EndIf

^^ thats how I'm trying to do it but it doesn't work

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I could be wrong but....

As a guess "FireLord" = "JesusIsKing" who was posting here the other day in regaurds to the exact same thing and had his thread closed for posting in the exact vagueness and getting tacky with one of the ops.

One of the mentioned threads Here

Aren't I a tiddle taddle .. buwahaha

Cheers

Edit: I'm surprised Jos hasn't spotted this already...

Edited by smashly

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