Jump to content

Odd combobox problem


 Share

Recommended Posts

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

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

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

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • Developers

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 ?

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

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.
Link to comment
Share on other sites

  • Developers

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

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

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.
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • Developers

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 ?

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

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

  • Developers

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

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

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...