Jump to content

Unbelievably frustrating


Recommended Posts

ok, so here is the thing.

I have a program that does a half a dozen things -- one of which is to fill in data on the GUI. Naturally, I use GUIctrlsetdata().

It works great. There is nothing that has gone wrong until now.

I need to set information in a COMBO box. I calculate all the options that the box should provide, they are separated in a single string by a verticle line "|" just as they should be.

I output the string in a message box just to check it before it SHOULD be displayed, and the string is in good order. there is nothing wrong that i can see. BUT THE D%*& THING WONT OUTPUT.

Here is the kicker though: It WILL work every 10th or 11th time. Just once, and then i dont change ANYTHING and it goes back to not working.

I am using SciTe, Lastest Beta, New Download. I just dont know.

I would rather not post this code, cause there are about 2000 lines of code, and this only a small problem so here is the snippet that is giving trouble:

$data = string("")
    for $line = 1 to _filecountlines("classtemp.txt")
        $data = $data & stringleft(filereadline("classtemp.txt",$line),5)&"|"
    Next
    $data = stringformat("%s",$data)
    test($data)
    guictrlsetdata($crn,$data)oÝ÷ ÚØ^~)^rV¬²×¦¦Üm{¬¶Æ§uÊ'µ¨§±Ö­jØ^Më-~éܶ*'ÉbµêÚ£ºËZºÚ"µÍ[ÈÝ
    ÌÍÜÝ[ÊHÙØÞ
K   ][ÝÉ][ÝË    ÌÍÜÝ[ÊB[[

all variables have been declared, $crn IS the handle of the COMBO box control.

AHHAHAHAH

Help please!! Tell me that it is something obvious.

Orange

Link to comment
Share on other sites

  • Moderators

You want to string format the '|' too? I would think this is more what your after?

$data = ''
For $line = 1 To _FileCountLines("classtemp.txt")
    $data = $data & StringFormat("%s", StringLeft(FileReadLine("classtemp.txt", $line), 5)) & "|"
Next
test($data)
GUICtrlSetData($crn,$data)
P.S., I'm not quite understanding the StringFormat() and what your doing there (Or attempting to do).

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.

Link to comment
Share on other sites

I appreciate the help guys, but neither of those suggestions work.

All I am trying to do is to set the data of a combo by assembling a string from the first 5 letters or numbers from each line of a file. The file is only about 5 lines long with the rest of the line of each line reading with some unwanted text:

classtemp.txt:

12345|0asdfasdfasda

41234|asdfasdfasdfasvasdasfd

65421|asdfdcasdaeradf

etc.

what I want is a combo to show drop-down options of : 12345 above 41234 above 65421

i have tried adding the "|" after and trimming the string to 5 places. I have tried tringing the string to 6 places and including the "|" that is already in the file.

ARGH!!!

Link to comment
Share on other sites

this is a direct copy of the output of my loop to assemble the string from classtemp:

$data = 02509|02537|02592|19880|26914|19878|19851|05717|20528|81566|81511|26588|20532|81525|81579|05734|

shouldn't that work? when i type:

guictrlsetdata($crn,$data)

?

Edited by orange
Link to comment
Share on other sites

  • Moderators

this is a direct copy of the output of my loop to assemble the string from classtemp:

$data = 02509|02537|02592|19880|26914|19878|19851|05717|20528|81566|81511|26588|20532|81525|81579|05734|

shouldn't that work? when i type:

guictrlsetdata($crn,$data)

?

With quotes around it yes

$data = "02509|02537|02592|19880|26914|19878|19851|05717|20528|81566|81511|26588|20532|81525|81579|05734|
"
assuming that $crn is the "Combo" in question. You should provide a small running example to test. Edited by SmOke_N

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.

Link to comment
Share on other sites

With quotes around it yes

$data = "02509|02537|02592|19880|26914|19878|19851|05717|20528|81566|81511|26588|20532|81525|81579|05734|
"
assuming that $crn is the "Combo" in question. You should provide a small running example to test.
yes, but I dont need quotes as that line does not control the value of the variable $data. that is the output from a messagebox to make sure that the value is already there
Link to comment
Share on other sites

You should provide a small running example to test.

Thats the problem! If I post my original code, there are a few megabytes of pics and thousands of lines to make the whole thing work properly, even for this line of code.

And when I do the EXACT same thing in a second script it works like it should! That is what is so agrivating. I mean, that clearly indicates that there is something wrong with the original code, but this line is really that simple. This is the only purpose that it serves.

Here is a kicker though: I just noticed that if I change the location of the GUI output to a different handle, then the string is displayed!

and then if I change it back, it is not!!!!!!!!

this is the only time that I set the value of $crn, so it is not getting reset. this is the only time that I even use it.

Link to comment
Share on other sites

  • Moderators

Thats the problem! If I post my original code, there are a few megabytes of pics and thousands of lines to make the whole thing work properly, even for this line of code.

And when I do the EXACT same thing in a second script it works like it should! That is what is so agrivating. I mean, that clearly indicates that there is something wrong with the original code, but this line is really that simple. This is the only purpose that it serves.

Here is a kicker though: I just noticed that if I change the location of the GUI output to a different handle, then the string is displayed!

and then if I change it back, it is not!!!!!!!!

this is the only time that I set the value of $crn, so it is not getting reset. this is the only time that I even use it.

Well that should tell you that it's a problem with "this" script. I don't know what to tell you, but if you just want to chase your tail I can uderstand. It's probably not that line, but how you have it originally set up.

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.

Link to comment
Share on other sites

Well that should tell you that it's a problem with "this" script. I don't know what to tell you, but if you just want to chase your tail I can uderstand. It's probably not that line, but how you have it originally set up.

yeah, I think I am.

I need to figure this out -- but I was just posting to see if there was somthing terribly obvious that I was missing. Guess not.

thanks though

EDIT

I am an idiot.

Edited by orange
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...