Jump to content
Sign in to follow this  
GWmellon

Odd combobox problem

Recommended Posts

GWmellon

As stated, the code below will populate the combo box when customer.txt is placed on a different machine and reached over the network but not when the customer.txt file is local. The reg calls tell the program where the files can be found. These locations are correct on the machine with the local files, if I place a msgbox after the "$vesselforchartlistuntrimed= StringTrimLeft($Vesselnameused1,$Stepone)" line I see the contents of the customer.txt. It just never populates the combobox.

using v3.2.8.1. Have not tried it with a beta version. I tried this on a number of OS (2000 to xp pro). The same thing happens regardless of what computer is the local and what computer is accessing from the network

Any help?

#cs
Test
In a larger program this works correctly  over the network but not when the files are Local
Customer text will read but does not populate the combobox
#ce
#include <Constants.au3>
#include <GUIConstants.au3>
#include <File.au3>
#Include<Array.au3>
#include <Date.au3>
$Vesselname =""
$packlist = GUICreate("Pack list", 660, 397, 184, 121)
$Vessel = GUICtrlCreateCombo("", 136, 8, 241, 25)
$Label1 = GUICtrlCreateLabel("Vessel Name   ", 24, 8, 107, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUISetState(@SW_SHOW)
$customerlistlocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "customer list");location of customer.txt
$customerdatalocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "Accounts");location of /Quadmanger accounts
$baselocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "baseroot");location of root on machine with the data
; Populate Vessel list.  _FileReadToArray($customerlistlocation, $Vesselname)
; get vessel names
For $x = 1 to $Vesselname[0]
    $Vesselnameused1 = StringReplace($Vesselname[$X], @TAB, " ")
    $Stepone= StringInStr($Vesselnameused1," ") 
    $vesselforchartlistuntrimed= StringTrimLeft($Vesselnameused1,$Stepone)
    GUICtrlSetData($Vessel,$vesselforchartlistuntrimed &" ")
Next





MsgBox(1,"stop","stop")

edit: a couple of misspellings it the comments

Edited by GWmellon

Share this post


Link to post
Share on other sites
PsaltyDS

As stated, the code below will populate the combo box when customer.txt is placed on a different machine and reached over the network but not when the customer.txt file is local. The reg calls tell the program where the files can be found. These locations are correct on the machine with the local files, if I place a msgbox after the "$vesselforchartlistuntrimed= StringTrimLeft($Vesselnameused1,$Stepone)" line I see the contents of the customer.txt. It just never populates the combobox.

using v3.2.8.1. Have not tried it with a beta version. I tried this on a number of OS (2000 to xp pro). The same thing happens regardless of what computer is the local and what computer is accessing from the network

Any help?

Throw in a bunch of debug statements to check where it all goes wrong:

$customerlistlocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "customer list");location of customer.txt
ConsoleWrite("Debug: $customerlistlocation = " & $customerlistlocation & @LF)

$customerdatalocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "Accounts");location of /Quadmanger accounts
ConsoleWrite("Debug: $customerdatalocation = " & $customerdatalocation & @LF)

$baselocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "baseroot");location of root on machine with the data
ConsoleWrite("Debug: $baselocation = " & $baselocation & @LF)

; Populate Vessel list.
_FileReadToArray($customerlistlocation, $Vesselname)
_ArrayDisplay($Vesselname, "Debug: $Vesselname")

; get vessel names
For $x = 1 To $Vesselname[0]
    $Vesselnameused1 = StringReplace($Vesselname[$x], @TAB, " ")
    ConsoleWrite("Debug: $Vesselnameused1 = " & $Vesselnameused1 & @LF)
    
    $Stepone = StringInStr($Vesselnameused1, " ")
    $vesselforchartlistuntrimed = StringTrimLeft($Vesselnameused1, $Stepone)
    ConsoleWrite("Debug: $vesselforchartlistuntrimed = " & $vesselforchartlistuntrimed & @LF)
    
    GUICtrlSetData($Vessel, $vesselforchartlistuntrimed & " ")
    ConsoleWrite("Debug: GuiCtrl data set." & @LF)
Next

<_<


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
GWmellon

Thanks for the debug script. Ran it

And the output on both machines is the same. Same number of records (0 to 768). Copy and paste the Debug: output to two text files, used ExamDiff to compare them. No difference except for the location of the three vars from the reg. Still nothing in the local machines combo box.

Step Two? <_<

Edited by GWmellon

Share this post


Link to post
Share on other sites
martin

Thanks for the debug script. Ran it

And the output on both machines is the same. Same number of records (0 to 768). Copy and paste the Debug: output to two text files, used ExamDiff to compare them. No difference except for the location of the three vars from the reg. Still nothing in the local machines combo box.

Step Two? <_<

Maybe run the script in a debugger.

If you step through and examine the variables then you should quickly see where it all goes wrong.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Valuater

Maybe.... Replace

GUICtrlSetData($Vessel, $vesselforchartlistuntrimed & " ")

With...

#Include <GuiComboBox.au3> ; at top of script

_GUICtrlComboBox_AddString($Vessel, $vesselforchartlistuntrimed & " ")

I have seen this prob before

uses beta

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
GWmellon

I am in a production enviroment. Will the beta install in its own folder? I cannot overwrite the existing autoit.

Is there a autoit debugger somewhere? Still somewhat new at this.

Edited by GWmellon

Share this post


Link to post
Share on other sites
Valuater

Will the beta install in its own folder?

Yes!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
SmOke_N

I am in a production enviroment. Will the beta install in its own folder? I cannot overwrite the existing autoit.

It installs to a "Beta" directory within the primary AutoIt directory.

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.

Share this post


Link to post
Share on other sites
GWmellon

Thanks. I'll give it a shoot

Share this post


Link to post
Share on other sites
GWmellon

Still no love. I made the changes suggested, used Compile script to .exe (beta) (also toggled to beta for good measure.). Got no errors from the compiler. Same result. Note, the person using the "local" machine is getting a bit tired of seeing me. I am not able to install the beta on that machine. Can the debug: items be output to a file?

Share this post


Link to post
Share on other sites
Jos

Do you have a testscript (like shown) and the input file that when its run the issue is shown ?

If so, Can you zip up and make it available ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
martin

Still no love. I made the changes suggested, used Compile script to .exe (beta) (also toggled to beta for good measure.). Got no errors from the compiler. Same result. Note, the person using the "local" machine is getting a bit tired of seeing me. I am not able to install the beta on that machine. Can the debug: items be output to a file?

Yes. At the start of your script put

$DebugFile = Fileopen("dbfile1.txt",2);2 for write

Replace all the

ConsoleWrite(

with

FileWriteLine($DebugFile ,

At the end of your script put

FileClose($DebugFile)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
GWmellon

Give me a few minutes. The file is a text list of our customers. I'll generate a fake one.

Share this post


Link to post
Share on other sites
GWmellon

Find attached odd_combo.zip. The text file only has five records in it. However, shows the same behavior.

Since I have been testing with the au3 file that has all of the Debug and ConsoleWrite lines in it I have included that file.

odd_combo.zip

Share this post


Link to post
Share on other sites
Jos

Made some changes to be able to test (No reg entries <_< ) but it seems to work fine for me:

#include <Constants.au3>
#include <GUIConstants.au3>
#Include <GuiComboBox.au3> 
#include <File.au3>
#Include<Array.au3>
#include <Date.au3>
$Vesselname =""
$packlist = GUICreate("Pack list", 660, 397, 184, 121)
$Vessel = GUICtrlCreateCombo("", 136, 8, 241, 25)
$Label1 = GUICtrlCreateLabel("Vessel Name   ", 24, 8, 107, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUISetState(@SW_SHOW)

$customerlistlocation = "customers.txt"
; Populate Vessel list.
_FileReadToArray($customerlistlocation, $Vesselname)
_ArrayDisplay($Vesselname, "Debug: $Vesselname")

; get vessel names
For $x = 1 To $Vesselname[0]
    If StringStripWS($Vesselname[$X],1) = "" then ContinueLoop
    $Vesselnameused1 = StringReplace($Vesselname[$X], @TAB, " ")
    $Stepone = StringInStr($Vesselnameused1, " ")
    $vesselforchartlistuntrimed = StringTrimLeft($Vesselnameused1, $Stepone)
    ConsoleWrite("Debug: $vesselforchartlistuntrimed = " & $vesselforchartlistuntrimed & @LF)
 ; _GUICtrlComboBox_AddString($Vessel, $vesselforchartlistuntrimed & " ")
    GUICtrlSetData($Vessel, $vesselforchartlistuntrimed & " ")
    ConsoleWrite("Debug: GuiCtrl data set." & @LF)
Next

MsgBox(1,"test2","test2")
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
martin

Made some changes to be able to test (Not reg entries <_< ) but it seems to work fine for me:

Agreed, I made similar changes and no problems.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
GWmellon

Worked for me as it stands. Adding back the registery line

$customerlistlocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "customer list")

the problem returned.

I guess the work around is an ini file.

Is this a bug, expected behavior or am I letting my clueless flag fly?

Share this post


Link to post
Share on other sites
Jos

Worked for me as it stands. Adding back the registery line

$customerlistlocation = RegRead("HKEY_CURRENT_USER\Software\ECC\Program Data Locations", "customer list")

the problem returned.

I guess the work around is an ini file.

Is this a bug, expected behavior or am I letting my clueless flag fly?

Nah..that shouldn't be an issue when its pointing to the same file .

What is the exact value returned from the registry ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
GWmellon

Just to make the example as clean as possible, the customer.txt file is the the root of the computer which is currently (and briefly) shared. Using msg box for the value of $customerlistlocation, the computer that works over the network returns \\key\rootc\customer.txt. The computer where it does not work locally returns C:\customer.txt.

By the way, the file is being read. All the vessels are showing up in the ConsoleWrite and Debug statements.

One more btw. This code is being used in three different programs, two of which have to be accessed both on the local computer and over the network.

Edited by GWmellon

Share this post


Link to post
Share on other sites
Jos

Just to make the example as clean as possible, the customer.txt file is the the root of the computer which is currently (and briefly) shared. Using msg box for the value of $customerlistlocation, the computer that works over the network returns \\key\rootc\customer.txt. The computer where it does not work locally returns C:\customer.txt.

By the way, the file is being read. All the vessels are showing up in the ConsoleWrite and Debug statements.

One more btw. This code is being used in three different programs, two of which have to be accessed both on the local computer and over the network.

It shouldn't matter where the file is located really.

Not sure now what I need to do to make it fail.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×