Jump to content

Looping through values in AutoIt


Idea
 Share

Recommended Posts

  • Developers

don't understand what you want to do with this code:

For $i = 1 To $tcitem[0]

$IdofSelected = GUICtrlRead($treeview)

$selText = GUICtrlRead($IdofSelected, 1)

$selText = $selText[0]

_GUICtrlTreeViewSelectItem ($gui, $treeview, $tcitem[$i])

Next

Why do you want to loop through all items constantly ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

don't understand what you want to do with this code:

For $i = 1 To $tcitem[0]

$IdofSelected = GUICtrlRead($treeview)

$selText = GUICtrlRead($IdofSelected, 1)

$selText = $selText[0]

_GUICtrlTreeViewSelectItem ($gui, $treeview, $tcitem[$i])

Next

Why do you want to loop through all items constantly ?

The actual code from my inital post is this:

For $i = 1 to $tcitem[0]
$IdofSelected = GUICtrlRead($treeview)
$selText = GUICtrlRead($IdofSelected, 1)
$selText = $selText[0]

_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
Next

Which can be shortened to the following as the first three lines in the for loop serve no purpose for this example. (it's been updated in the intial post):

For $i = 1 to $tcitem[0]
_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
Next

The code you have there will not pause after each selection which is vital if you actually want to see the selections happening in real time. To answer your question, I want to loop through them all constantly as it's part of a larger function that isn't working correctly due to this code not working. Are you able to fix my initial code or point me in the right direction as to why it is not working correctly? Thank you for your time and intrest in this problem.

Edited by Idea
Link to comment
Share on other sites

  • Developers

The actual code from my inital post is this:

For $i = 1 to $tcitem[0]
$IdofSelected = GUICtrlRead($treeview)
$selText = GUICtrlRead($IdofSelected, 1)
$selText = $selText[0]

_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
Next

Which can be shortened to the following as the first three lines in the for loop serve no purpose for this example. (it's been updated in the intial post):

For $i = 1 to $tcitem[0]
_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
Next

The code you have there will not pause after each selection which is vital if you actually want to see the selections happening in real time. To answer your question, I want to loop through them all constantly as it's part of a larger function that isn't working correctly due to this code not working. Are you able to fix my initial code or point me in the right direction as to why it is not working correctly? Thank you for your time and intrest in this problem.

I removed the sleep() because its not good to do so many sleep() commands in a GUI message loop. the GUI will start acting strange and missing control messages.

I still don't understand why you want to Constantly loop through all items ?

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

For the sake of this example it's constantly. In the actual implimentation it's just once. I don't understand why you're constantly missing the point of my post however. Could you please provide some insight into the code as to why it is not functioning as intended? Again, thank you for your time. ;)

:minirant:

I've updated the initial post with code reflecting your suggestion about the example, which really doesn't solve anything as that's how it's done in the actual implimentation however for the sake of testing it would seem a better method based on what you've said about missed controle messages. The "new" code is as follows:

I fully understand that removing the sleep() in your current code is not the solution..... (which i have never said it was in the first place) ...

I can only help you when I understand what you want to accomplish with the For..Next loop , but it seems I am to stupid to understand so probably cannot help you... :P

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Idea, you are truly one of the stupidest people I have ever met. That's ironic since you seem to think everybody else are the stupid ones when they don't understand your inane ramblings. Here's an idea: Leave the forum. All of us are obviously not on the same intellectual plain as you so you have nothing to gain from associating with us lowly beings.

In other words, piss off.

Link to comment
Share on other sites

  • Developers

Idea, you are truly one of the stupidest people I have ever met. That's ironic since you seem to think everybody else are the stupid ones when they don't understand your inane ramblings. Here's an idea: Leave the forum. All of us are obviously not on the same intellectual plain as you so you have nothing to gain from associating with us lowly beings.

In other words, piss off.

:P

Well one thing he did accomplish in the last post ! ...

I understand his problem now and know the answer ... ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I'm 100% sure you do not. Nice try though, pretending to be smart at the last possible second. ;)

Listen, If you are a regular you would know I've nothing to prove here and I am not the type of person that even bothers about these petty things.. ..

But if you are willing to bet for a "Chateau Nuf du Pape" then you're welcome... i have already submitted prove that i know the issue .. :P

Enjoy

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Sieg ist meiner alleine

Sure .... Germans are sometimes sooooooo funny ;)

But time will prove me right ... keep on closely watching the board for the answer ... it will be posted when ready.... :P

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I can't offer a solution but I downloaded the very latest beta and here's what I've found using my own rewrite of the above code:

#include <GUIConstants.au3>

#include <GUITreeView.au3>

#include <Array.au3>

opt("mustDeclareVars", 1)

; Path to INI file

local const $INI = @scriptDir & "\my.ini"

; Create GUI controls

local $gui = guiCreate("TreeView Test", 200, 300)

local $treeView = guiCtrlCreateTreeView(0, 0, 200, 300)

; Create parent and child nodes for each section and entry in the INI file

local $parentNames = iniReadSectionNames($INI)

local $parentNodes[5], $childNodes[15]

$parentNodes[0] = 0

$childNodes[0] = 0

local $childEntries

for $i = 1 to $parentNames[0]

$parentNodes[0] += 1

$parentNodes[$parentNodes[0]] = guiCtrlCreateTreeViewItem($parentNames[$i], $treeView)

$childEntries = iniReadSection($INI, $parentNames[$i])

for $j = 1 to $childEntries[0][0]

$childNodes[0] += 1

$childNodes[$childNodes[0]] = guiCtrlCreateTreeViewItem($childEntries[$j][0], $parentNodes[$i])

next

next

; Display the GUI and verify the content of the arrays

guiSetState()

_arrayDisplay($parentNames, "$parentNames")

_arrayDisplay($parentNodes, "$parentNodes")

_arrayDisplay($childNodes, "$childNodes")

; Display count of items in tree

msgBox(0x40, "Tree item count", _guiCtrlTreeViewGetCount($treeView))

; Attempt to traverse the tree

sleep(1000)

for $i = 1 to $childNodes[0]

local $test = guiCtrlRead($childNodes[$i], 1)

toolTip($childNodes[$i] & @CRLF & $test[0])

_guiCtrlTreeViewSelectItem($gui, $treeView, $childNodes[$i])

sleep(1000)

next

sleep(1000)

Using this code and a debugging MsgBox() in the _GUICtrlTreeViewSelectItem() function, it looks like there's a problem in the first For..Next loop, specifically:

For $i = 0 To _GUICtrlTreeViewGetCount($h_treeview)

If $i == 0 Then

$h_item = GUICtrlSendMsg($h_treeview, $TVM_GETNEXTITEM, $TVGN_CHILD, $TVI_ROOT)

Else

$h_item = GUICtrlSendMsg($h_treeview, $TVM_GETNEXTITEM, $TVGN_NEXT, $h_item)

EndIf

MsgBox(0x40, "UDF", $h_Item)

···

Next
$h_Item gives non-zero values for the first four iterations and zero thereafter. I think that this might be the root of the problem.
Link to comment
Share on other sites

I can't offer a solution but I downloaded the very latest beta and here's what I've found using my own rewrite of the above code:

Using this code and a debugging MsgBox() in the _GUICtrlTreeViewSelectItem() function, it looks like there's a problem in the first For..Next loop, specifically:

$h_Item gives non-zero values for the first four iterations and zero thereafter. I think that this might be the root of the problem.

As noted in the post there is indeed a logic flaw in the _GUICtrlTreeViewSelectItem() function. I'm also using the latest beta, the old version simply had too many errors to count! It seems to have a problem with children named the same. I managed to get Idea's code to work fine with unique children however children named alike caused the same issue experienced with the code in this thread. For my code examples see the post I linked.

On the contrary -- your English is quite excellent if your posts in the linked thread are anything to go by.

(I also promise you, we're not all idiots.)

Vielen Dank für das Kompliment. Ich kann sehen, dass Sie ziemlich klug sind. Edited by ligenza
Link to comment
Share on other sites

  • Developers

If you can prove it I will never post here again through this account or otherwise. Hardly a fair bet as you have nothing to post.

Start removing your account...

It would seem I get to claim the metaphorical Châteauneuf-du-Pape. :P

... Forget about the Wine, because you're not much of a sport so you won't sent that anyway....

The remark about Germans was uncalled for, Teufel.

No clue what you mean. I have not mentioned soccer or any war so don't understand why i would be called a devil.

Conclusion

=======

Yes it is an issue with _GUICtrlTreeViewSelectItem() which selects the first occurence of the letter found in the selected Treeview item. So your script did go though all occurences correctly but the "wrong" item got selected. I PMed Gary (gafrost) of this finding around the same time i posted that i knew the issue with your script.

Reading through the post again I really don't understand why this needed to turn in so much BS but its good to know that this will be last last one from you, since you don't seem to appreciate people that are trying to help you.

afwiedersehen ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Speaking for me personally, I would of not had a problem with you, however, in your first thread here, I tried to explain to you as a developer of the language why I didn't feel your idea request would ever make it into AutoIt. Your response was to question the intelligence of myself and anybody else who didn't just instantly do what you want. So, you've broght this disdain on yourself through your insolent actions. If you can't accept the justifications of developers and insist they aren't smart enough to understand what you are saying, don't you think that perhaps your logic is severely flawed?

At any rate, the only thing I have to say about this threadi s I'm extremely disappointed in LxP and ligenza. You do not deserve an answer to your question but they unfortunately provided one. You wish to call every stupid who doesn't do what you want and even try to insult one of the top scripters on the forum. After such behavior and the behavior you demonstrated to us as developers by calling us stupid in the thread I linked to, I'm disappointed in anybody who would help you. You don't deserve anything except for a ban from this forum. Your actions have clearly demonstrated that you are a whiny littel piss-ant that can't accept any response, no matter how well articulated or even if it's correct unless it's what you want to hear (read). You've proven in the thread I linked to that you are a fool and don't know anything about what you are talking about/doing yet you try to sit up on a pedestal doling out proclamations about people's intelligence. Let me ask you this? How smart are you really if you have to ask for help?. I'm disgusted that anybody would help you after how you have behaved.

Link to comment
Share on other sites

That post is a perfect example of your idiocy.

First of all, your code was not flawless. You started this whole thing when JdeB pointed out a flaw in your code (Sleep's in GUIGetMsg() loops will lead to missing message which is a flaw in your script). Rather than appreciate that bit of help, you decide to go off on JdeB. So that rules out your script being "perfect".

Next example is your statement that the language is flawed. The language has nothing to do with your problem. The function which produces a problem in your code is in fact not part of the language but is a function written in the language Just because it is distributed with the language does not mean the language is flawed if the code is flawed. Flawed by proxy is not a practical form of bug assessment. This function, quite obviously and as well pointed out, is bugged. How a bugged user-defined function is translatable into a flaw in the language is beyond the level of comprehension for my feeble mind and I leave that to you to explain for the rest of us lowly beings who should be humbled by your presence.

Now, as for the personal attacks against JdeB, well, to anybody who's been here more than a month, this constitutes as your third example in a single post of your idiocy. JdeB is the most prolific supplier of support on this forum. More than LxP and definitely more than ligenza who just joined the forum. I suggest to you that your next step should be to get a clue before you try to denounce people on this forum. I don't much care about what you have to say to me, you're an uninspired twat with your comments directed at me (I appreciate originality when people try to denounce me). I've seen better material spew from a dog's ass than what you can produce. However, I think I can speak for a large number of people on this forum when I say your comments directed at JdeB are flat out slanderous. You know nothing about this community you think you're such an expert on if you don't realize that.

Link to comment
Share on other sites

Preface: I think we've all realised that my english is not up to par. It's not my first language so it is very difficult for me. It is with great effort that I post here and I hope you can all appreciate my words well.

Seeing as how you specificly name me in your post I feel it is my duty to respond.

That post is a perfect example of your idiocy.

I've been reading this forum for a number of months now and you are by far the most unusually pathetic person to have graced my monitor. You should be ashamed of what you've done in this thread and be killed.

First of all, your code was not flawless. You started this whole thing when JdeB pointed out a flaw in your code (Sleep's in GUIGetMsg() loops will lead to missing message which is a flaw in your script). Rather than appreciate that bit of help, you decide to go off on JdeB. So that rules out your script being "perfect".

You have a highly selective memory.

I've updated the initial post with code reflecting your suggestion about the example, which really doesn't solve anything as that's how it's done in the actual implimentation, however for the sake of testing it would seem a better method based on what you've said about missed controle messages. The "new" code is as follows:

It's quite clear that the "flaw" had no impact on anything. I suggest you try running the actual code before you make baseless accusations because it has no actual impact. JdeB monopolizing on an irrelivent feature of a quickly patched together example just highlights his cruel mentality. Idea took it way too far calling his little mess of letters perfect however your actions as a dev were totally out of place.

Next example is your statement that the language is flawed. The language has nothing to do with your problem. The function which produces a problem in your code is in fact not part of the language but is a function written in the language Just because it is distributed with the language does not mean the language is flawed if the code is flawed. Flawed by proxy is not a practical form of bug assessment. This function, quite obviously and as well pointed out, is bugged. How a bugged user-defined function is translatable into a flaw in the language is beyond the level of comprehension for my feeble mind and I leave that to you to explain for the rest of us lowly beings who should be humbled by your presence.

I think it's quite apparent the refrence he made to the "flawed" language was talking about the general developer mentality that if they don't get sucked up to then it'll never happen and this has a negative effect on any community. I agree with you that a UDF has no impact on the actual language in terms of being flawed as they're two seperate entities. You assumed and read into what was said and have replyed incorrectly based on your own assumptions. That's not what the AutoIt programmers have come to expect from developers. I'm thoroughly disgusted with you as a person.

Now, as for the personal attacks against JdeB, well, to anybody who's been here more than a month, this constitutes as your third example in a single post of your idiocy. JdeB is the most prolific supplier of support on this forum. More than LxP and definitely more than ligenza who just joined the forum. I suggest to you that your next step should be to get a clue before you try to denounce people on this forum. I don't much care about what you have to say to me, you're an uninspired twat with your comments directed at me (I appreciate originality when people try to denounce me). I've seen better material spew from a dog's ass than what you can produce. However, I think I can speak for a large number of people on this forum when I say your comments directed at JdeB are flat out slanderous. You know nothing about this community you think you're such an expert on if you don't realize that.

I find it ironic that you're so keen to mention personal attacks as you're a very prolific verbal terrorist. Previous acomplishments should not be used as an excuse to break basic human rights of dignity and respect. No one questioned JdeB's acomplishments although he seems to have no problem using them as wepons of mass destruction here on the forum. You hijacked this thread and are giving Idea a lecture on not denouncing people, how pathetic. It's amazing that you find joy in people calling you out on your little terrorist joy bombings and then have some system of appreciating their origionality as they defend themselves. I think your own words will be the end of you as it appears that "You know nothing about this community you think you're such an expert on if you don't realize that." Your behaviour as well as JdeB's is simply unacceptable. I hope you rot well. Edited by ligenza
Link to comment
Share on other sites

However, I think I can speak for a large number of people on this forum when I say your comments directed at JdeB are flat out slanderous.

You speak for me for one. I have already turned on ignore for "Idealogue". I thought he went away last week to write exclusively in his "real languages", like ass-embly code. Auf niemals schreiben!
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

You speak for me for one. I have already turned on ignore for "Idealogue". I thought he went away last week to write exclusively in his "real languages", like ass-embly code. Auf niemals schreiben!

I totally agree. Idea is on ignore forever. How someone can call that alphabet soup code perfect is beyond me. It'll be intresting to see what these "real languages" he speaks of are. Ich hoffe, dass jefhal gteötet ist. ;)
Link to comment
Share on other sites

You've just engaged in exactly that which you accuse me of by using words like "pathetic" so I think your point is kind of lost. It's a shame you used that so early or your post might of had some validity. The rest of your post is rather boring and I see that you've gotten some ill-conceived notion of the evil of JdeB as well, though why I have no idea.

I'd also like to address the point of "because I'm a developer I have to act a certain way". Where is it written that just because I happened to contribute code to AutoIt I must suddenly act like something I'm not? Because I know a little C++ and shared it I must suddenly start acting like some perceived-decent member of society? Newsflash: That wasn't part of the terms of having code accepted into AutoIt. I am who I am and you can like it or not, it doesn't really matter to me. It's obvious that I do have disdain for most of the people here although it's not limited to here but in general. There are some that I like and they generally know who they are and there are some that I accept and they could probably figure out who they are if they put their mind to it. If you're making some assumption that because I have a title next to my name that I'm supposed to act a certain way, you're a fool for not realizing that "Developers" aren't any different than anybody else. I'm no less alive (But perhaps more dead) than anybody else on this forum.

The last thing I wish to say is this. Disdain towards me is warranted. Nobody will argue that (or can). I've earned virtually any comment you can throw my way and will be amused by some of the better ones. There's a plethora of posts to prove all of this. However, I can and will "attack" somebody who speaks ill of my friends, especially when they have proved contrary to what is being said about them. In general, I treat people poorly until they prove themself in some way and then I usually leave them alone. However, when I initially make my comments I generally have no prior knowledge of how that person actually is (They might be a genius on a bad day, for example). However, with JdeB, it's been proved time and time again that he's an intelligent and helpful fellow so these comments that have been made against him are baseless.

In other words, I've earned what I get, I have a history of this sort of thing. JdeB, on the other hand, has a history of being helpful and does not deserve what he is getting. As for the innocent people you don't feel deserve what I deal out to them, my approach to things is generally (and obviously) different than convention. People have to earn the right to be treated decent by me which means by default, people are treated less than decent. Most people really aren't decent and can sometimes pretend to be decent for brief periods of time if they need to. It's usually possible to shatter the "decency" facade, though and I'm usual approach is to take a very large verbal hammer to people's head and see what shakes out.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...