AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to insert a variable into every line of a lisbox?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Wed Jul 09, 2008 11:45 am    Post subject: Reply with quote

I can have it create a server.txt file when the initial data is collected. But I will still need to eliminate blank lines and organize the text to have the grid location. Man that gets messy too. I will need to include code to clean up the txt file.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Wed Jul 09, 2008 11:49 am    Post subject: Reply with quote

I want see whether servers.txt contains any unwanted characters. Copy/pasting would not help and hence I asked you to upload it.

Smile
_________________
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Mon Jul 14, 2008 2:00 pm    Post subject: Reply with quote

A text file would look just like the list. When I do a guicontrolget it looks like.

    Server1
    Server2
    Server3
    Server4


Then I do a loop parse and I get.

    Server1,Grid1,
    Server2,Grid1,
    Server3,Grid1,
    Server4,Grid1,


It looks good on the first grid location. When I move the next grid it looks like the script is retaining some data from the last rack.

It should look like this when I do the initial guicontrolget.
    Server99
    Server98


But I get this.
    Server99
    Server98
    rver3
    Server4


It is keeping some data from the last rack. I don't get it.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Mon Jul 14, 2008 9:37 pm    Post subject: Reply with quote

you probably need to clean out your variables (arrays especially). Can you post your updated code and servers.txt?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Mon Jul 14, 2008 9:48 pm    Post subject: Reply with quote

I am not using a server.txt file. I am entering the data with a bar code scanner. It gets populated in a Gui Edit Box. Then I retrieve it from there with GuiControlGet and parse the data to eliminate blank lines and organize the list. Here is the code from the Gui to when the data is written to a comma delimited csv file.

Code:
GuiRacknorth:
WinWaitClose ,North Grid Location?

Gui, 3:Add, Button, x21 y190 w190 h70 gNextRack3, Next Rack
Gui, 3:Add, Button, x6 y7 w130 h30 gSavenExit3, Save and Exit
Gui, 3:Add, Button, x166 y7 w60 h20 gHelp3, Help
Gui, 3:Add, Text, x6 y43 w200, Scan inventory at grid %grid%.
Gui, 3:Add, Edit, y62 x6 h117 w220,
Gui, 3:Show,, North Inventory %timestamp%
GuiControl, 3:focus, Edit1

Return

3GuiEscape:
msgbox,4,Save Data?,Would you like to save before exiting the program?
   ifmsgbox yes
      {
      goto SavenExit3
      }
   else
      {
      ExitApp
      }

3GuiClose:
msgbox,4,Save Data?,Would you like to save before exiting the program?
   ifmsgbox yes
      {
      goto SavenExit3
      }
   else
      {
      ExitApp
      }

NextRack3:
GuiControlGet,servers,,Edit1,
msgbox, %servers%
loop, parse, servers, `n, `r
{
  ifequal,a_loopfield,, continue
  newservers .="`n"a_loopfield "," grid ","
}
msgbox,%newservers%
FileAppend,
   (
   %newservers%
   ),North Inventory %timestamp%.csv
servers =
newservers =
grid =
gui, 3:destroy
goto,guigridnorth
return
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Sun Jul 20, 2008 1:27 pm    Post subject: Reply with quote

bump
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Mon Jul 21, 2008 7:31 am    Post subject: Reply with quote

Your code snippet is hard to test because most labels are missing. You use GuiControlGet, why not Gui, Submit and pass on the variable that way? It looks like the servers= is not emptied correctly.
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Mon Jul 21, 2008 12:23 pm    Post subject: Reply with quote

You won't be able to test the code unless you have a Windows CE device. The code works fine in Windows XP, but populates the extra data in Windows CE. I can try a Gui, Submit. I'm not sure it will help. You are correct, servers= is not emptied correctly.
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Mon Jul 21, 2008 1:39 pm    Post subject: Reply with quote

I tried a Gui, Submit. I still get the same result. This tells me that there is nothing wrong with the way I am retrieving the data from the edit box, but something wrong with the gui, edit box.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Mon Jul 21, 2008 1:44 pm    Post subject: Reply with quote

Perhaps add a ControlSetText to clear the edit control so that you are sure it is emptied before you continue.
Back to top
View user's profile Send private message
Hedonist



Joined: 24 Jan 2005
Posts: 34

PostPosted: Mon Jul 21, 2008 3:08 pm    Post subject: Reply with quote

That was a good idea. That is what I was doing with the server=. Unfortunately the ControlSetText didn't work either. I did a msgbox after the command and it shows that the command is blanking the data, but there must be something wrong with the edit field in the Gui. I need to use the GuiEdit because it responds fast to my scanner inputs. When I use a list box it takes too long to populate the data and I am already on to the next server name by then.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group