 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Wed Jul 09, 2008 11:45 am Post subject: |
|
|
| 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 |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Wed Jul 09, 2008 11:49 am Post subject: |
|
|
I want see whether servers.txt contains any unwanted characters. Copy/pasting would not help and hence I asked you to upload it.
 _________________
 |
|
| Back to top |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 14, 2008 2:00 pm Post subject: |
|
|
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.
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 |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Jul 14, 2008 9:37 pm Post subject: |
|
|
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 |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 14, 2008 9:48 pm Post subject: |
|
|
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 |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Sun Jul 20, 2008 1:27 pm Post subject: |
|
|
| bump |
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Mon Jul 21, 2008 7:31 am Post subject: |
|
|
| 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 |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 21, 2008 12:23 pm Post subject: |
|
|
| 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 |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 21, 2008 1:39 pm Post subject: |
|
|
| 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 |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Mon Jul 21, 2008 1:44 pm Post subject: |
|
|
| Perhaps add a ControlSetText to clear the edit control so that you are sure it is emptied before you continue. |
|
| Back to top |
|
 |
Hedonist
Joined: 24 Jan 2005 Posts: 34
|
Posted: Mon Jul 21, 2008 3:08 pm Post subject: |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|